![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/ImFusionFilePlugin.h>
Allow loading and saving of custom classes and data within the ImFusion file format. More...
Inheritance diagram for ImFusionFilePlugin:Allow loading and saving of custom classes and data within the ImFusion file format.
Multiple data type IDs may be supported by a plugin. The load and save methods do not have to be implemented, for example if a custom image class shall be created for a type but the standard loader for image data is sufficient.
Public Member Functions | |
| virtual | ~ImFusionFilePlugin ()=default |
| Destructor. | |
| virtual Data * | loadInstance (unsigned int type, unsigned int headerSize=0)=0 |
| Create specialized instance for a given data type or return null if not supported. | |
| virtual unsigned int | saveType (const Data *data)=0 |
| Return type for saving a given data instance or null if not supported. | |
| virtual bool | load (unsigned int, Data *, std::istream &, Progress *=0) |
| Load data into given class instance, return true if data is complete (otherwise ImFusionImage loader will be run) | |
| virtual bool | save (Data *, std::ostream &, Progress *=0) |
| Save a data instance to file, return true if complete (otherwise ImFusionImage writer will be run afterwards) To keep the consistency between the description in data block header and the actual stored block body, use the m_blockType in save method and avoid checking data description directly from the data. | |
| virtual std::unique_ptr< Properties > | customPropertiesToSave (Data *) |
| Lets plugin save custom properties as part of the global file metadata. | |
| virtual bool | loadCustomProperties (Data *, Properties *) |
| Load custom properties as returned previously by customPropertiesToSave() | |
| virtual void | applyFlipToEnsureConsistency (Data *) |
| Is called after the image content had to be flipped to ensure a consistent coordinate system. | |
| virtual bool | beginBlockWrite (std::iostream &) |
| Initialize plugin with current file pointer. | |
| virtual unsigned long long | endBlockWrite () |
| Indicate to plugin that the block it is writing needs to be finished. | |
| virtual bool | beginBlockRead (std::iostream &, unsigned long long) |
| Initialize plugin with current file pointer. | |
| virtual bool | endBlockRead () |
| Indicate to plugin that it will lose read access to the file pointer after this call. | |
| virtual void | setBlockType (unsigned int type) |
| Set the type of current data block which is being loaded/saved. | |
Protected Attributes | |
| unsigned int | m_blockType = 0 |
| Keeps the type of currently saving/loading data block. | |
|
pure virtual |
Create specialized instance for a given data type or return null if not supported.
Implemented in GenericASCImFusionFilePlugin, ImFusionImage, SpineDataImFusionFilePlugin, StereoImageImFusionFilePlugin, and TrackedImageSetImFusionFilePlugin.
|
pure virtual |
Return type for saving a given data instance or null if not supported.
Implemented in GenericASCImFusionFilePlugin, ImFusionImage, SpineDataImFusionFilePlugin, StereoImageImFusionFilePlugin, and TrackedImageSetImFusionFilePlugin.
|
virtual |
Load data into given class instance, return true if data is complete (otherwise ImFusionImage loader will be run)
Reimplemented in GenericASCImFusionFilePlugin, ImFusionImage, SpineDataImFusionFilePlugin, StereoImageImFusionFilePlugin, and TrackedImageSetImFusionFilePlugin.
|
virtual |
Save a data instance to file, return true if complete (otherwise ImFusionImage writer will be run afterwards) To keep the consistency between the description in data block header and the actual stored block body, use the m_blockType in save method and avoid checking data description directly from the data.
Reimplemented in GenericASCImFusionFilePlugin, ImFusionImage, SpineDataImFusionFilePlugin, StereoImageImFusionFilePlugin, and TrackedImageSetImFusionFilePlugin.
|
virtual |
Lets plugin save custom properties as part of the global file metadata.
Reimplemented in StereoImageImFusionFilePlugin.
|
virtual |
Load custom properties as returned previously by customPropertiesToSave()
Reimplemented in GenericASCImFusionFilePlugin, SpineDataImFusionFilePlugin, StereoImageImFusionFilePlugin, and TrackedImageSetImFusionFilePlugin.
|
inlinevirtual |
Is called after the image content had to be flipped to ensure a consistent coordinate system.
This method needs to take care that data consistency is maintained, for instance by also updating all relevant data components and other meta data, e.g. calibration matrices. Background: Previously, mixed image coordinate conventions (origin is either top-left or bottom-left corner) were allowed in the entire framework. The bottom- left (=OpenGL) convention is now being phased out, so for several applications, including ultrasound, and X-ray/CBCT images, images stored with the bottom-left convention are hard-flipped on loading.
Reimplemented in TrackedImageSetImFusionFilePlugin.
|
virtual |
Initialize plugin with current file pointer.
The pointer points to the position directly after the block header. Until end() is called the plugin can freely append to the file. It may not seek to a position before the position of the stream upon the begin() call.
| io | file stream which you can write to |
Reimplemented in ImFusionImage.
|
virtual |
Indicate to plugin that the block it is writing needs to be finished.
The plugin must finalize the data it is writting.
Reimplemented in ImFusionImage.
|
virtual |
Initialize plugin with current file pointer.
The pointer points to the position directly after the block header. Until end() is called the plugin can freely read from the file. It may not seek to a position before the position of the stream upon the begin() call.
| io | file stream which can be read |
| blockSize | number of bytes in block starting from current get file pointer |
|
virtual |
Indicate to plugin that it will lose read access to the file pointer after this call.
|
virtual |
Set the type of current data block which is being loaded/saved.
Must be set if the header of the current block is chosen by another plug-in
|
protected |
Keeps the type of currently saving/loading data block.
When a plug-in chooses the type, the same must be set for the ImFusionImage to keep the header and body consistent.