MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //--------------------------------------------------------------------------------- 00005 00010 //--------------------------------------------------------------------------------- 00011 #ifndef __SoVirtualVolume_H 00012 #define __SoVirtualVolume_H 00013 00014 #ifndef __SoVirtualVolumeSystem_H 00015 #include "SoVirtualVolumeSystem.h" 00016 #endif 00017 00018 // Incomplete types needed for abstract interface creation. 00019 00020 ML_START_NAMESPACE 00021 class Module; 00022 template <typename intT> class TVector6DBase; 00023 template<class TVectorBase> class TVector; 00024 template <typename intT> class TImageVector; 00025 typedef TImageVector<MLint> ImageVector; 00026 class VirtualVolume; 00027 template<typename DATATYPE> class TVirtualVolume; 00028 ML_END_NAMESPACE 00029 00030 //--------------------------------------------------------------------------------- 00033 //--------------------------------------------------------------------------------- 00034 class SoVirtualVolume 00035 { 00036 public: 00054 SO_VIRTUALVOLUME_EXPORT SoVirtualVolume(SoSFMLImage &image, 00055 MLDataType dType = ML_INVALID_DATA_TYPE, 00056 long maxNumKB = -1, 00057 bool useExceptions = false); 00058 00072 SO_VIRTUALVOLUME_EXPORT SoVirtualVolume(const XVImageSize &ext = XVImageSize(0), 00073 long double fillVal = 0, 00074 MLDataType dType = MLuint8Type, 00075 long maxNumKB = -1, 00076 bool useExceptions = false); 00077 00081 SO_VIRTUALVOLUME_EXPORT virtual ~SoVirtualVolume(); 00082 00084 SO_VIRTUALVOLUME_EXPORT bool isValid() const; 00085 00088 SO_VIRTUALVOLUME_EXPORT SoSFMLImage *getImage() const; 00089 00093 SO_VIRTUALVOLUME_EXPORT MLDataType getDataType() const; 00094 00096 inline long getMaxNumKB() const { return _constructorMaxNumKB; } 00097 00099 inline bool areExceptionsOn() const { return _constructorAreExceptionsOn; } 00100 00101 //--------------------------------------------------------------------------------------- 00103 //--------------------------------------------------------------------------------------- 00105 SO_VIRTUALVOLUME_EXPORT unsigned long getNumMappedPages() const; 00106 00108 SO_VIRTUALVOLUME_EXPORT unsigned long getNumWrittenPages(); 00109 00111 SO_VIRTUALVOLUME_EXPORT unsigned long getNumPages() const; 00112 00114 SO_VIRTUALVOLUME_EXPORT unsigned long getNumBytes() const; 00115 00117 SO_VIRTUALVOLUME_EXPORT XVImageSize getPageExtent() const; 00118 00120 SO_VIRTUALVOLUME_EXPORT XVImageSize getPageArrayExtent() const; 00121 00128 SO_VIRTUALVOLUME_EXPORT void *getWrittenPageData(MLuint32 wp); 00129 00134 SO_VIRTUALVOLUME_EXPORT void unMapAndClearWrittenPages(); 00135 00147 SO_VIRTUALVOLUME_EXPORT void resize(const XVImageSize &newExt); 00148 00149 00150 //--------------------------------------------------------------------------------------- 00160 00161 //--------------------------------------------------------------------------------------- 00162 // DO NOT TRACE: All methods are very time critical! 00163 inline const XVImageSize &getCursorPosition() { return (const XVImageSize&)_getCursorPosWFunc(_tVirtualVolume); } 00164 inline MLint getIntValue (const XVImageSize &pos) { return _getIntVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); } 00165 inline MLint64 getInt64Value (const XVImageSize &pos) { return _getInt64VoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); } 00166 inline MLdouble getDoubleValue (const XVImageSize &pos) { return _getDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); } 00167 inline MLldouble getLDoubleValue (const XVImageSize &pos) { return _getLDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); } 00168 inline MLint getIntCursorValue () { return _getIntCursorVoxelWFunc(_tVirtualVolume); } 00169 inline MLint64 getInt64CursorValue () { return _getInt64CursorVoxelWFunc(_tVirtualVolume); } 00170 inline MLdouble getDoubleCursorValue () { return _getDoubleCursorVoxelWFunc(_tVirtualVolume); } 00171 inline MLldouble getLDoubleCursorValue() { return _getLDoubleCursorVoxelWFunc(_tVirtualVolume); } 00172 inline bool isMapped (const XVImageSize &pos) { return _isMappedWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); } 00173 inline void setCursorPosition (const XVImageSize &pos) { _setCursorPosWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos)); } 00174 inline void setIntValue (const XVImageSize &pos, MLint v) { _setIntVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); } 00175 inline void setInt64Value (const XVImageSize &pos, MLint64 v) { _setInt64VoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); } 00176 inline void setDoubleValue (const XVImageSize &pos, MLdouble v) { _setDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); } 00177 inline void setLDoubleValue (const XVImageSize &pos, MLldouble v) { _setLDoubleVoxelWFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(pos), v); } 00178 inline void setIntCursorValue (MLint v) { _setIntCursorVoxelWFunc(_tVirtualVolume, v); } 00179 inline void setInt64CursorValue (MLint64 v) { _setInt64CursorVoxelWFunc(_tVirtualVolume, v); } 00180 inline void setDoubleCursorValue (MLdouble v) { _setDoubleCursorVoxelWFunc(_tVirtualVolume, v); } 00181 inline void setLDoubleCursorValue(MLldouble v) { _setLDoubleCursorVoxelWFunc(_tVirtualVolume, v); } 00182 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); } 00183 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); } 00184 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); } 00185 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); } 00186 inline void moveCursorX () { _moveFXWFunc(_tVirtualVolume); } 00187 inline void moveCursorY () { _moveFYWFunc(_tVirtualVolume); } 00188 inline void moveCursorZ () { _moveFZWFunc(_tVirtualVolume); } 00189 inline void moveCursorC () { _moveFCWFunc(_tVirtualVolume); } 00190 inline void moveCursorT () { _moveFTWFunc(_tVirtualVolume); } 00191 inline void moveCursorU () { _moveFUWFunc(_tVirtualVolume); } 00192 inline void reverseMoveCursorX () { _moveBXWFunc(_tVirtualVolume); } 00193 inline void reverseMoveCursorY () { _moveBYWFunc(_tVirtualVolume); } 00194 inline void reverseMoveCursorZ () { _moveBZWFunc(_tVirtualVolume); } 00195 inline void reverseMoveCursorC () { _moveBCWFunc(_tVirtualVolume); } 00196 inline void reverseMoveCursorT () { _moveBTWFunc(_tVirtualVolume); } 00197 inline void reverseMoveCursorU () { _moveBUWFunc(_tVirtualVolume); } 00198 inline void moveCursorByOffset (const XVImageSize &off) { _moveOffsetFunc(_tVirtualVolume, reinterpret_cast<const ML_NAMESPACE::ImageVector&>(off)); } 00199 inline void resetCursor () { _resetCursorFunc(_tVirtualVolume); } 00200 inline bool moveCursorXWrapAround() { return _moveCursorFXLFFunc(_tVirtualVolume); } 00202 00203 00204 //--------------------------------------------------------------------------------------- 00206 00207 //--------------------------------------------------------------------------------------- 00210 template <typename DATATYPE> 00211 SO_VIRTUALVOLUME_EXPORT void getValue(const XVImageSize &pos, DATATYPE &retVal); 00212 00216 template <typename DATATYPE> 00217 SO_VIRTUALVOLUME_EXPORT void setValue(const XVImageSize &pos, DATATYPE data); 00218 00221 template <typename DATATYPE> 00222 SO_VIRTUALVOLUME_EXPORT void setCursorValue(DATATYPE val); 00223 00226 template <typename DATATYPE> 00227 SO_VIRTUALVOLUME_EXPORT void getCursorValue(DATATYPE &retVal); 00228 00233 template <typename DATATYPE> 00234 SO_VIRTUALVOLUME_EXPORT void fill(const XVImageSize &boxV1, const XVImageSize &boxV2, DATATYPE value); 00235 00246 template <typename DATATYPE> 00247 SO_VIRTUALVOLUME_EXPORT void getWrittenPageData(MLuint32 wp, DATATYPE *&dataPtr) const; 00249 00250 protected: 00254 SO_VIRTUALVOLUME_EXPORT SoVirtualVolume(const SoVirtualVolume &virtVol); 00255 00259 SO_VIRTUALVOLUME_EXPORT SoVirtualVolume &operator=(const SoVirtualVolume &virtVol); 00260 00286 SO_VIRTUALVOLUME_EXPORT void _updateVirtualVolumes(const XVImageSize &ext = XVImageSize(0), 00287 long double fillVal = 0, 00288 MLDataType dType = MLuint8Type, 00289 long maxNumKB = -1, 00290 bool useExceptions = false); 00294 SO_VIRTUALVOLUME_EXPORT void _createTypedVirtualVolume(); 00295 00299 SO_VIRTUALVOLUME_EXPORT void _removeVirtualVolumes(bool removeOnlyTyped=false); 00300 00307 SO_VIRTUALVOLUME_EXPORT static void _imageChangedCB(void *clientData, SoSensor *sensor); 00308 00310 SoSFMLImage *_image; 00311 00313 MLDataType _constructorDataType; 00314 00316 long _constructorMaxNumKB; 00317 00319 bool _constructorAreExceptionsOn; 00320 00323 SoFieldSensor _fieldSensor; 00324 00326 ML_NAMESPACE::VirtualVolume *_virtualVolume; 00327 00329 void *_tVirtualVolume; 00330 00331 private: 00336 void _enforceInst(); 00337 00344 void _enforceInst2(); 00345 00346 //--------------------------------------------------------------------------------------- 00348 00349 //--------------------------------------------------------------------------------------- 00350 typedef const ML_NAMESPACE::ImageVector &(*GetCursorPosWFuncType )(void *vv) ; 00351 typedef MLint (*GetIntVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ; 00352 typedef MLint64 (*GetInt64VoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ; 00353 typedef MLdouble (*GetDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ; 00354 typedef MLldouble (*GetLDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ; 00355 typedef MLint (*GetIntCursorVoxelWFuncType )(void *vv) ; 00356 typedef MLint64 (*GetInt64CursorVoxelWFuncType )(void *vv) ; 00357 typedef MLdouble (*GetDoubleCursorVoxelWFuncType )(void *vv) ; 00358 typedef MLldouble (*GetLDoubleCursorVoxelWFuncType)(void *vv) ; 00359 typedef bool (*IsMappedWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ; 00360 typedef void (*SetCursorPosWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos) ; 00361 typedef void (*SetIntVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLint v) ; 00362 typedef void (*SetInt64VoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLint64 v) ; 00363 typedef void (*SetDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLdouble v) ; 00364 typedef void (*SetLDoubleVoxelWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &pos, MLldouble v) ; 00365 typedef void (*SetIntCursorVoxelWFuncType )(void *vv, MLint v) ; 00366 typedef void (*SetInt64CursorVoxelWFuncType )(void *vv, MLint64 v) ; 00367 typedef void (*SetDoubleCursorVoxelWFuncType )(void *vv, MLdouble v) ; 00368 typedef void (*SetLDoubleCursorVoxelWFuncType)(void *vv, MLldouble v) ; 00369 typedef void (*FillIntWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLint v); 00370 typedef void (*FillInt64WFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLint64 v); 00371 typedef void (*FillDoubleWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLdouble v); 00372 typedef void (*FillLDoubleWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &boxV1, const ML_NAMESPACE::ImageVector &boxV2, MLldouble v); 00373 typedef void (*MoveWFuncType )(void *vv) ; 00374 typedef void (*MoveOffsetWFuncType )(void *vv, const ML_NAMESPACE::ImageVector &off) ; 00375 typedef void (*ResetCursorWFuncType )(void *vv) ; 00376 typedef bool (*MoveCursorFXLFWFuncType )(void *vv) ; 00378 00379 //--------------------------------------------------------------------------------------- 00381 00382 //--------------------------------------------------------------------------------------- 00383 GetCursorPosWFuncType _getCursorPosWFunc ; 00384 GetIntVoxelWFuncType _getIntVoxelWFunc ; 00385 GetInt64VoxelWFuncType _getInt64VoxelWFunc ; 00386 GetDoubleVoxelWFuncType _getDoubleVoxelWFunc ; 00387 GetLDoubleVoxelWFuncType _getLDoubleVoxelWFunc ; 00388 GetIntCursorVoxelWFuncType _getIntCursorVoxelWFunc ; 00389 GetInt64CursorVoxelWFuncType _getInt64CursorVoxelWFunc ; 00390 GetDoubleCursorVoxelWFuncType _getDoubleCursorVoxelWFunc ; 00391 GetLDoubleCursorVoxelWFuncType _getLDoubleCursorVoxelWFunc ; 00392 IsMappedWFuncType _isMappedWFunc ; 00393 SetCursorPosWFuncType _setCursorPosWFunc ; 00394 SetIntVoxelWFuncType _setIntVoxelWFunc ; 00395 SetInt64VoxelWFuncType _setInt64VoxelWFunc ; 00396 SetDoubleVoxelWFuncType _setDoubleVoxelWFunc ; 00397 SetLDoubleVoxelWFuncType _setLDoubleVoxelWFunc ; 00398 SetIntCursorVoxelWFuncType _setIntCursorVoxelWFunc ; 00399 SetInt64CursorVoxelWFuncType _setInt64CursorVoxelWFunc ; 00400 SetDoubleCursorVoxelWFuncType _setDoubleCursorVoxelWFunc ; 00401 SetLDoubleCursorVoxelWFuncType _setLDoubleCursorVoxelWFunc ; 00402 FillIntWFuncType _fillIntWFunc ; 00403 FillInt64WFuncType _fillInt64WFunc ; 00404 FillDoubleWFuncType _fillDoubleWFunc ; 00405 FillLDoubleWFuncType _fillLDoubleWFunc ; 00406 MoveWFuncType _moveFXWFunc ; 00407 MoveWFuncType _moveFYWFunc ; 00408 MoveWFuncType _moveFZWFunc ; 00409 MoveWFuncType _moveFCWFunc ; 00410 MoveWFuncType _moveFTWFunc ; 00411 MoveWFuncType _moveFUWFunc ; 00412 MoveWFuncType _moveBXWFunc ; 00413 MoveWFuncType _moveBYWFunc ; 00414 MoveWFuncType _moveBZWFunc ; 00415 MoveWFuncType _moveBCWFunc ; 00416 MoveWFuncType _moveBTWFunc ; 00417 MoveWFuncType _moveBUWFunc ; 00418 MoveOffsetWFuncType _moveOffsetFunc ; 00419 ResetCursorWFuncType _resetCursorFunc ; 00420 MoveCursorFXLFWFuncType _moveCursorFXLFFunc ; 00422 00423 protected: 00425 void _enforceInstPub() { _enforceInst(); } 00426 00428 void _enforceInstPub2() { _enforceInst2(); } 00429 00430 00431 #ifdef ML_DEPRECATED 00432 00434 00435 00436 public: 00437 00438 00441 SO_VIRTUALVOLUME_EXPORT ML_DEPRECATED XVImageSize getPageExt() const { return getPageExtent(); } 00442 00445 SO_VIRTUALVOLUME_EXPORT ML_DEPRECATED XVImageSize getPageArrayExt() const { return getPageArrayExtent(); } 00446 00449 inline ML_DEPRECATED const XVImageSize &getCursorPos() { return getCursorPosition(); } 00452 inline ML_DEPRECATED MLint getIntVoxel (const XVImageSize &pos) { return getIntValue(pos); } 00455 inline ML_DEPRECATED MLint64 getInt64Voxel (const XVImageSize &pos) { return getInt64Value(pos); } 00458 inline ML_DEPRECATED MLdouble getDoubleVoxel (const XVImageSize &pos) { return getDoubleValue(pos); } 00461 inline ML_DEPRECATED MLldouble getLDoubleVoxel (const XVImageSize &pos) { return getLDoubleValue(pos); } 00464 inline ML_DEPRECATED MLint getIntCursorVoxel () { return getIntCursorValue(); } 00467 inline ML_DEPRECATED MLint64 getInt64CursorVoxel () { return getInt64CursorValue(); } 00470 inline ML_DEPRECATED MLdouble getDoubleCursorVoxel () { return getDoubleCursorValue(); } 00473 inline ML_DEPRECATED MLldouble getLDoubleCursorVoxel() { return getLDoubleCursorValue(); } 00476 inline ML_DEPRECATED void setCursorPos (const XVImageSize &pos) { setCursorPosition(pos); } 00479 inline ML_DEPRECATED void setIntVoxel (const XVImageSize &pos, MLint v) { setIntValue(pos, v); } 00482 inline ML_DEPRECATED void setInt64Voxel (const XVImageSize &pos, MLint64 v) { setInt64Value(pos, v); } 00485 inline ML_DEPRECATED void setDoubleVoxel (const XVImageSize &pos, MLdouble v) { setDoubleValue(pos, v); } 00488 inline ML_DEPRECATED void setLDoubleVoxel (const XVImageSize &pos, MLldouble v) { setLDoubleValue(pos, v); } 00491 inline ML_DEPRECATED void setIntCursorVoxel (MLint v) { setIntCursorValue(v); } 00494 inline ML_DEPRECATED void setInt64CursorVoxel (MLint64 v) { setInt64CursorValue(v); } 00497 inline ML_DEPRECATED void setDoubleCursorVoxel (MLdouble v) { setDoubleCursorValue(v); } 00500 inline ML_DEPRECATED void setLDoubleCursorVoxel(MLldouble v) { setLDoubleCursorValue(v); } 00503 inline ML_DEPRECATED void moveFX () { moveCursorX(); } 00506 inline ML_DEPRECATED void moveFY () { moveCursorY(); } 00509 inline ML_DEPRECATED void moveFZ () { moveCursorZ(); } 00512 inline ML_DEPRECATED void moveFC () { moveCursorC(); } 00515 inline ML_DEPRECATED void moveFT () { moveCursorT(); } 00518 inline ML_DEPRECATED void moveFU () { moveCursorU(); } 00521 inline ML_DEPRECATED void moveBX () { reverseMoveCursorX(); } 00524 inline ML_DEPRECATED void moveBY () { reverseMoveCursorY(); } 00527 inline ML_DEPRECATED void moveBZ () { reverseMoveCursorZ(); } 00530 inline ML_DEPRECATED void moveBC () { reverseMoveCursorC(); } 00533 inline ML_DEPRECATED void moveBT () { reverseMoveCursorT(); } 00536 inline ML_DEPRECATED void moveBU () { reverseMoveCursorU(); } 00539 inline ML_DEPRECATED void moveOffset (const XVImageSize &off) { moveCursorByOffset(off); } 00542 inline ML_DEPRECATED bool moveCursorFXLF () { return moveCursorXWrapAround(); } 00543 00546 template <typename DATATYPE> 00547 ML_DEPRECATED void getVoxel(const XVImageSize &pos, DATATYPE &retVal) { getValue<DATATYPE>(pos, retVal); } 00548 00551 template <typename DATATYPE> 00552 ML_DEPRECATED void setVoxel(const XVImageSize &pos, DATATYPE data) { setValue<DATATYPE>(pos, data); } 00553 00556 template <typename DATATYPE> 00557 ML_DEPRECATED void getCursorVoxel(DATATYPE &retVal) { getCursorValue<DATATYPE>(retVal); } 00558 00561 template <typename DATATYPE> 00562 ML_DEPRECATED void setCursorVoxel(DATATYPE val) { setCursorValue<DATATYPE>(val); } 00563 00564 00566 00567 #endif // ML_DEPRECATED 00568 00569 00570 }; 00571 00572 #endif // __SoVirtualVolume_H