Files
pixelarium/lib/imaging/PixelariumImageFactory.hpp
T
m-aXimilian 1ea83d9d11 Czi rendering (#10)
* add dimension selector sliders to czi view

* version doc & version bump

* cosmetic

* fix build?

* multi-dimension selection enabled in czi view

* remove the parameterized reset function of the renderer

it is not and is conceptually questionable

doc updates & some minor improvements

auto-update CZI-view when sliders are moved

set initial window size

fix windows build and msvc build

For reasons I don not comprehend, on Windows, we must include
=opencv2/core/mat.hpp= as the very last header in the =CvMatRender.hpp=.
If this is at any other position building on Windows, compilation will
break w/ all kinds of cryptic errors regarding OpenCV.

When building w/ msvc =__PRETTY_FUNCTION__= is not defined. =ILog.hpp=
now defines it. This should be revised to only be set when the
compiler is msvc. For the time being, it is considered sufficient though.
2026-02-16 20:36:48 +01:00

39 lines
1.0 KiB
C++

#pragma once
#include <memory>
#include "IPixelariumImage.hpp"
#include "utilities/ILog.hpp"
namespace pixelarium::imaging
{
constexpr pixelarium::imaging::ImageFileType ExtensionToType(const std::string& extension)
{
std::string lower_ext{extension};
std::ranges::transform(extension, lower_ext.begin(), [](const char c) -> char { return std::tolower(c); });
if (lower_ext == ".jpg" || lower_ext == ".jpeg")
{
return pixelarium::imaging::ImageFileType::JPG;
}
if (lower_ext == ".png")
{
return pixelarium::imaging::ImageFileType::PNG;
}
if (lower_ext == ".czi")
{
return pixelarium::imaging::ImageFileType::CZI;
}
return pixelarium::imaging::ImageFileType::UNKNOWN;
}
/// @brief Factory for instantiating implementations of IPixelariumImage based on the given file type.
class PixelariumImageFactory
{
using Log = utils::log::ILog;
public:
static std::unique_ptr<IPixelariumImage> CreateImage(const std::string& uri, const Log& log);
};
} // namespace pixelarium::imaging