MeVisLab Toolbox Reference
mlImageFormatIOBase.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_IMAGE_FORMAT_IOBASE_H
14#define ML_IMAGE_FORMAT_IOBASE_H
15
16
21
22#include "MLImageFormatSystem.h"
23
24// ML includes
25#include "mlModuleIncludes.h"
26
27#include "mlImageFormatTools.h"
28
29
31
32// Forward declaration.
33class MLImageFormat;
34class MLImageFormatCompressionParams;
35
36// ----------------------------------------------------------
39// ----------------------------------------------------------
41{
42public:
43
44 // Define number of user tags to support as fields and in GUI.
45 enum { NumUserTags = 10 };
46
49
52
56
59
62
63protected:
64
65 // ----------------------------------------------------------
68 // ----------------------------------------------------------
70 void activateAttachments() override;
71
73 void handleNotification (Field *field) override;
75
76 // ----------------------------------------------------------
79 // ----------------------------------------------------------
82 virtual void _setStatus(std::string str = "",
83 float progress = 0.0,
85
86
88 virtual void _setProgress(float progressVal);
89
91 virtual void _resetTagFields();
92
96 virtual bool _setDefaultCompressor(const std::string &defaultCompName);
97
101 virtual void _remove(const std::string &fileName, bool updateStatus);
102
108 static void _saveCB(double progress,
109 void *usrData);
110
113 void _saveCBMethod(double progress);
114
115
133 PagedImage *imgPropsToUpdate = nullptr,
134 bool suppressWorldCoordinateUse = false);
136
137 // ----------------------------------------------------------
140 // ----------------------------------------------------------
141 MLImageFormatCompressionParams &_getCompressorParams () { return *_compressorParams ; }
142 BoolField &_getIsSavingFld () { return *_isSavingFld ; }
143
144 const StringField &_getTrueFileNameFld () const { return *_trueFileNameFld ; }
145 const NotifyField &_getStopFld () const { return *_stopFld ; }
146 NotifyField &_getRemoveFld () const { return *_removeFld ; }
147 const StringField &_getStatusFld () const { return *_statusFld ; }
148 const ProgressField &_getProgressFld () const { return *_progressFld ; }
149 const StringField &_getTagListFld () const { return *_tagListFld ; }
150 StringField* const* _getUserTagFlds () const { return _userTagFld ; }
151 StringField &_getNonConstTagListFld () const { return *_tagListFld ; }
152 StringField **_getNonConstUserTagFlds() { return _userTagFld ; }
153 ImageVectorField &_getRegionOffsetFld () const { return *_regionOffsetFld ; }
154 BoolField &_getSuppressWorldPosFld() const { return *_suppressWorldPosFld; }
156
157private:
158
159 // ----------------------------------------------------------
162 // ----------------------------------------------------------
163
165 MLImageFormatCompressionParams *_compressorParams;
166
168
169 // ----------------------------------------------------------
172 // ----------------------------------------------------------
173
175 StringField *_trueFileNameFld;
176
178 ProgressField *_progressFld;
179
181 NotifyField *_stopFld;
182
184 NotifyField *_removeFld;
185
187 StringField *_statusFld;
188
190 BoolField *_isSavingFld;
191
193 StringField *_tagListFld;
194
196 StringField *_userTagFld[NumUserTags];
197
201 ImageVectorField *_regionOffsetFld;
202
210 BoolField *_suppressWorldPosFld;
211
213
216};
217
218
220
221#endif // __mlImageFormatIOBase_H
222
223
#define MLIMAGEFORMAT_EXPORT
Global and OS specific declarations for the MLImageFormat project.
Field to encapsulate a boolean value.
Definition mlFields.h:58
Base class for all fields used in the ML.
Definition mlField.h:73
Field to encapsulate an ML vector ImageVector with 6 integer components.
Definition mlFields.h:1872
Helper class for compressor arguments managed inside of a module.
IO base class to manage/save/load/modify .mlimage files and to derive specific save,...
const StringField & _getTagListFld() const
virtual void _resetTagFields()
Reset tag list field and user tag fields to empty strings.
virtual void updateUserTagFieldsFromLoader(const MLImageFormat &loader)
Set user tag fields to the state given by the passed loader object.
MLImageFormatIOBase(int numIns=0, int numOuts=0)
Constructor for a module with numIns inputs and numOuts outputs.
StringField & _getNonConstTagListFld() const
static void _saveCB(double progress, void *usrData)
Static callback function registered in the save module to get information and interrupt feature.
const StringField & _getStatusFld() const
const NotifyField & _getStopFld() const
StringField ** _getNonConstUserTagFlds()
MLImageFormatTagList getUserTagList() const
Create and return a list of user tags from the userTagFlds array which is to be stored in the file.
virtual void _setStatus(std::string str="", float progress=0.0, MLErrorCode err=ML_RESULT_OK)
Update the status and progress field.
const ProgressField & _getProgressFld() const
void handleNotification(Field *field) override
Handle field changes of the field field.
~MLImageFormatIOBase() override
Destroy local members and this.
virtual bool _setDefaultCompressor(const std::string &defaultCompName)
Set up a default compressor with name defaultCompName if it is available in the currently registered ...
const StringField & _getTrueFileNameFld() const
MLImageFormatCompressionParams & _getCompressorParams()
virtual void _remove(const std::string &fileName, bool updateStatus)
Remove the field specified by fileName and update the status field with success information if update...
virtual void updateTagListFieldFromLoader(const MLImageFormat &loader)
Set tag list field to the state given by the passed loader object.
virtual void _setProgress(float progressVal)
Sets the value of the progressFld to progressVal.
NotifyField & _getRemoveFld() const
MLErrorCode _overWriteWithInputImage(PagedImage &inImg, MLImageFormat &fileToUpdate, ImageVector voxelShift=ImageVector(0), PagedImage *imgPropsToUpdate=nullptr, bool suppressWorldCoordinateUse=false)
Take the entire input image described in inImg and overwrite the file fileToUpdate,...
void _saveCBMethod(double progress)
Callback method called by _saveCB.
ImageVectorField & _getRegionOffsetFld() const
StringField *const * _getUserTagFlds() const
void activateAttachments() override
Update internal module state after (field)reload or clone.
BoolField & _getSuppressWorldPosFld() const
Class defining a list of tags used in the MLImageFormat class.
File format class to store, load, and modify a PagedImage in a file.
Base class for an image processing module of the ML.
Definition mlModule.h:151
Field without value for notifications.
Definition mlFields.h:659
Class which represents an image, which manages properties of an image and image data which is located...
Field to encapsulate an increasing float value from range [0,1].
Definition mlFields.h:491
Field to encapsulate a string value.
Definition mlFields.h:610
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:716
#define ML_RESULT_OK
No error. Everything seems to be okay.
Definition mlTypeDefs.h:724
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
TImageVector< MLint > ImageVector
Defines the standard ImageVector type which is used by the ML for indexing and coordinates.