#include <ImFusion/Base/Algorithm.h>
#include <ImFusion/Base/AlgorithmControllerFactory.h>
#include <ImFusion/Base/AlgorithmFactory.h>
#include <ImFusion/Stream/ImageStream.h>
#include <ImFusion/Stream/CreateStreamAlgorithm.h>
#include <ImFusion/Stream/CreateStreamIoAlgorithm.h>
#include <ImFusion/Stream/FakeImageStream.h>
#include <ImFusion/Stream/Stream.h>
#include <ImFusion/Stream/StreamControllerBase.h>
#include <ImFusion/Stream/StreamData.h>
namespace CreateStreamAlgorithmFactoryUsage
{
{
public:
MyAlgorithmFactory();
};
{
public:
MyControllerFactory();
};
{
public:
static bool isCompatible(
const DataList& inputData)
{
}
{
if (!m_inputStream)
throw std::runtime_error(
"DemoProcessingStream requires an ImageStream as input data");
m_inputStream->signalStreamData.connect(this, &DemoProcessingStream::processImage);
}
~DemoProcessingStream() override
{
disconnectAll();
}
{
std::cout <<
"Processing image from input stream: " << m_inputStream->name() <<
std::endl;
outputData->setImages(imageData->images2());
signalStreamData.emitSignal(outputData);
}
bool openImpl() override { return true; };
bool closeImpl() override { return true; };
bool startImpl() override { return true; };
bool stopImpl() override { return true; }
std::string uuid()
override {
return "DemoProcessingStream"; }
private:
};
{
registerAlgorithm<DemoProcessingAlgorithm>("DemoProcessingAlgorithm", "Demo;Demo Processing Stream");
}
{
if (auto alg = dynamic_cast<DemoProcessingAlgorithm*>(a))
return nullptr;
}
}
namespace CreateStreamIoAlgorithmFactoryUsage
{
{
};
class MyAlgorithmFactory : public ImFusion::AlgorithmFactory
{
public:
MyAlgorithmFactory();
};
class MyControllerFactory : public ImFusion::AlgorithmControllerFactory
{
public:
MyControllerFactory();
AlgorithmController* create(Algorithm* a) const override;
};
using DemoInputIoAlgorithm = ImFusion::CreateStreamIoAlgorithm<DemoInputStream, true, true>;
MyAlgorithmFactory::MyAlgorithmFactory() : AlgorithmFactory("MyPlugin", false)
{
registerAlgorithm<DemoInputIoAlgorithm>("DemoInputIoAlgorithm", "Demo;Demo Input Stream");
}
{
if (auto alg = dynamic_cast<DemoInputIoAlgorithm*>(a))
return nullptr;
}
}
Interface for algorithm controller factories.
Definition AlgorithmControllerFactory.h:29
Specialization of the Controller interface to be used with Algorithm instances.
Definition AlgorithmController.h:38
Interface for algorithm factories.
Definition AlgorithmFactory.h:51
Interface for describing algorithms that can be made available in the ImFusion Suite through Algorith...
Definition Algorithm.h:41
Algorithm template to create streams.
Definition CreateStreamAlgorithm.h:54
Container for any number of Data instances such as image or meshes.
Definition DataList.h:30
Data * getFirst(Data::Kind kind=Data::UNKNOWN) const
Return the first Data instance of the given kind.
Small tool class to create an image stream.
Definition FakeImageStream.h:20
Specialization of Stream for streams producing 2D or 3D images.
Definition ImageStream.h:21
Base class for classes that can contain slots (i.e.
Definition Signal.h:28
Base AlgorithmController for creating controllers of streaming algorithms, but it can also be used di...
Definition StreamControllerBase.h:29
Namespace of the ImFusion SDK.
Definition Assert.h:7
T dynamic_pointer_cast(T... args)