MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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 // Define number of user tags to support as fields and in GUI.
44 enum {
45 NumUserTags = 10
46 };
47
50
53
57
60
63
64protected:
65 // ----------------------------------------------------------
68 // ----------------------------------------------------------
70 void activateAttachments() override;
71
75
76 // ----------------------------------------------------------
79 // ----------------------------------------------------------
82 virtual void _setStatus(std::string str = "", float progress = 0.0, MLErrorCode err = ML_RESULT_OK);
83
84
86 virtual void _setProgress(float progressVal);
87
89 virtual void _resetTagFields();
90
94 virtual bool _setDefaultCompressor(const std::string& defaultCompName);
95
99 virtual void _remove(const std::string& fileName, bool updateStatus);
100
106 static void _saveCB(double progress, void* usrData);
107
110 void _saveCBMethod(double progress);
111
112
129 bool suppressWorldCoordinateUse = false);
131
132 // ----------------------------------------------------------
135 // ----------------------------------------------------------
137 {
138 return *_compressorParams;
139 }
141 {
142 return *_isSavingFld;
143 }
144
146 {
147 return *_trueFileNameFld;
148 }
150 {
151 return *_stopFld;
152 }
154 {
155 return *_removeFld;
156 }
158 {
159 return *_statusFld;
160 }
162 {
163 return *_progressFld;
164 }
166 {
167 return *_tagListFld;
168 }
170 {
171 return _userTagFld;
172 }
174 {
175 return *_tagListFld;
176 }
178 {
179 return _userTagFld;
180 }
182 {
183 return *_regionOffsetFld;
184 }
186 {
187 return *_suppressWorldPosFld;
188 }
190
191private:
192 // ----------------------------------------------------------
195 // ----------------------------------------------------------
196
198 MLImageFormatCompressionParams* _compressorParams;
199
201
202 // ----------------------------------------------------------
205 // ----------------------------------------------------------
206
208 StringField* _trueFileNameFld;
209
211 ProgressField* _progressFld;
212
214 NotifyField* _stopFld;
215
217 NotifyField* _removeFld;
218
220 StringField* _statusFld;
221
223 BoolField* _isSavingFld;
224
226 StringField* _tagListFld;
227
229 StringField* _userTagFld[NumUserTags];
230
234 ImageVectorField* _regionOffsetFld;
235
243 BoolField* _suppressWorldPosFld;
244
246
249};
250
251
253
254#endif // __mlImageFormatIOBase_H
#define MLIMAGEFORMAT_EXPORT
Global and OS specific declarations for the MLImageFormat project.
Field to encapsulate a boolean value.
Definition mlFields.h:56
Base class for all fields used in the ML.
Definition mlField.h:73
Field to encapsulate an ML vector ImageVector with six integer components.
Definition mlFields.h:2017
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:150
Field without value for notifications.
Definition mlFields.h:687
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
Field to encapsulate an increasing float value from range [0,1].
Definition mlFields.h:519
Field to encapsulate a string value.
Definition mlFields.h:634
#define ML_MODULE_CLASS_HEADER(className)
Similar to ML_CLASS_HEADER for the usage of derived classes from Module.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:772
#define ML_RESULT_OK
No error. Everything seems to be okay.
Definition mlTypeDefs.h:780
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.