#include <ImFusion/Base/DataComponentList.h>
#include <ImFusion/Base/SharedImageSet.h>
#include <ImFusion/Dicom/DicomElement.h>
#include <ImFusion/Dicom/DicomIOD.h>
#include <ImFusion/Dicom/Extension.h>
#include <dcmtk/dcmdata/dctk.h>
class ExampleDataComponent :
public DataComponent<ExampleDataComponent>
{
public:
ExampleDataComponent() = default;
ExampleDataComponent(const ExampleDataComponent& other) = default;
ExampleDataComponent& operator=(const ExampleDataComponent& other) = default;
bool operator==(const ExampleDataComponent& other) const
{
return other.xrayTubeCurrent == xrayTubeCurrent && other.convolutionKernel == convolutionKernel;
}
void configuration(
Properties* p)
const override {};
int xrayTubeCurrent = 0;
};
{
public:
std::string name() const override { return "Extension Example"; }
std::vector<std::unique_ptr<Data>>
load(
const Dicom::FrameDescriptor& frame, SharedImageSet& sis)
const override
{
return {};
Dicom::Element<int> xrayTubeCurrent(*frame.
iod, DCM_XRayTubeCurrent);
Dicom::Element<std::string> convolutionKernel(*frame.
iod, DCM_ConvolutionKernel);
if (xrayTubeCurrent.isValid())
dc.xrayTubeCurrent = xrayTubeCurrent.value();
if (convolutionKernel.isValid())
dc.convolutionKernel = convolutionKernel.value();
return {};
}
void save(
const Dicom::FrameDescriptor& frame,
const SharedImageSet& sis)
const override {}
};
Main specialization of DataComponentBase for regular types.
Definition DataComponent.h:109
T & getOrCreate(Args &&... ctorArgs)
Returns the DataComponent exactly matching the given type.
Definition DataComponentList.h:231
Interface for adding custom functionality to DicomLoader and DicomWriter An Extension might be called...
Definition Extension.h:26
Storage container for serialization of arbitrary types, internally backed by strings.
Definition Properties.h:50
const DataComponentList & components() const
Returns the list of DataComponents for this data.
Definition Data.h:179
Mesh * load(const char *buffer, size_t bufferLength, const std::string &sourceFilename="", Progress *progressBar=nullptr, bool log=false)
Loads a mesh from a memory buffer.
void save(const char *filename, const std::vector< mat4 > &matrices, bool rigidPars=false)
Save matrices or its rigid pose parameters to a text file.
Namespace of the ImFusion SDK.
Definition Assert.h:7
IOD * iod
Parent IOD that loaded the frame. Never nullptr and must not be re-assigned.
Definition DicomIOD.h:52
int sharedImageIndex
index of the SharedImage in the SharedImageSet
Definition DicomIOD.h:59
int sliceIndex
slice index of the frame in the volume (or 0 for 2D images)
Definition DicomIOD.h:60