Misc Improvements (#7)

* get rid of optional<ptr> -> double indirection

* more optional cleanup

* fix

* add more render pixel type options

* towards different views

* missing virtual declaration of ShowImage

* fix runtime

* init image view factory

* fix build

Render Image close button re-enable

add readme

init documentation

use awesomeDoxygen

ci build docs

install doxygen

id token permission

add pages write permission
This commit is contained in:
m-aXimilian
2025-09-23 21:57:08 +02:00
committed by Maximilian Kueffner
parent 0be064bb8e
commit 235d00192a
34 changed files with 418 additions and 173 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ pixelarium::imaging::PixelariumCzi::PixelariumCzi(const std::string& uri)
this->uri_ = std::filesystem::path(uri);
}
std::optional<std::unique_ptr<cv::Mat>> pixelarium::imaging::PixelariumCzi::TryGetImage()
std::unique_ptr<cv::Mat> pixelarium::imaging::PixelariumCzi::TryGetImage()
{
auto stream = libCZI::CreateStreamFromFile(this->uri_.wstring().c_str());
auto cziReader = libCZI::CreateCZIReader();
+10 -11
View File
@@ -6,6 +6,11 @@
namespace pixelarium::imaging
{
struct CziParams : public IImageQuery
{
};
class PixelariumCzi : public IPixelariumImage
{
public:
@@ -13,26 +18,20 @@ class PixelariumCzi : public IPixelariumImage
// IPixelariumImage member implementations
public:
std::optional<std::unique_ptr<cv::Mat>> TryGetImage() override;
std::unique_ptr<cv::Mat> TryGetImage() override;
std::optional<std::unique_ptr<cv::Mat>> TryGetImage(const IImageQuery&) override
std::unique_ptr<cv::Mat> TryGetImage(const IImageQuery&) override
{
// ToDo: proper error
throw std::runtime_error("Not implemented.");
}
std::string Name() const noexcept override
std::vector<std::unique_ptr<cv::Mat>> TryGetImages(const IImageQuery&) override
{
if (!this->uri_.empty())
{
return this->uri_.filename().string();
}
return {};
// ToDo: proper error
throw std::runtime_error("Not implemented.");
}
std::filesystem::path Uri() const noexcept override { return this->uri_.string(); }
bool Empty() const noexcept override { return this->is_empty_; }
public:
+1 -1
View File
@@ -16,7 +16,7 @@ pixelarium::imaging::PixelariumJpg::PixelariumJpg(const std::string& uri)
this->uri_ = std::filesystem::path(uri);
}
std::optional<std::unique_ptr<cv::Mat>> pixelarium::imaging::PixelariumJpg::TryGetImage()
std::unique_ptr<cv::Mat> pixelarium::imaging::PixelariumJpg::TryGetImage()
{
try
{
+5 -14
View File
@@ -14,27 +14,18 @@ class PixelariumJpg : public IPixelariumImage
// IPixelariumImage member implementations
public:
std::optional<std::unique_ptr<cv::Mat>> TryGetImage() override;
std::unique_ptr<cv::Mat> TryGetImage() override;
std::optional<std::unique_ptr<cv::Mat>> TryGetImage(const IImageQuery&) override
std::unique_ptr<cv::Mat> TryGetImage(const IImageQuery&) override
{
// ToDo: proper error
throw std::runtime_error("Not possible with jpg.");
}
std::string Name() const noexcept override
std::vector<std::unique_ptr<cv::Mat>> TryGetImages(const IImageQuery&) override
{
if (!this->uri_.empty())
{
return this->uri_.filename().string();
}
return {};
}
std::filesystem::path Uri() const noexcept override
{
return this->uri_.string();
// ToDo: proper error
throw std::runtime_error("Not possible with jpg.");
}
bool Empty() const noexcept override { return this->is_empty_; }
+1 -1
View File
@@ -16,7 +16,7 @@ pixelarium::imaging::PixelariumPng::PixelariumPng(const std::string& uri)
this->uri_ = std::filesystem::path(uri);
}
std::optional<std::unique_ptr<cv::Mat>> pixelarium::imaging::PixelariumPng::TryGetImage()
std::unique_ptr<cv::Mat> pixelarium::imaging::PixelariumPng::TryGetImage()
{
try
{
+5 -14
View File
@@ -14,27 +14,18 @@ class PixelariumPng : public IPixelariumImage
// IPixelariumImage member implementations
public:
std::optional<std::unique_ptr<cv::Mat>> TryGetImage() override;
std::unique_ptr<cv::Mat> TryGetImage() override;
std::optional<std::unique_ptr<cv::Mat>> TryGetImage(const IImageQuery&) override
std::unique_ptr<cv::Mat> TryGetImage(const IImageQuery&) override
{
// ToDo: proper error
throw std::runtime_error("Not possible with png.");
}
std::string Name() const noexcept override
std::vector<std::unique_ptr<cv::Mat>> TryGetImages(const IImageQuery&) override
{
if (!this->uri_.empty())
{
return this->uri_.filename().string();
}
return {};
}
std::filesystem::path Uri() const noexcept override
{
return this->uri_.string();
// ToDo: proper error
throw std::runtime_error("Not possible with png.");
}
bool Empty() const noexcept override { return this->is_empty_; }