satdump/src-core/handler/dataset/flowgraph_processor.cpp

71 lines
3.1 KiB
C++
Raw Normal View History

#include "flowgraph_processor.h"
#include "logger.h"
#include "lua/lua_bind.h"
// TODOREWORK
#include "imgui/imnodes/imnodes.h"
#include "flowgraph/datasetproc_node.h"
#include "flowgraph/image_nodes.h"
#include "flowgraph/imageproduct_node.h"
namespace satdump
{
namespace viewer
{
Flowgraph_DatasetProductProcessor::Flowgraph_DatasetProductProcessor(DatasetHandler *dh, Handler *dp, nlohmann::json p)
: DatasetProductProcessor(dh, dp, p)
{
// TODOREWORK
if (ImNodes::GetCurrentContext() == nullptr)
ImNodes::CreateContext();
flowgraph.node_internal_registry.emplace("image_product_source", []()
{ return std::make_shared<ImageProductSource_Node>(); });
flowgraph.node_internal_registry.emplace("image_product_equation", []()
2025-03-14 14:39:05 +01:00
{ return std::make_shared<ImageProductExpression_Node>(); });
flowgraph.node_internal_registry.emplace("image_sink", []()
{ return std::make_shared<ImageSink_Node>(); });
flowgraph.node_internal_registry.emplace("image_get_proj", []()
{ return std::make_shared<ImageGetProj_Node>(); });
flowgraph.node_internal_registry.emplace("image_reproj", []()
{ return std::make_shared<ImageReproj_Node>(); });
flowgraph.node_internal_registry.emplace("image_equation", []()
2025-03-14 14:39:05 +01:00
{ return std::make_shared<ImageExpression_Node>(); });
flowgraph.node_internal_registry.emplace("image_handler_sink", [dp]()
{ return std::make_shared<ImageHandlerSink_Node>(dp); });
flowgraph.node_internal_registry.emplace("image_equalize", []()
{ return std::make_shared<ImageEqualize_Node>(); });
flowgraph.node_internal_registry.emplace("image_source", []()
{ return std::make_shared<ImageSource_Node>(); });
2025-02-01 14:08:53 +01:00
flowgraph.node_internal_registry.emplace("dataset_product_source", [this]()
{ return std::make_shared<DatasetProductSource_Node>(this); });
if (p.contains("flowgraph"))
flowgraph.setJSON(p["flowgraph"]);
}
nlohmann::json Flowgraph_DatasetProductProcessor::getCfg()
{
2025-02-01 14:08:53 +01:00
nlohmann::json cfg = DatasetProductProcessor::getCfg();
cfg["flowgraph"] = flowgraph.getJSON();
return cfg;
}
bool Flowgraph_DatasetProductProcessor::can_process()
{
return true; // TODOREWORK
}
void Flowgraph_DatasetProductProcessor::process(float *progress)
{
flowgraph.run();
}
void Flowgraph_DatasetProductProcessor::renderUI()
{
flowgraph.render();
}
}
}