ImFusion SDK 4.3
Extension Class Referenceabstract

#include <ImFusion/Dicom/Extension.h>

Interface for adding custom functionality to DicomLoader and DicomWriter An Extension might be called in a thread that is not the main thread. More...

+ Inheritance diagram for Extension:

Detailed Description

Interface for adding custom functionality to DicomLoader and DicomWriter An Extension might be called in a thread that is not the main thread.

It therefore most not rely on global resources like OpenGL. It will not be called from different threads simultaneously. See Extensions for an example.

Examples
DicomExtensionExample.cpp, DicomExtensionExample2.cpp, and DicomExtensionExample3.cpp.

Public Member Functions

virtual std::unique_ptr< Extensionclone () const =0
 Return a clone this object Usually the implementation will look like this:
 
virtual std::string name () const =0
 Return a unique display string for this extension.
 
virtual std::vector< std::unique_ptr< Data > > load (const FrameDescriptor &frame, SharedImageSet &sis) const =0
 Load the data from DICOM to the given SharedImageSet.
 
virtual void save (const FrameDescriptor &frame, const SharedImageSet &sis) const =0
 Save data from the given SharedImageSet to DICOM.
 
bool enabled () const
 
void setEnabled (bool enable=true)
 
virtual bool showInWriterUI () const
 Whether this extension will show up in the UI and can be enabled/disabled by the user.
 
- Public Member Functions inherited from ErrorRecorder
virtual void * registerErrorHandler (ErrorCallback handler)
 Registers a new handler callback function.
 
virtual void unregisterErrorHandler (void *handler)
 Removes a previously registered handler again.
 
void * forwardErrors (const ErrorRecorder *otherRecorder)
 Convenient function to forward all errors registered to this recorder to another recorder.
 
virtual void registerError (const Error &error) const
 Sends the given error to all error handler callbacks.
 
void registerError (Error::Code code, Error::Type type, const std::string &details, TagProxy tag=TagProxy()) const
 

Additional Inherited Members

- Public Types inherited from ErrorRecorder
using ErrorCallback = std::function<void(const Error&)>
 Alias for a function to call for each error recorded.
 

Member Function Documentation

◆ clone()

virtual std::unique_ptr< Extension > clone ( ) const
pure virtual

Return a clone this object Usually the implementation will look like this:

T make_unique(T... args)

Implemented in ClinicalTrialSubjectExtension, EncryptedAttributesExtension, GeneralEquipmentExtension, RealWorldValueMappingExtension, and VOILUTExtension.

◆ name()

virtual std::string name ( ) const
pure virtual

◆ load()

virtual std::vector< std::unique_ptr< Data > > load ( const FrameDescriptor & frame,
SharedImageSet & sis ) const
pure virtual

Load the data from DICOM to the given SharedImageSet.

This method will be called once for each frame that was generated by the Dicom::IOD which created the SharedImageSet. Use FrameDescriptor::iod to access the DICOM tags and FrameDescriptor::sharedImageIndex/sliceIndex to figure out which frame data should get loaded. The matrix parameters of frame should be ignored. Use the matrix of the SharedImageSet instead. DicomLoader will basically just iterate overall all slices and call this method. E.g. for a SharedImageSet containing two volumes with 4 slices, this method would be called with the following indices:

sharedImageIndex sliceIndex
0 0
0 1
0 2
0 3
1 0
1 1
1 2
1 3

Derived classes might also need to differentiate between classic single frame DICOMs (Dicom::MultiFrameIOD) and enhanced multiframe DICOMs (Dicom::EnhancedMultiFrameImageIOD). This should be done by dynamic_casting the frame.iod to Dicom::EnhancedMultiFrameImageIOD and assume a classic DICOM otherwise. Use frame.index to access Dicom::EnhancedMultiFrameImageIOD::perFrameSequence.

Implemented in ClinicalTrialSubjectExtension, EncryptedAttributesExtension, GeneralEquipmentExtension, RealWorldValueMappingExtension, and VOILUTExtension.

◆ save()

virtual void save ( const FrameDescriptor & frame,
const SharedImageSet & sis ) const
pure virtual

Save data from the given SharedImageSet to DICOM.

This method will be called once for each frame of the SharedImageSet. Use FrameDescriptor::iod to access the DICOM tags and FrameDescriptor::sharedImageIndex/sliceIndex to figure out which frame data should be saved. The matrix parameters of frame should be ignored. Use the matrix of the SharedImageSet instead.

Implemented in ClinicalTrialSubjectExtension, EncryptedAttributesExtension, GeneralEquipmentExtension, RealWorldValueMappingExtension, and VOILUTExtension.

◆ showInWriterUI()

virtual bool showInWriterUI ( ) const
inlinevirtual

Whether this extension will show up in the UI and can be enabled/disabled by the user.

The save method will be called independently of this value. This is useful if the extension only implements load.

Reimplemented in RealWorldValueMappingExtension.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close