build system and module refactoring + simple histogram scratch (#20)
MegaLinter / MegaLinter (push) Has been cancelled
CI Workflow / build-ubuntu (push) Has been cancelled
CI Workflow / build-windows (push) Has been cancelled
CI Workflow / generate-docs (push) Has been cancelled

* scratch adding histogram to image views

Histograms should come from some sort of histogram service. This is
currently just a POC.

* custom logger implementation w/o spdlog

* missing cmake file

* fix tests

* use operator<< over direct stream exposure

* rm print header

* add threading test + refactor towards interface libraries

omits the need for =target_include_directories= calls /everywhere/

* rm print header

* rm constexpr

* templated thread_pool

* fix doxyfile

* default enable doc building

* czi reader refactor

* rm erroneous include expression

* clang-format

* single lib include with PUBLIC visibility

* compile imgui stdlib

* clang format

* documentation update

centralize `LogLevelToString` to `ILog.hpp`

update docs and examples
This commit is contained in:
m-aXimilian
2026-02-08 12:09:02 +01:00
committed by Maximilian Kueffner
parent b37814204f
commit c00c2c71ac
60 changed files with 797 additions and 416 deletions
+80
View File
@@ -0,0 +1,80 @@
#pragma once
#include <GLFW/glfw3.h>
#include <format>
#include "ILog.hpp"
#include "imgui_proxy.hpp"
namespace pixelarium::application
{
/// @brief Base class providing scaffolding with GLFW and some default
/// implementations that can be extended and/or overridden by consumers
class AppGLFW
{
public:
explicit AppGLFW(const utils::log::ILog& log) : logger_(log), plot_context_(ImPlot::CreateContext())
{
this->InitMainWindow();
}
~AppGLFW() { ImPlot::DestroyContext(plot_context_); }
AppGLFW(AppGLFW&) = delete;
AppGLFW(const AppGLFW&) = delete;
AppGLFW(AppGLFW&&) = delete;
AppGLFW& operator=(AppGLFW&) = delete;
AppGLFW& operator=(AppGLFW&&) = delete;
/// @brief Start the main render loop
void Start() { this->RunLoop(); }
void SetStatusTimed(const std::string& status, size_t second);
void SetStatus(const std::string& status)
{
logger_.Info(std::format("{}(): {}", __PRETTY_FUNCTION__, status));
status_message_ = status;
show_status_ = true;
}
void ResetStatus()
{
status_message_.clear();
show_status_ = false;
}
protected:
/// @brief Function implementing the first column of the menu bar (e.g. "Menu")
virtual void MenuBarOptionsColumn1() {}
/// @brief Function implementing the second column of the menu bar (e.g. "File")
virtual void MenuBarOptionsColumn2() {}
/// @brief Function implementing the third column of the menu bar (e.g. "Options")
virtual void MenuBarOptionsColumn3() {}
/// @brief Function implementing the fourth column of the menu bar (e.g. "More")
virtual void MenuBarOptionsColumn4() {}
/// @brief Function implementing the first column of the menu bar (e.g. "Help")
virtual void MenuBarOptionsColumn5() {}
/// @brief Main function that gets called within the render loop.
virtual void Run() {}
const utils::log::ILog& logger_;
private:
int RunLoop();
void InitMainWindow();
void MenuBar();
void LogLevelSelect();
int log_level_{0};
GLFWwindow* window = nullptr;
ImPlotContext* plot_context_ = nullptr;
bool show_status_{false};
std::string status_message_{};
};
} // namespace pixelarium::application
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include <cstddef>
#include "AppGLFW.hpp"
#include "ILog.hpp"
#include "PixelariumGallery.hpp"
#include "imgui_proxy.hpp"
#include "resource.hpp"
namespace pixelarium::application
{
/// @brief Default implementation of AppGLFW.
/// This can either be used as is, as an example or as a base class
/// providing some defaults for a more custom implementation.
class DefaultApp : public AppGLFW
{
public:
DefaultApp(const utils::log::ILog& log, pixelarium::resources::ImageResourcePool& pool)
: application::AppGLFW(log), pool_(pool), gallery_(log, pool)
{
gallery_.SetLoadFunction([&]() -> void { this->LoadImageDialogue(); });
}
protected:
void MenuBarOptionsColumn1() override;
void MenuBarOptionsColumn2() override;
void Run() override;
protected:
resources::ImageResourcePool& pool_;
application::PixelariumImageGallery gallery_;
protected:
void LoadImageDialogue();
private:
bool image_listp_{true};
bool demop_{false};
ImVec2 curr_dim_;
};
} // namespace pixelarium::application
+58
View File
@@ -0,0 +1,58 @@
#pragma once
#include "ILog.hpp"
#include "RenderImageManager.hpp"
#include "resource.hpp"
namespace pixelarium::application
{
/// @brief Defines a concept for a gallery type
/// @tparam P The resource pool type of the gallery concept
template <typename P, class D>
concept GalleryT = requires(P& p) { static_cast<resources::IResourcePool<P, D>&>(p); };
/// @brief Interface for a Pixelarium gallery.
///
/// Defines generic functionality for a gallery of a specific
/// resource type given by the template argument.
/// @tparam GalleryT The type of IResourcePool that the given implementation
/// provides a gallery for.
template <typename GalleryT>
class IPixelariumGallery
{
public:
virtual ~IPixelariumGallery() = default;
virtual void RenderGallery() = 0;
};
/// @brief Implements IPixelariumGallery for a ImageResourcePool
class PixelariumImageGallery : IPixelariumGallery<resources::ImageResourcePool>
{
using Pool = resources::ImageResourcePool;
using Log = utils::log::ILog;
public:
PixelariumImageGallery(const Log& log, resources::ImageResourcePool& pool)
: pool_{pool}, log_{log}, render_manager_(std::make_unique<application::RenderImageManager>(pool, log))
{
}
void RenderGallery() override;
void RenderImages();
void Add(resources::ResourceKey key) { this->render_manager_->Add(key); }
void SetLoadFunction(const std::function<void()>& fun) { this->load_image_ = fun; };
private:
std::function<void()> load_image_{};
Pool& pool_;
const Log& log_;
std::unique_ptr<application::RenderImageManager> render_manager_;
bool image_listp_{true};
bool auto_show_selectd_image_{true};
size_t selected_image_{0};
};
} // namespace pixelarium::application
+5
View File
@@ -0,0 +1,5 @@
#pragma once
#include "imgui.h"
#include "imgui_stdlib.h"
#include "implot.h"