MeVisLab Toolbox Reference
SoVirtualVolume.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 SO_VIRTUAL_VOLUME_H
14#define SO_VIRTUAL_VOLUME_H
15
16
19
21
22// Incomplete types needed for abstract interface creation.
23
24ML_START_NAMESPACE
25 class Module;
26 template <typename intT> class TVector6DBase;
27 template<class TVectorBase> class TVector;
28 template <typename intT> class TImageVector;
29 typedef TImageVector<MLint> ImageVector;
30 class VirtualVolume;
31 template<typename DATATYPE> class TVirtualVolume;
32ML_END_NAMESPACE
33
34//---------------------------------------------------------------------------------
37//---------------------------------------------------------------------------------
39{
40public:
60 long maxNumKB = -1,
61 bool useExceptions = false);
62
77 double fillVal = 0,
78 MLDataType dType = MLuint8Type,
79 long maxNumKB = -1,
80 bool useExceptions = false);
81
86
89
93
98
100 inline long getMaxNumKB() const { return _constructorMaxNumKB; }
101
103 inline bool areExceptionsOn() const { return _constructorAreExceptionsOn; }
104
105 //---------------------------------------------------------------------------------------
107 //---------------------------------------------------------------------------------------
110
113
116
119
122
125
133
139
152
153
154 //---------------------------------------------------------------------------------------
165 //---------------------------------------------------------------------------------------
166 // DO NOT TRACE: All methods are very time critical!
167 inline const XVImageSize &getCursorPosition() { return reinterpret_cast<const XVImageSize&>(_getCursorPosWFunc(_tVirtualVolume)); }
168 inline MLint getIntValue (const XVImageSize &pos) { return _getIntVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); }
169 inline MLint64 getInt64Value (const XVImageSize &pos) { return _getInt64VoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); }
170 inline MLdouble getDoubleValue (const XVImageSize &pos) { return _getDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); }
171 inline MLldouble getLDoubleValue (const XVImageSize &pos) { return _getLDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); }
172 inline MLint getIntCursorValue () { return _getIntCursorVoxelWFunc(_tVirtualVolume); }
173 inline MLint64 getInt64CursorValue () { return _getInt64CursorVoxelWFunc(_tVirtualVolume); }
174 inline MLdouble getDoubleCursorValue () { return _getDoubleCursorVoxelWFunc(_tVirtualVolume); }
175 inline MLldouble getLDoubleCursorValue() { return _getLDoubleCursorVoxelWFunc(_tVirtualVolume); }
176 inline bool isMapped (const XVImageSize &pos) { return _isMappedWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); }
177 inline void setCursorPosition (const XVImageSize &pos) { _setCursorPosWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); }
178 inline void setIntValue (const XVImageSize &pos, MLint v) { _setIntVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); }
179 inline void setInt64Value (const XVImageSize &pos, MLint64 v) { _setInt64VoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); }
180 inline void setDoubleValue (const XVImageSize &pos, MLdouble v) { _setDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); }
181 inline void setLDoubleValue (const XVImageSize &pos, MLldouble v) { _setLDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); }
182 inline void setIntCursorValue (MLint v) { _setIntCursorVoxelWFunc(_tVirtualVolume, v); }
183 inline void setInt64CursorValue (MLint64 v) { _setInt64CursorVoxelWFunc(_tVirtualVolume, v); }
184 inline void setDoubleCursorValue (MLdouble v) { _setDoubleCursorVoxelWFunc(_tVirtualVolume, v); }
185 inline void setLDoubleCursorValue(MLldouble v) { _setLDoubleCursorVoxelWFunc(_tVirtualVolume, v); }
186 inline void fillInt (const XVImageSize &boxV1, const XVImageSize &boxV2, MLint v){ _fillIntWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV1), reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV2), v); }
187 inline void fillInt64 (const XVImageSize &boxV1, const XVImageSize &boxV2, MLint64 v){ _fillInt64WFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV1), reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV2), v); }
188 inline void fillDouble (const XVImageSize &boxV1, const XVImageSize &boxV2, MLdouble v){ _fillDoubleWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV1), reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV2), v); }
189 inline void fillLDouble (const XVImageSize &boxV1, const XVImageSize &boxV2, MLldouble v){ _fillLDoubleWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV1), reinterpret_cast<const ML_NAMESPACE::ImageVector&>(boxV2), v); }
190 inline void moveCursorX () { _moveFXWFunc(_tVirtualVolume); }
191 inline void moveCursorY () { _moveFYWFunc(_tVirtualVolume); }
192 inline void moveCursorZ () { _moveFZWFunc(_tVirtualVolume); }
193 inline void moveCursorC () { _moveFCWFunc(_tVirtualVolume); }
194 inline void moveCursorT () { _moveFTWFunc(_tVirtualVolume); }
195 inline void moveCursorU () { _moveFUWFunc(_tVirtualVolume); }
196 inline void reverseMoveCursorX () { _moveBXWFunc(_tVirtualVolume); }
197 inline void reverseMoveCursorY () { _moveBYWFunc(_tVirtualVolume); }
198 inline void reverseMoveCursorZ () { _moveBZWFunc(_tVirtualVolume); }
199 inline void reverseMoveCursorC () { _moveBCWFunc(_tVirtualVolume); }
200 inline void reverseMoveCursorT () { _moveBTWFunc(_tVirtualVolume); }
201 inline void reverseMoveCursorU () { _moveBUWFunc(_tVirtualVolume); }
202 inline void moveCursorByOffset (const XVImageSize &off) { _moveOffsetFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(off)); }
203 inline void resetCursor () { _resetCursorFunc(_tVirtualVolume); }
204 inline bool moveCursorXWrapAround() { return _moveCursorFXLFFunc(_tVirtualVolume); }
206
207
208 //---------------------------------------------------------------------------------------
211 //---------------------------------------------------------------------------------------
214 template <typename DATATYPE>
215 SO_VIRTUALVOLUME_EXPORT void getValue(const XVImageSize &pos, DATATYPE &retVal);
216
220 template <typename DATATYPE>
221 SO_VIRTUALVOLUME_EXPORT void setValue(const XVImageSize &pos, DATATYPE data);
222
225 template <typename DATATYPE>
227
230 template <typename DATATYPE>
232
237 template <typename DATATYPE>
238 SO_VIRTUALVOLUME_EXPORT void fill(const XVImageSize &boxV1, const XVImageSize &boxV2, DATATYPE value);
239
250 template <typename DATATYPE>
251 SO_VIRTUALVOLUME_EXPORT void getWrittenPageData(MLuint32 wp, DATATYPE *&dataPtr) const;
253
254protected:
259
264
291 double fillVal = 0,
292 MLDataType dType = MLuint8Type,
293 long maxNumKB = -1,
294 bool useExceptions = false);
299
303 SO_VIRTUALVOLUME_EXPORT void _removeVirtualVolumes(bool removeOnlyTyped=false);
304
311 SO_VIRTUALVOLUME_EXPORT static void _imageChangedCB(void *clientData, SoSensor *sensor);
312
315
318
321
324
327 SoFieldSensor _fieldSensor;
328
330 ML_NAMESPACE::VirtualVolume *_virtualVolume;
331
334
335private:
340 void _enforceInst();
341
348 void _enforceInst2();
349
350 //---------------------------------------------------------------------------------------
353 //---------------------------------------------------------------------------------------
354 typedef const ML_NAMESPACE::ImageVector &(*GetCursorPosWFuncType )(void *vv) ;
355 typedef MLint (*GetIntVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ;
356 typedef MLint64 (*GetInt64VoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ;
357 typedef MLdouble (*GetDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ;
358 typedef MLldouble (*GetLDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ;
359 typedef MLint (*GetIntCursorVoxelWFuncType )(void *vv) ;
360 typedef MLint64 (*GetInt64CursorVoxelWFuncType )(void *vv) ;
361 typedef MLdouble (*GetDoubleCursorVoxelWFuncType )(void *vv) ;
362 typedef MLldouble (*GetLDoubleCursorVoxelWFuncType)(void *vv) ;
363 typedef bool (*IsMappedWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ;
364 typedef void (*SetCursorPosWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ;
365 typedef void (*SetIntVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLint v) ;
366 typedef void (*SetInt64VoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLint64 v) ;
367 typedef void (*SetDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLdouble v) ;
368 typedef void (*SetLDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLldouble v) ;
369 typedef void (*SetIntCursorVoxelWFuncType )(void *vv, MLint v) ;
370 typedef void (*SetInt64CursorVoxelWFuncType )(void *vv, MLint64 v) ;
371 typedef void (*SetDoubleCursorVoxelWFuncType )(void *vv, MLdouble v) ;
372 typedef void (*SetLDoubleCursorVoxelWFuncType)(void *vv, MLldouble v) ;
373 typedef void (*FillIntWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLint v);
374 typedef void (*FillInt64WFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLint64 v);
375 typedef void (*FillDoubleWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLdouble v);
376 typedef void (*FillLDoubleWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLldouble v);
377 typedef void (*MoveWFuncType )(void *vv) ;
378 typedef void (*MoveOffsetWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &off) ;
379 typedef void (*ResetCursorWFuncType )(void *vv) ;
380 typedef bool (*MoveCursorFXLFWFuncType )(void *vv) ;
382
383 //---------------------------------------------------------------------------------------
386 //---------------------------------------------------------------------------------------
387 GetCursorPosWFuncType _getCursorPosWFunc ;
388 GetIntVoxelWFuncType _getIntVoxelWFunc ;
389 GetInt64VoxelWFuncType _getInt64VoxelWFunc ;
390 GetDoubleVoxelWFuncType _getDoubleVoxelWFunc ;
391 GetLDoubleVoxelWFuncType _getLDoubleVoxelWFunc ;
392 GetIntCursorVoxelWFuncType _getIntCursorVoxelWFunc ;
393 GetInt64CursorVoxelWFuncType _getInt64CursorVoxelWFunc ;
394 GetDoubleCursorVoxelWFuncType _getDoubleCursorVoxelWFunc ;
395 GetLDoubleCursorVoxelWFuncType _getLDoubleCursorVoxelWFunc ;
396 IsMappedWFuncType _isMappedWFunc ;
397 SetCursorPosWFuncType _setCursorPosWFunc ;
398 SetIntVoxelWFuncType _setIntVoxelWFunc ;
399 SetInt64VoxelWFuncType _setInt64VoxelWFunc ;
400 SetDoubleVoxelWFuncType _setDoubleVoxelWFunc ;
401 SetLDoubleVoxelWFuncType _setLDoubleVoxelWFunc ;
402 SetIntCursorVoxelWFuncType _setIntCursorVoxelWFunc ;
403 SetInt64CursorVoxelWFuncType _setInt64CursorVoxelWFunc ;
404 SetDoubleCursorVoxelWFuncType _setDoubleCursorVoxelWFunc ;
405 SetLDoubleCursorVoxelWFuncType _setLDoubleCursorVoxelWFunc ;
406 FillIntWFuncType _fillIntWFunc ;
407 FillInt64WFuncType _fillInt64WFunc ;
408 FillDoubleWFuncType _fillDoubleWFunc ;
409 FillLDoubleWFuncType _fillLDoubleWFunc ;
410 MoveWFuncType _moveFXWFunc ;
411 MoveWFuncType _moveFYWFunc ;
412 MoveWFuncType _moveFZWFunc ;
413 MoveWFuncType _moveFCWFunc ;
414 MoveWFuncType _moveFTWFunc ;
415 MoveWFuncType _moveFUWFunc ;
416 MoveWFuncType _moveBXWFunc ;
417 MoveWFuncType _moveBYWFunc ;
418 MoveWFuncType _moveBZWFunc ;
419 MoveWFuncType _moveBCWFunc ;
420 MoveWFuncType _moveBTWFunc ;
421 MoveWFuncType _moveBUWFunc ;
422 MoveOffsetWFuncType _moveOffsetFunc ;
423 ResetCursorWFuncType _resetCursorFunc ;
424 MoveCursorFXLFWFuncType _moveCursorFXLFFunc ;
426
427protected:
429 void _enforceInstPub() { _enforceInst(); }
430
432 void _enforceInstPub2() { _enforceInst2(); }
433
434};
435
436#endif
#define SO_VIRTUALVOLUME_EXPORT
File containing all system dependent settings of the SoVirtualVolume project.
ml::VirtualVolume * _virtualVolume
Pointer to the current untyped virtual volume or NULL if there is none.
MLdouble getDoubleValue(const XVImageSize &pos)
SO_VIRTUALVOLUME_EXPORT void getValue(const XVImageSize &pos, DATATYPE &retVal)
MLint64 getInt64Value(const XVImageSize &pos)
bool _constructorAreExceptionsOn
useExceptions passed to constructor.
SO_VIRTUALVOLUME_EXPORT void fill(const XVImageSize &boxV1, const XVImageSize &boxV2, DATATYPE value)
SO_VIRTUALVOLUME_EXPORT MLDataType getDataType() const
void setLDoubleCursorValue(MLldouble v)
SO_VIRTUALVOLUME_EXPORT void getWrittenPageData(MLuint32 wp, DATATYPE *&dataPtr) const
virtual SO_VIRTUALVOLUME_EXPORT ~SoVirtualVolume()
SO_VIRTUALVOLUME_EXPORT XVImageSize getPageArrayExtent() const
Returns extents of the array of page buffers.
SO_VIRTUALVOLUME_EXPORT SoVirtualVolume & operator=(const SoVirtualVolume &virtVol)
SO_VIRTUALVOLUME_EXPORT void * getWrittenPageData(MLuint32 wp)
MLint getIntValue(const XVImageSize &pos)
void fillInt(const XVImageSize &boxV1, const XVImageSize &boxV2, MLint v)
void setCursorPosition(const XVImageSize &pos)
SO_VIRTUALVOLUME_EXPORT bool isValid() const
Returns true if access methods may be called; otherwise, it returns false.
long getMaxNumKB() const
Returns the maxNumKB value passed to the constructor.
void setInt64Value(const XVImageSize &pos, MLint64 v)
void moveCursorByOffset(const XVImageSize &off)
SO_VIRTUALVOLUME_EXPORT SoSFMLImage * getImage() const
SO_VIRTUALVOLUME_EXPORT MLuint getNumMappedPages() const
Access functions to virtual volume. Only to be called if isValid() returns true!
void * _tVirtualVolume
Pointer to the current typed virtual volume or NULL if there is none.
void fillDouble(const XVImageSize &boxV1, const XVImageSize &boxV2, MLdouble v)
bool isMapped(const XVImageSize &pos)
SO_VIRTUALVOLUME_EXPORT void unMapAndClearWrittenPages()
void setIntValue(const XVImageSize &pos, MLint v)
SO_VIRTUALVOLUME_EXPORT SoVirtualVolume(const XVImageSize &ext=XVImageSize(0), double fillVal=0, MLDataType dType=MLuint8Type, long maxNumKB=-1, bool useExceptions=false)
void _enforceInstPub()
Template instantiation helper function. This function must not be called.
SO_VIRTUALVOLUME_EXPORT void setCursorValue(DATATYPE val)
void setLDoubleValue(const XVImageSize &pos, MLldouble v)
void setIntCursorValue(MLint v)
MLDataType _constructorDataType
Extents passed to constructor.
MLdouble getDoubleCursorValue()
SO_VIRTUALVOLUME_EXPORT SoVirtualVolume(SoSFMLImage &image, MLDataType dType=ML_INVALID_DATA_TYPE, long maxNumKB=-1, bool useExceptions=false)
SO_VIRTUALVOLUME_EXPORT MLuint getNumPages() const
Returns number of all (mapped and written) pages.
SO_VIRTUALVOLUME_EXPORT void _updateVirtualVolumes(const XVImageSize &ext=XVImageSize(0), double fillVal=0, MLDataType dType=MLuint8Type, long maxNumKB=-1, bool useExceptions=false)
SO_VIRTUALVOLUME_EXPORT void _removeVirtualVolumes(bool removeOnlyTyped=false)
MLldouble getLDoubleValue(const XVImageSize &pos)
void _enforceInstPub2()
Template instantiation helper function. This function must not be called.
SO_VIRTUALVOLUME_EXPORT void setValue(const XVImageSize &pos, DATATYPE data)
SO_VIRTUALVOLUME_EXPORT MLuint getNumBytes() const
Returns number of bytes currently allocated as pages in the virtual volume.
static SO_VIRTUALVOLUME_EXPORT void _imageChangedCB(void *clientData, SoSensor *sensor)
SO_VIRTUALVOLUME_EXPORT MLuint getNumWrittenPages()
Returns number of written (and therefore locked) pages.
SO_VIRTUALVOLUME_EXPORT SoVirtualVolume(const SoVirtualVolume &virtVol)
bool areExceptionsOn() const
Returns the useExceptions value passed to the constructor.
long _constructorMaxNumKB
maxNumKB passed to constructor.
MLint64 getInt64CursorValue()
const XVImageSize & getCursorPosition()
void setInt64CursorValue(MLint64 v)
void fillLDouble(const XVImageSize &boxV1, const XVImageSize &boxV2, MLldouble v)
SoSFMLImage * _image
Reference to the SoSFMLImage passed in the constructor.
SO_VIRTUALVOLUME_EXPORT XVImageSize getPageExtent() const
Returns extents of a written and read pages used by the virtual volume.
void setDoubleValue(const XVImageSize &pos, MLdouble v)
MLldouble getLDoubleCursorValue()
SO_VIRTUALVOLUME_EXPORT void getCursorValue(DATATYPE &retVal)
SO_VIRTUALVOLUME_EXPORT void _createTypedVirtualVolume()
SoFieldSensor _fieldSensor
void fillInt64(const XVImageSize &boxV1, const XVImageSize &boxV2, MLint64 v)
void setDoubleCursorValue(MLdouble v)
SO_VIRTUALVOLUME_EXPORT void resize(const XVImageSize &newExt)
SoSFMLImage - field interface to ML images and related classes.
Definition SoSFMLImage.h:32
#define ML_INVALID_DATA_TYPE
Definition mlTypeDefs.h:612
MLint32 MLDataType
Definition mlTypeDefs.h:595
@ MLuint8Type
Enumerator for the unsigned 8-bit ML integer type.
Definition mlTypeDefs.h:620
long double MLldouble
Definition mlTypeDefs.h:231
unsigned int MLuint32
Definition mlTypeDefs.h:184
MLuint64 MLuint
Definition mlTypeDefs.h:505
double MLdouble
Definition mlTypeDefs.h:216
INT64 MLint64
Include 64-bit integer support for Windows or Unix.
Definition mlTypeDefs.h:411
MLint64 MLint
Definition mlTypeDefs.h:489
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.