MeVisLab Toolbox Reference
mlTVirtualVolume.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_TVIRTUAL_VOLUME_H
14 #define ML_TVIRTUAL_VOLUME_H
15 
16 
19 
26 
27 // Include dll-specific settings.
28 #include "MLToolsSystem.h"
29 
30 // Include most ml specific things.
31 #include "mlVirtualVolume.h"
32 
33 // Include BitImage.
34 #include "mlBitImage.h"
35 
36 ML_START_NAMESPACE
37 
38 //---------------------------------------------------------------------------------------------------------
209 //---------------------------------------------------------------------------------------------------------
210 template<typename DATATYPE> class TVirtualVolume {
211 
212 protected:
214  inline TVirtualVolume(){}
215 
219 
220 public:
221 
223  typedef DATATYPE ComponentType;
224 
228  {
229  _convenienceInstance = nullptr;
230  _init(vVol);
231  }
232 
240  TVirtualVolume(PagedImage *image, MLint maxNumKB=-1,
241  bool areExceptionsOn=false)
242  {
243  _convenienceInstance = new VirtualVolume(image,
244  MLGetDataTypeFromPtr(static_cast<DATATYPE*>(nullptr)),
245  maxNumKB,
246  areExceptionsOn);
247  _init(*_convenienceInstance);
248  }
249 
258  MLdouble fillVal = 0,
259  MLint maxNumKB = -1,
260  bool areExceptionsOn = false)
261  {
262  _convenienceInstance = new VirtualVolume(ext,
263  fillVal,
264  MLGetDataTypeFromPtr(static_cast<DATATYPE*>(nullptr)),
265  maxNumKB,
266  areExceptionsOn);
267  _init(*_convenienceInstance);
268  }
269 
273  virtual ~TVirtualVolume()
274  {
275  _cleanUp();
276  delete _convenienceInstance;
277  _convenienceInstance = nullptr;
278  }
279 
281  inline VirtualVolume &getVirtualVolume() { return *_virtVol; }
282 
288  inline void getValues(const ImageVector *pos, DATATYPE *results, MLuint num);
289 
292  inline DATATYPE getValue(const ImageVector &pos) { return _getVoxelFunc(this, pos); }
293 
296  inline void setValue(const ImageVector &pos, DATATYPE data) { _setVoxelFunc(this, pos, data); }
297 
299  inline void setCursorPosition(const ImageVector & pos) { _setCursorPosFunc(this, pos); }
300 
302  inline const ImageVector &getCursorPosition() const { return _cPos; }
303 
305  inline void setCursorValue(DATATYPE val);
306 
308  inline DATATYPE getCursorValue();
309 
311  inline bool isMapped(const ImageVector &pos) const { return _isMappedFunc(this, pos); }
312 
315  inline void moveCursorX() { _moveFXFunc(this); }
316  inline void moveCursorY() { _moveFYFunc(this); }
317  inline void moveCursorZ() { _moveFZFunc(this); }
318  inline void moveCursorC() { _moveFCFunc(this); }
319  inline void moveCursorT() { _moveFTFunc(this); }
320  inline void moveCursorU() { _moveFUFunc(this); }
321 
322  inline void reverseMoveCursorX() { _moveBXFunc(this); }
323  inline void reverseMoveCursorY() { _moveBYFunc(this); }
324  inline void reverseMoveCursorZ() { _moveBZFunc(this); }
325  inline void reverseMoveCursorC() { _moveBCFunc(this); }
326  inline void reverseMoveCursorT() { _moveBTFunc(this); }
327  inline void reverseMoveCursorU() { _moveBUFunc(this); }
329 
331  inline void moveCursorByOffset(const ImageVector &off) { _moveCursorOffsetFunc(this, off);}
332 
336  void resetCursor();
337 
347  bool moveCursorXWrapAround();
349 
353  void fill(const SubImageBox &box, DATATYPE value);
354 
359  void copyToSubImage(TSubImage<DATATYPE> &outSubImg);
360 
365  void copyFromSubImage(const TSubImage<DATATYPE> &inImg, const SubImageBox &box, const ImageVector &pos);
366 
386  //
387  // It would be desirable to have this function in the implementation part, but I
388  // don't know how to do that syntactically with the second template argument.
389  // (Maybe the VC++6 compiler does not support that?)
390  //
391  template <typename OUTDTYPE>
393  BitImage &maskBits,
394  bool maskValue = true,
395  bool writeBK = false,
396  OUTDTYPE bkVal = ml_cast_from_scalar<OUTDTYPE>(0))
397  {
398  // Save cursor positions of *this, maskBits and outSubImg.
399  const ImageVector vvCursorPos(getCursorPosition());
400  const ImageVector bitImgCursorPos(maskBits.getCursorPosition());
401 
402  // Determine valid overlapping region of virtual volume and output page.
403  SubImageBox box = SubImageBox::intersect(_virtVol->getBox(), outSubImg.getBox());
404 
405  // Clamp box against bitImage box.
406  box = box.intersect(SubImageBox(maskBits.getExtent()));
407 
408  // Scan all voxels in both input subimages which have identical
409  // extents (as specified in calculateInputSubImageBox).
410  ImageVector p = box.v1;
411  for (p.u = box.v1.u; p.u <= box.v2.u; p.u++){
412  for (p.t = box.v1.t; p.t <= box.v2.t; p.t++){
413  for (p.c = box.v1.c; p.c <= box.v2.c; p.c++){
414  for (p.z = box.v1.z; p.z <= box.v2.z; p.z++){
415  for (p.y = box.v1.y; p.y <= box.v2.y; p.y++){
416 
417  // Calculate first voxel position in x row.
418  p.x = box.v1.x;
419 
420  // Get pointer to first voxels in x-rows of output subimage.
421  OUTDTYPE* oP = outSubImg.getImagePointer(p);
422 
423  // Set cursor position in virtual volume.
424  setCursorPosition(p);
425 
426  // Set cursor in bitImage of _drawImage.
427  maskBits.setCursorPosition(p);
428 
429  // Iterate over all voxels in voxel rows.
430  for (; p.x <= box.v2.x; p.x++){
431 
432  // Copy value from virtual volume if corresponding bit
433  // image flag denotes a modified value.
434  if (maskBits.getCursorValue() == maskValue){
435  *oP = static_cast<OUTDTYPE>(getCursorValue());
436  }
437  else{
438  // No copy desired. Set bkVal if writeBK permits it.
439  if (writeBK){ *oP =bkVal; }
440  }
441 
442  // Move all image cursors forward, but do not move them
443  // outside image areas in last column to avoid exceptions.
444  if (p.x < box.v2.x){
445  // Move forward the output data pointer.
446  ++oP;
447 
448  // Move forward the virtual volume cursor.
449  moveCursorX();
450 
451  // Move forward the bit image cursor.
452  maskBits.moveCursorX();
453  }
454  }
455  }
456  }
457  }
458  }
459  }
460 
461  // Restore cursor positions.
462  setCursorPosition(vvCursorPos);
463  maskBits.setCursorPosition(bitImgCursorPos);
464  }
465 
466 
473  inline DATATYPE *getWrittenPageData(MLuint32 wp) const { return static_cast<DATATYPE*>(_virtVol->getWrittenPageData(wp)); }
474 
475 
476 
485  static MLint getIntValueWrapped (void *vv, const ImageVector &pos) { return static_cast<MLint >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
486  static MLint64 getInt64ValueWrapped (void *vv, const ImageVector &pos) { return static_cast<MLint64 >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
487  static MLdouble getDoubleValueWrapped (void *vv, const ImageVector &pos) { return static_cast<MLdouble >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
488  static MLldouble getLDoubleValueWrapped (void *vv, const ImageVector &pos) { return static_cast<MLldouble>((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
489  static MLint getIntCursorValueWrapped (void *vv) { return static_cast<MLint >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
490  static MLint64 getInt64CursorValueWrapped (void *vv) { return static_cast<MLint64 >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
491  static MLdouble getDoubleCursorValueWrapped (void *vv) { return static_cast<MLdouble >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
492  static MLldouble getLDoubleCursorValueWrapped (void *vv) { return static_cast<MLldouble>((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
493  static const ImageVector &getCursorPositionWrapped(void *vv) { return (static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorPosition(); }
494  static bool isMappedWrapped (void *vv, const ImageVector &pos) { return (static_cast<TVirtualVolume<DATATYPE>*>(vv))->isMapped(pos); }
495  static void setCursorPositionWrapped (void *vv, const ImageVector &pos) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorPosition(pos); }
496  static void setIntValueWrapped (void *vv, const ImageVector &pos, MLint v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
497  static void setInt64ValueWrapped (void *vv, const ImageVector &pos, MLint64 v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
498  static void setDoubleValueWrapped (void *vv, const ImageVector &pos, MLdouble v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
499  static void setLDoubleValueWrapped (void *vv, const ImageVector &pos, MLldouble v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
500  static void setIntCursorValueWrapped (void *vv, MLint v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
501  static void setInt64CursorValueWrapped (void *vv, MLint64 v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
502  static void setDoubleCursorValueWrapped (void *vv, MLdouble v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
503  static void setLDoubleCursorValueWrapped (void *vv, MLldouble v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
504  static void fillIntWrapped (void *vv, const ImageVector &v1, const ImageVector &v2, MLint v){ (static_cast<TVirtualVolume<DATATYPE>*>(vv))->fill(SubImageBox(v1, v2), static_cast<DATATYPE>(v)); }
505  static void fillInt64Wrapped (void *vv, const ImageVector &v1, const ImageVector &v2, MLint64 v){ (static_cast<TVirtualVolume<DATATYPE>*>(vv))->fill(SubImageBox(v1, v2), static_cast<DATATYPE>(v)); }
506  static void fillDoubleWrapped (void *vv, const ImageVector &v1, const ImageVector &v2, MLdouble v){ (static_cast<TVirtualVolume<DATATYPE>*>(vv))->fill(SubImageBox(v1, v2), static_cast<DATATYPE>(v)); }
507  static void fillLDoubleWrapped (void *vv, const ImageVector &v1, const ImageVector &v2, MLldouble v){ (static_cast<TVirtualVolume<DATATYPE>*>(vv))->fill(SubImageBox(v1, v2), static_cast<DATATYPE>(v)); }
508  static void moveCursorXWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorX(); }
509  static void moveCursorYWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorY(); }
510  static void moveCursorZWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorZ(); }
511  static void moveCursorCWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorC(); }
512  static void moveCursorTWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorT(); }
513  static void moveCursorUWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorU(); }
514  static void reverseMoveCursorXWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorX(); }
515  static void reverseMoveCursorYWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorY(); }
516  static void reverseMoveCursorZWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorZ(); }
517  static void reverseMoveCursorCWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorC(); }
518  static void reverseMoveCursorTWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorT(); }
519  static void reverseMoveCursorUWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorU(); }
520  static void moveCursorByOffsetWrapped (void *vv, const ImageVector &off) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorByOffset(off); }
521  static void resetCursorWrapped (void *vv) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->resetCursor(); }
522  static bool moveCursorXWrapAroundWrapped (void *vv) { return (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorXWrapAround(); }
524 
525 #if ML_DEPRECATED_SINCE(3,5,0)
526 
529 
530 public:
533  ML_DEPRECATED_CONSTRUCTOR TVirtualVolume(Module *module, MLint connIdx, MLint maxNumKB=-1,
534  bool areExceptionsOn=false, bool useOutConnectors=false)
535  {
536  PagedImage* image = nullptr;
537  if (useOutConnectors) {
538  image = module->getOutputImage(connIdx);
539  } else {
540  image = module->getUpdatedInputImage(connIdx);
541  }
542  _convenienceInstance = new VirtualVolume(image,
543  MLGetDataTypeFromPtr(static_cast<DATATYPE*>(nullptr)),
544  maxNumKB,
545  areExceptionsOn);
546  _init(*_convenienceInstance);
547  }
550  inline ML_DEPRECATED void copyToSubImg(TSubImage<DATATYPE> &outSubImg) { copyToSubImage(outSubImg); }
551 
554  inline ML_DEPRECATED void copyFromSubImg(const TSubImage<DATATYPE> &inImg, const SubImageBox &box, const ImageVector &pos) { copyFromSubImage(inImg, box, pos); }
555 
558  inline ML_DEPRECATED void getVoxels(const ImageVector *pos, DATATYPE *results, MLuint num) { getValues(pos, results, num); }
559 
562  inline ML_DEPRECATED DATATYPE getVoxel(const ImageVector &pos) { return getValue(pos); }
563 
566  inline ML_DEPRECATED void setVoxel(const ImageVector &pos, DATATYPE data) { setValue(pos, data); }
567 
570  inline ML_DEPRECATED void setCursorPos(const ImageVector & pos) { setCursorPosition(pos); }
571 
574  inline ML_DEPRECATED const ImageVector &getCursorPos() const { return getCursorPosition(); }
575 
578  inline ML_DEPRECATED void setCursorVoxel(DATATYPE val) { setCursorValue(val); }
579 
582  inline ML_DEPRECATED DATATYPE getCursorVoxel() { return getCursorValue(); }
583 
586  inline ML_DEPRECATED void moveFX() { moveCursorX(); }
589  inline ML_DEPRECATED void moveFY() { moveCursorY(); }
592  inline ML_DEPRECATED void moveFZ() { moveCursorZ(); }
595  inline ML_DEPRECATED void moveFC() { moveCursorC(); }
598  inline ML_DEPRECATED void moveFT() { moveCursorT(); }
601  inline ML_DEPRECATED void moveFU() { moveCursorU(); }
602 
605  inline ML_DEPRECATED void moveBX() { reverseMoveCursorX(); }
608  inline ML_DEPRECATED void moveBY() { reverseMoveCursorY(); }
611  inline ML_DEPRECATED void moveBZ() { reverseMoveCursorZ(); }
614  inline ML_DEPRECATED void moveBC() { reverseMoveCursorC(); }
617  inline ML_DEPRECATED void moveBT() { reverseMoveCursorT(); }
620  inline ML_DEPRECATED void moveBU() { reverseMoveCursorU(); }
623  inline ML_DEPRECATED bool moveCursorFXLF() { return moveCursorXWrapAround(); }
624 
627  inline ML_DEPRECATED void moveOffset(const ImageVector &off) { moveCursorByOffset(off);}
628 
629 
632  static ML_DEPRECATED MLint getIntVoxelW (void *vv, const ImageVector &pos) { return getIntValueWrapped(vv, pos); }
635  static ML_DEPRECATED MLint64 getInt64VoxelW (void *vv, const ImageVector &pos) { return getInt64ValueWrapped(vv, pos); }
638  static ML_DEPRECATED MLdouble getDoubleVoxelW (void *vv, const ImageVector &pos) { return getDoubleValueWrapped(vv, pos); }
641  static ML_DEPRECATED MLldouble getLDoubleVoxelW (void *vv, const ImageVector &pos) { return getLDoubleValueWrapped(vv, pos); }
644  static ML_DEPRECATED MLint getIntCursorVoxelW (void *vv) { return getIntCursorValueWrapped(vv); }
647  static ML_DEPRECATED MLint64 getInt64CursorVoxelW (void *vv) { return getInt64CursorValueWrapped(vv); }
650  static ML_DEPRECATED MLdouble getDoubleCursorVoxelW (void *vv) { return getDoubleCursorValueWrapped(vv); }
653  static ML_DEPRECATED MLldouble getLDoubleCursorVoxelW(void *vv) { return getLDoubleCursorValueWrapped(vv); }
656  static ML_DEPRECATED const ImageVector &getCursorPosW (void *vv) { return getCursorPositionWrapped(vv); }
659  static ML_DEPRECATED bool isMappedW (void *vv, const ImageVector &pos) { return isMappedWrapped(vv, pos); }
662  static ML_DEPRECATED void setCursorPosW (void *vv, const ImageVector &pos) { setCursorPositionWrapped(vv, pos); }
665  static ML_DEPRECATED void setIntVoxelW (void *vv, const ImageVector &pos, MLint v) { setIntValueWrapped(vv, pos, v); }
668  static ML_DEPRECATED void setInt64VoxelW (void *vv, const ImageVector &pos, MLint64 v) { setInt64ValueWrapped(vv, pos, v); }
671  static ML_DEPRECATED void setDoubleVoxelW (void *vv, const ImageVector &pos, MLdouble v) { setDoubleValueWrapped(vv, pos, v); }
674  static ML_DEPRECATED void setLDoubleVoxelW (void *vv, const ImageVector &pos, MLldouble v) { setLDoubleValueWrapped(vv, pos, v); }
677  static ML_DEPRECATED void setIntCursorVoxelW (void *vv, MLint v) { setIntCursorValueWrapped(vv, v); }
680  static ML_DEPRECATED void setInt64CursorVoxelW (void *vv, MLint64 v) { setInt64CursorValueWrapped(vv, v); }
683  static ML_DEPRECATED void setDoubleCursorVoxelW (void *vv, MLdouble v) { setDoubleCursorValueWrapped(vv, v); }
686  static ML_DEPRECATED void setLDoubleCursorVoxelW(void *vv, MLldouble v) { setLDoubleCursorValueWrapped(vv, v); }
689  static ML_DEPRECATED void fillIntW (void *vv, const ImageVector &v1, const ImageVector &v2, MLint v){ fillIntWrapped(vv, v1, v2, v); }
692  static ML_DEPRECATED void fillInt64W (void *vv, const ImageVector &v1, const ImageVector &v2, MLint64 v){ fillInt64Wrapped(vv, v1, v2, v); }
695  static ML_DEPRECATED void fillDoubleW (void *vv, const ImageVector &v1, const ImageVector &v2, MLdouble v){ fillDoubleWrapped(vv, v1, v2, v); }
698  static ML_DEPRECATED void fillLDoubleW (void *vv, const ImageVector &v1, const ImageVector &v2, MLldouble v){ fillLDoubleWrapped(vv, v1, v2, v); }
701  static ML_DEPRECATED void moveFXW (void *vv) { moveCursorXWrapped(vv); }
704  static ML_DEPRECATED void moveFYW (void *vv) { moveCursorYWrapped(vv); }
707  static ML_DEPRECATED void moveFZW (void *vv) { moveCursorZWrapped(vv); }
710  static ML_DEPRECATED void moveFCW (void *vv) { moveCursorCWrapped(vv); }
713  static ML_DEPRECATED void moveFTW (void *vv) { moveCursorTWrapped(vv); }
716  static ML_DEPRECATED void moveFUW (void *vv) { moveCursorUWrapped(vv); }
719  static ML_DEPRECATED void moveBXW (void *vv) { reverseMoveCursorXWrapped(vv); }
722  static ML_DEPRECATED void moveBYW (void *vv) { reverseMoveCursorYWrapped(vv); }
725  static ML_DEPRECATED void moveBZW (void *vv) { reverseMoveCursorZWrapped(vv); }
728  static ML_DEPRECATED void moveBCW (void *vv) { reverseMoveCursorCWrapped(vv); }
731  static ML_DEPRECATED void moveBTW (void *vv) { reverseMoveCursorTWrapped(vv); }
734  static ML_DEPRECATED void moveBUW (void *vv) { reverseMoveCursorUWrapped(vv); }
737  static ML_DEPRECATED void moveOffsetW (void *vv, const ImageVector &off) { moveCursorByOffsetWrapped(vv, off); }
740  static ML_DEPRECATED void resetCursorW (void *vv) { resetCursorWrapped(vv); }
743  static ML_DEPRECATED bool moveCursorFXLFW (void *vv) { return moveCursorXWrapAroundWrapped(vv); }
744 
746 
747 #endif // ML_DEPRECATED
748 
749 protected:
750 
751  //------------------------------------------------------------------------------------------------------
752  //------------------------------------------------------------------------------------------------------
753  //------------------------------------------------------------------------------------------------------
754  //
755  //
756  // NOTHING BELOW FOR NORMAL VIRTUAL VOLUME USAGE.
757  //
758  //
759  //------------------------------------------------------------------------------------------------------
760  //------------------------------------------------------------------------------------------------------
761  //------------------------------------------------------------------------------------------------------
762 
763 
764  //------------------------------------------------------------------------------------------------------
766  //------------------------------------------------------------------------------------------------------
767  void _init(VirtualVolume &vVol);
768 
769  //------------------------------------------------------------------------------------------------------
771  //------------------------------------------------------------------------------------------------------
772  void _cleanUp();
773 
774  //------------------------------------------------------------------------------------------------------
775  //------------------------------------------------------------------------------------------------------
776  // GetVoxel, SetVoxel and IsMapped implementations.
777  //------------------------------------------------------------------------------------------------------
778  //------------------------------------------------------------------------------------------------------
779 
780  //------------------------------------------------------------------------------------------------------
787  //------------------------------------------------------------------------------------------------------
789  inline DATATYPE _getVoxel1D (const ImageVector &pos);
790  inline DATATYPE _getVoxel2D (const ImageVector &pos);
791  inline DATATYPE _getVoxel3D (const ImageVector &pos);
792  inline DATATYPE _getVoxel4D (const ImageVector &pos);
793  inline DATATYPE _getVoxel5D (const ImageVector &pos);
794  inline DATATYPE _getVoxel6D (const ImageVector &pos);
795 
796  inline DATATYPE _getVoxel1DE(const ImageVector &pos);
797  inline DATATYPE _getVoxel2DE(const ImageVector &pos);
798  inline DATATYPE _getVoxel3DE(const ImageVector &pos);
799  inline DATATYPE _getVoxel4DE(const ImageVector &pos);
800  inline DATATYPE _getVoxel5DE(const ImageVector &pos);
801  inline DATATYPE _getVoxel6DE(const ImageVector &pos);
803 
804  //----------------------------------------------------------------------------------
811  //----------------------------------------------------------------------------------
813  inline void _setVoxel1D (const ImageVector &pos, DATATYPE voxVal);
814  inline void _setVoxel2D (const ImageVector &pos, DATATYPE voxVal);
815  inline void _setVoxel3D (const ImageVector &pos, DATATYPE voxVal);
816  inline void _setVoxel4D (const ImageVector &pos, DATATYPE voxVal);
817  inline void _setVoxel5D (const ImageVector &pos, DATATYPE voxVal);
818  inline void _setVoxel6D (const ImageVector &pos, DATATYPE voxVal);
819 
820  inline void _setVoxel1DE(const ImageVector &pos, DATATYPE voxVal);
821  inline void _setVoxel2DE(const ImageVector &pos, DATATYPE voxVal);
822  inline void _setVoxel3DE(const ImageVector &pos, DATATYPE voxVal);
823  inline void _setVoxel4DE(const ImageVector &pos, DATATYPE voxVal);
824  inline void _setVoxel5DE(const ImageVector &pos, DATATYPE voxVal);
825  inline void _setVoxel6DE(const ImageVector &pos, DATATYPE voxVal);
827 
828  //----------------------------------------------------------------------------------
834  //----------------------------------------------------------------------------------
836  inline bool _isMapped1D (const ImageVector &pos) const;
837  inline bool _isMapped2D (const ImageVector &pos) const;
838  inline bool _isMapped3D (const ImageVector &pos) const;
839  inline bool _isMapped4D (const ImageVector &pos) const;
840  inline bool _isMapped5D (const ImageVector &pos) const;
841  inline bool _isMapped6D (const ImageVector &pos) const;
842 
843  inline bool _isMapped1DE(const ImageVector &pos) const;
844  inline bool _isMapped2DE(const ImageVector &pos) const;
845  inline bool _isMapped3DE(const ImageVector &pos) const;
846  inline bool _isMapped4DE(const ImageVector &pos) const;
847  inline bool _isMapped5DE(const ImageVector &pos) const;
848  inline bool _isMapped6DE(const ImageVector &pos) const;
850 
851 
852  //--------------------------------------------------------------------------------------------------------------------------
857  //--------------------------------------------------------------------------------------------------------------------------
859  inline static DATATYPE _getVoxel1DCB (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel1D(pos); };
860  inline static DATATYPE _getVoxel2DCB (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel2D(pos); };
861  inline static DATATYPE _getVoxel3DCB (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel3D(pos); };
862  inline static DATATYPE _getVoxel4DCB (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel4D(pos); };
863  inline static DATATYPE _getVoxel5DCB (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel5D(pos); };
864  inline static DATATYPE _getVoxel6DCB (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel6D(pos); };
865 
866  inline static DATATYPE _getVoxel1DCBE (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel1DE(pos); };
867  inline static DATATYPE _getVoxel2DCBE (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel2DE(pos); };
868  inline static DATATYPE _getVoxel3DCBE (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel3DE(pos); };
869  inline static DATATYPE _getVoxel4DCBE (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel4DE(pos); };
870  inline static DATATYPE _getVoxel5DCBE (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel5DE(pos); };
871  inline static DATATYPE _getVoxel6DCBE (TVirtualVolume *obj, const ImageVector &pos) { return obj->_getVoxel6DE(pos); };
872 
873  inline static void _setVoxel1DCB (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel1D(pos, voxVal); };
874  inline static void _setVoxel2DCB (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel2D(pos, voxVal); };
875  inline static void _setVoxel3DCB (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel3D(pos, voxVal); };
876  inline static void _setVoxel4DCB (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel4D(pos, voxVal); };
877  inline static void _setVoxel5DCB (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel5D(pos, voxVal); };
878  inline static void _setVoxel6DCB (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel6D(pos, voxVal); };
879 
880  inline static void _setVoxel1DCBE (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel1DE(pos, voxVal); };
881  inline static void _setVoxel2DCBE (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel2DE(pos, voxVal); };
882  inline static void _setVoxel3DCBE (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel3DE(pos, voxVal); };
883  inline static void _setVoxel4DCBE (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel4DE(pos, voxVal); };
884  inline static void _setVoxel5DCBE (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel5DE(pos, voxVal); };
885  inline static void _setVoxel6DCBE (TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel6DE(pos, voxVal); };
886 
887  inline static bool _isMapped1DCB (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped1D (pos); }
888  inline static bool _isMapped2DCB (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped2D (pos); };
889  inline static bool _isMapped3DCB (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped3D (pos); };
890  inline static bool _isMapped4DCB (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped4D (pos); };
891  inline static bool _isMapped5DCB (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped5D (pos); };
892  inline static bool _isMapped6DCB (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped6D (pos); };
893 
894  inline static bool _isMapped1DCBE (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped1DE(pos); };
895  inline static bool _isMapped2DCBE (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped2DE(pos); };
896  inline static bool _isMapped3DCBE (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped3DE(pos); };
897  inline static bool _isMapped4DCBE (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped4DE(pos); };
898  inline static bool _isMapped5DCBE (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped5DE(pos); };
899  inline static bool _isMapped6DCBE (const TVirtualVolume *obj, const ImageVector &pos) { return obj->_isMapped6DE(pos); };
901 
902 
903 
904  //----------------------------------------------------------------------------------
905  //----------------------------------------------------------------------------------
907  //----------------------------------------------------------------------------------
908  //----------------------------------------------------------------------------------
909 
910  //----------------------------------------------------------------------------------
912  //----------------------------------------------------------------------------------
914  inline void _setCursorPos1D (const ImageVector & p);
915  inline void _setCursorPos2D (const ImageVector & p);
916  inline void _setCursorPos3D (const ImageVector & p);
917  inline void _setCursorPos4D (const ImageVector & p);
918  inline void _setCursorPos5D (const ImageVector & p);
919  inline void _setCursorPos6D (const ImageVector & p);
920 
921  inline void _setCursorPos1DE(const ImageVector & p);
922  inline void _setCursorPos2DE(const ImageVector & p);
923  inline void _setCursorPos3DE(const ImageVector & p);
924  inline void _setCursorPos4DE(const ImageVector & p);
925  inline void _setCursorPos5DE(const ImageVector & p);
926  inline void _setCursorPos6DE(const ImageVector & p);
928 
929  //--------------------------------------------------------------------------------------------------------------------------
931  //--------------------------------------------------------------------------------------------------------------------------
933  inline static void _setCursorPos1DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos1D(p); };
934  inline static void _setCursorPos2DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos2D(p); };
935  inline static void _setCursorPos3DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos3D(p); };
936  inline static void _setCursorPos4DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos4D(p); };
937  inline static void _setCursorPos5DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos5D(p); };
938  inline static void _setCursorPos6DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos6D(p); };
939 
940  inline static void _setCursorPos1DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos1DE(p); };
941  inline static void _setCursorPos2DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos2DE(p); };
942  inline static void _setCursorPos3DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos3DE(p); };
943  inline static void _setCursorPos4DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos4DE(p); };
944  inline static void _setCursorPos5DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos5DE(p); };
945  inline static void _setCursorPos6DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_setCursorPos6DE(p); };
947 
948 
949  //----------------------------------------------------------------------------------
950  //----------------------------------------------------------------------------------
952  //----------------------------------------------------------------------------------
953  //----------------------------------------------------------------------------------
954 
955  //----------------------------------------------------------------------------------
957  //----------------------------------------------------------------------------------
959  inline void _moveCursorOffset1D (const ImageVector & p);
960  inline void _moveCursorOffset2D (const ImageVector & p);
961  inline void _moveCursorOffset3D (const ImageVector & p);
962  inline void _moveCursorOffset4D (const ImageVector & p);
963  inline void _moveCursorOffset5D (const ImageVector & p);
964  inline void _moveCursorOffset6D (const ImageVector & p);
965 
966  inline void _moveCursorOffset1DE(const ImageVector & p);
967  inline void _moveCursorOffset2DE(const ImageVector & p);
968  inline void _moveCursorOffset3DE(const ImageVector & p);
969  inline void _moveCursorOffset4DE(const ImageVector & p);
970  inline void _moveCursorOffset5DE(const ImageVector & p);
971  inline void _moveCursorOffset6DE(const ImageVector & p);
973 
974  //--------------------------------------------------------------------------------------------------------------------------
976  //--------------------------------------------------------------------------------------------------------------------------
978  inline static void _moveCursorOffset1DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset1D(p); };
979  inline static void _moveCursorOffset2DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset2D(p); };
980  inline static void _moveCursorOffset3DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset3D(p); };
981  inline static void _moveCursorOffset4DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset4D(p); };
982  inline static void _moveCursorOffset5DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset5D(p); };
983  inline static void _moveCursorOffset6DCB (TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset6D(p); };
984 
985  inline static void _moveCursorOffset1DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset1DE(p); };
986  inline static void _moveCursorOffset2DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset2DE(p); };
987  inline static void _moveCursorOffset3DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset3DE(p); };
988  inline static void _moveCursorOffset4DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset4DE(p); };
989  inline static void _moveCursorOffset5DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset5DE(p); };
990  inline static void _moveCursorOffset6DCBE(TVirtualVolume *obj, const ImageVector &p) { obj->_moveCursorOffset6DE(p); };
992 
993 
994  //----------------------------------------------------------------------------------
995  //----------------------------------------------------------------------------------
997  //----------------------------------------------------------------------------------
998  //----------------------------------------------------------------------------------
999 
1000  // In the following sections multiple expressions such as
1001  // _cIdx -= static_cast<MLuint>(_pStrides.x);
1002  // are performed with casts to unsigned MLuint64 values, because according to C-standard
1003  // the signed values are cast to unsigned int 64 before subtracting anyway; and this
1004  // which is warned by compilers.
1005  // Therefore the cast is done explicitly, which is okay, when considering that negative
1006  // signed values are cast, converted to usually large unsigned values which are added
1007  // with overflows resulting to the same value.
1008 
1009 
1010  //--------------------------------------------------------------------------------------------------------------------------
1012  //--------------------------------------------------------------------------------------------------------------------------
1014  // See notes about casts at line 1000.
1015  inline void _moveFX() { _cPos.x++; _cIdx += static_cast<MLuint>(_pStrides.x); if ((_cPos.x & _idxMask.x) == 0){ _cPageIdx += static_cast<MLuint>(_strides.x); } }
1016  inline void _moveFY() { _cPos.y++; _cIdx += static_cast<MLuint>(_pStrides.y); if ((_cPos.y & _idxMask.y) == 0){ _cPageIdx += static_cast<MLuint>(_strides.y); } }
1017  inline void _moveFZ() { _cPos.z++; _cIdx += static_cast<MLuint>(_pStrides.z); if ((_cPos.z & _idxMask.z) == 0){ _cPageIdx += static_cast<MLuint>(_strides.z); } }
1018  inline void _moveFC() { _cPos.c++; _cIdx += static_cast<MLuint>(_pStrides.c); if ((_cPos.c & _idxMask.c) == 0){ _cPageIdx += static_cast<MLuint>(_strides.c); } }
1019  inline void _moveFT() { _cPos.t++; _cIdx += static_cast<MLuint>(_pStrides.t); if ((_cPos.t & _idxMask.t) == 0){ _cPageIdx += static_cast<MLuint>(_strides.t); } }
1020  inline void _moveFU() { _cPos.u++; _cIdx += static_cast<MLuint>(_pStrides.u); if ((_cPos.u & _idxMask.u) == 0){ _cPageIdx += static_cast<MLuint>(_strides.u); } }
1021 
1022  inline void _moveFXE() { if (_cPos.x < _extD.x){ _moveFX(); } else{ throw(ML_OUT_OF_RANGE); } }
1023  inline void _moveFYE() { if (_cPos.y < _extD.y){ _moveFY(); } else{ throw(ML_OUT_OF_RANGE); } }
1024  inline void _moveFZE() { if (_cPos.z < _extD.z){ _moveFZ(); } else{ throw(ML_OUT_OF_RANGE); } }
1025  inline void _moveFCE() { if (_cPos.c < _extD.c){ _moveFC(); } else{ throw(ML_OUT_OF_RANGE); } }
1026  inline void _moveFTE() { if (_cPos.t < _extD.t){ _moveFT(); } else{ throw(ML_OUT_OF_RANGE); } }
1027  inline void _moveFUE() { if (_cPos.u < _extD.u){ _moveFU(); } else{ throw(ML_OUT_OF_RANGE); } }
1029 
1030  //--------------------------------------------------------------------------------------------------------------------------
1032  //--------------------------------------------------------------------------------------------------------------------------
1034  inline static void _moveFXCB (TVirtualVolume *obj) { obj->_moveFX(); }
1035  inline static void _moveFYCB (TVirtualVolume *obj) { obj->_moveFY(); }
1036  inline static void _moveFZCB (TVirtualVolume *obj) { obj->_moveFZ(); }
1037  inline static void _moveFCCB (TVirtualVolume *obj) { obj->_moveFC(); }
1038  inline static void _moveFTCB (TVirtualVolume *obj) { obj->_moveFT(); }
1039  inline static void _moveFUCB (TVirtualVolume *obj) { obj->_moveFU(); }
1040 
1041  inline static void _moveFXCBE(TVirtualVolume *obj) { obj->_moveFXE(); }
1042  inline static void _moveFYCBE(TVirtualVolume *obj) { obj->_moveFYE(); }
1043  inline static void _moveFZCBE(TVirtualVolume *obj) { obj->_moveFZE(); }
1044  inline static void _moveFCCBE(TVirtualVolume *obj) { obj->_moveFCE(); }
1045  inline static void _moveFTCBE(TVirtualVolume *obj) { obj->_moveFTE(); }
1046  inline static void _moveFUCBE(TVirtualVolume *obj) { obj->_moveFUE(); }
1048 
1049  //--------------------------------------------------------------------------------------------------------------------------
1051  //--------------------------------------------------------------------------------------------------------------------------
1053  // See notes about casts at line 1000.
1054  inline void _moveBX() { _cPos.x--; _cIdx -= static_cast<MLuint>(_pStrides.x); if ((_cPos.x & _idxMask.x) == _idxMask.x){ _cPageIdx -= static_cast<MLuint>(_strides.x); } }
1055  inline void _moveBY() { _cPos.y--; _cIdx -= static_cast<MLuint>(_pStrides.y); if ((_cPos.y & _idxMask.y) == _idxMask.y){ _cPageIdx -= static_cast<MLuint>(_strides.y); } }
1056  inline void _moveBZ() { _cPos.z--; _cIdx -= static_cast<MLuint>(_pStrides.z); if ((_cPos.z & _idxMask.z) == _idxMask.z){ _cPageIdx -= static_cast<MLuint>(_strides.z); } }
1057  inline void _moveBC() { _cPos.c--; _cIdx -= static_cast<MLuint>(_pStrides.c); if ((_cPos.c & _idxMask.c) == _idxMask.c){ _cPageIdx -= static_cast<MLuint>(_strides.c); } }
1058  inline void _moveBT() { _cPos.t--; _cIdx -= static_cast<MLuint>(_pStrides.t); if ((_cPos.t & _idxMask.t) == _idxMask.t){ _cPageIdx -= static_cast<MLuint>(_strides.t); } }
1059  inline void _moveBU() { _cPos.u--; _cIdx -= static_cast<MLuint>(_pStrides.u); if ((_cPos.u & _idxMask.u) == _idxMask.u){ _cPageIdx -= static_cast<MLuint>(_strides.u); } }
1060 
1063 #define _VV_MOVEBE_TEST(Q) if (_cPos.Q >= 0){ _cPageIdx -= static_cast<MLuint>(_strides.Q); } \
1064  else{ _cPos.Q++; _cIdx += static_cast<MLuint>(_pStrides.Q); throw(ML_OUT_OF_RANGE); }
1065 
1066  // See notes about casts at line 1000.
1067  inline void _moveBXE() { _cPos.x--; _cIdx -= static_cast<MLuint>(_pStrides.x); if ((_cPos.x & _idxMask.x) == _idxMask.x){ _VV_MOVEBE_TEST(x); } }
1068  inline void _moveBYE() { _cPos.y--; _cIdx -= static_cast<MLuint>(_pStrides.y); if ((_cPos.y & _idxMask.y) == _idxMask.y){ _VV_MOVEBE_TEST(y); } }
1069  inline void _moveBZE() { _cPos.z--; _cIdx -= static_cast<MLuint>(_pStrides.z); if ((_cPos.z & _idxMask.z) == _idxMask.z){ _VV_MOVEBE_TEST(z); } }
1070  inline void _moveBCE() { _cPos.c--; _cIdx -= static_cast<MLuint>(_pStrides.c); if ((_cPos.c & _idxMask.c) == _idxMask.c){ _VV_MOVEBE_TEST(c); } }
1071  inline void _moveBTE() { _cPos.t--; _cIdx -= static_cast<MLuint>(_pStrides.t); if ((_cPos.t & _idxMask.t) == _idxMask.t){ _VV_MOVEBE_TEST(t); } }
1072  inline void _moveBUE() { _cPos.u--; _cIdx -= static_cast<MLuint>(_pStrides.u); if ((_cPos.u & _idxMask.u) == _idxMask.u){ _VV_MOVEBE_TEST(u); } }
1073 #undef _VV_MOVEBE_TEST
1075 
1076 
1077 
1078  //--------------------------------------------------------------------------------------------------------------------------
1080  //--------------------------------------------------------------------------------------------------------------------------
1082  inline static void _moveBXCB (TVirtualVolume *obj) { obj->_moveBX(); }
1083  inline static void _moveBYCB (TVirtualVolume *obj) { obj->_moveBY(); }
1084  inline static void _moveBZCB (TVirtualVolume *obj) { obj->_moveBZ(); }
1085  inline static void _moveBCCB (TVirtualVolume *obj) { obj->_moveBC(); }
1086  inline static void _moveBTCB (TVirtualVolume *obj) { obj->_moveBT(); }
1087  inline static void _moveBUCB (TVirtualVolume *obj) { obj->_moveBU(); }
1088 
1089  inline static void _moveBXCBE(TVirtualVolume *obj) { obj->_moveBXE(); }
1090  inline static void _moveBYCBE(TVirtualVolume *obj) { obj->_moveBYE(); }
1091  inline static void _moveBZCBE(TVirtualVolume *obj) { obj->_moveBZE(); }
1092  inline static void _moveBCCBE(TVirtualVolume *obj) { obj->_moveBCE(); }
1093  inline static void _moveBTCBE(TVirtualVolume *obj) { obj->_moveBTE(); }
1094  inline static void _moveBUCBE(TVirtualVolume *obj) { obj->_moveBUE(); }
1096 
1097 
1098 
1099 private:
1100 
1102  typedef DATATYPE (*GetVoxelFunc) (TVirtualVolume *obj, const ImageVector &p);
1103 
1105  typedef void (*SetVoxelFunc) (TVirtualVolume *obj, const ImageVector &p, DATATYPE voxVal);
1106 
1108  typedef bool (*IsMappedFunc) (const TVirtualVolume *obj, const ImageVector &p);
1109 
1111  typedef void (*SetCursorPosFunc) (TVirtualVolume *obj, const ImageVector &p);
1112 
1114  typedef void (*MoveCursorOffsetFunc)(TVirtualVolume *obj, const ImageVector &p);
1115 
1117  typedef void (*MoveCursorPosFunc) (TVirtualVolume *obj);
1118 
1122  VirtualVolume *_convenienceInstance;
1123 
1125  VirtualVolume *_virtVol;
1126 
1128  ImageVector _ext;
1129 
1131  ImageVector _extD;
1132 
1134  PageBuffer *_pageArray;
1135 
1138  ImageVector _rShift;
1139 
1141  ImageVector _strides;
1142 
1144  ImageVector _pStrides;
1145 
1147  ImageVector _idxMask;
1148 
1150  GetVoxelFunc _getVoxelFunc;
1151 
1153  SetVoxelFunc _setVoxelFunc;
1154 
1156  IsMappedFunc _isMappedFunc;
1157 
1159  SetCursorPosFunc _setCursorPosFunc;
1160 
1162  MoveCursorOffsetFunc _moveCursorOffsetFunc;
1163 
1166  MoveCursorPosFunc _moveFXFunc;
1167  MoveCursorPosFunc _moveFYFunc;
1168  MoveCursorPosFunc _moveFZFunc;
1169  MoveCursorPosFunc _moveFCFunc;
1170  MoveCursorPosFunc _moveFTFunc;
1171  MoveCursorPosFunc _moveFUFunc;
1172 
1173  MoveCursorPosFunc _moveBXFunc;
1174  MoveCursorPosFunc _moveBYFunc;
1175  MoveCursorPosFunc _moveBZFunc;
1176  MoveCursorPosFunc _moveBCFunc;
1177  MoveCursorPosFunc _moveBTFunc;
1178  MoveCursorPosFunc _moveBUFunc;
1180 
1182  ImageVector _cPos;
1183 
1185  MLuint _cPageIdx;
1186 
1188  MLuint _cIdx;
1189 
1191  bool _useExc;
1192 };
1193 
1194 //--------------------------------------------------------------------------------------------------------
1195 // END OF USER INTERFACE
1196 //--------------------------------------------------------------------------------------------------------
1197 
1198 
1199 
1200 
1201 
1202 //--------------------------------------------------------------------------------------------------------
1203 //--------------------------------------------------------------------------------------------------------
1204 // Implementation part of Virtual Volume.
1205 //--------------------------------------------------------------------------------------------------------
1206 //--------------------------------------------------------------------------------------------------------
1207 
1208 template <typename DATATYPE>
1209 inline void TVirtualVolume<DATATYPE>::getValues(const ImageVector *pos, DATATYPE *results, MLuint num)
1210 {
1211  for (MLuint c=0; c < num; c++){
1212  *results = _getVoxelFunc(this, *pos);
1213  results++;
1214  pos++;
1215  }
1216 }
1217 
1218 template <typename DATATYPE>
1220 {
1221  PageBuffer *page = _pageArray + _cPageIdx;
1222  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[_cIdx] = val;
1223  page->_locked = true;
1224 }
1225 
1227 template <typename DATATYPE>
1229 {
1230  PageBuffer *page = _pageArray + _cPageIdx;
1231  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[_cIdx];
1232 }
1233 
1235 template <typename DATATYPE>
1237 {
1238  static const ImageVector zeroPos(0);
1239  _setCursorPosFunc(this, zeroPos);
1240 }
1241 
1251 template <typename DATATYPE>
1253 {
1254  if (_cPos.x < _extD.x){ _moveFXFunc(this); return true; }
1255  else{
1256  if (_cPos.y < _extD.y){ _moveFYFunc(this); }
1257  else{
1258  if (_cPos.z < _extD.z){ _moveFZFunc(this); }
1259  else{
1260  if (_cPos.c < _extD.c){ _moveFCFunc(this); }
1261  else{
1262  if (_cPos.t < _extD.t){ _moveFTFunc(this); }
1263  else{
1264  if (_cPos.u < _extD.u){ _moveFUFunc(this); }
1265  else{
1266  // Just return false but do not move cursor any
1267  // further. This makes loops much easier.
1268  return false;
1269  }
1270  _cPos.t = 0;
1271  }
1272  _cPos.c = 0;
1273  }
1274  _cPos.z = 0;
1275  }
1276  _cPos.y = 0;
1277  }
1278  _cPos.x = 0;
1279 
1280  // Cursor position has been reset in any component. Update settings.
1281  _setCursorPosFunc(this, _cPos);
1282  return true;
1283  }
1284 }
1285 
1287 template <typename DATATYPE>
1288 void TVirtualVolume<DATATYPE>::fill(const SubImageBox &box, DATATYPE value)
1289 {
1290  // Restrict size of filled area to valid image regions.
1291  SubImageBox subImgBox = SubImageBox::intersect(box, _virtVol->getBox());
1292 
1293  // Note: Future versions could optimise inner loop significantly
1294  // by filling complete rows in pages with memcpy statements
1295  // from a prefilled row (or even by using subimage copies
1296  // from a prefilled page if many pages are filled).
1297  ImageVector p;
1298  for (p.u=subImgBox.v1.u; p.u<=subImgBox.v2.u; p.u++){
1299  for (p.t=subImgBox.v1.t; p.t<=subImgBox.v2.t; p.t++){
1300  for (p.c=subImgBox.v1.c; p.c<=subImgBox.v2.c; p.c++){
1301  for (p.z=subImgBox.v1.z; p.z<=subImgBox.v2.z; p.z++){
1302  for (p.y=subImgBox.v1.y; p.y<=subImgBox.v2.y; p.y++){
1303  for (p.x=subImgBox.v1.x; p.x<=subImgBox.v2.x; p.x++){
1304  setValue(p, value);
1305  } // x
1306  }
1307  }
1308  }
1309  }
1310  } // u
1311 }
1312 
1313 //-----------------------------------------------------------------------------------------------
1315 //-----------------------------------------------------------------------------------------------
1316 template <typename DATATYPE>
1318 {
1319  _virtVol->copyToSubImage(outSubImg);
1320 }
1321 
1322 //-----------------------------------------------------------------------------------------------
1324 //-----------------------------------------------------------------------------------------------
1325 template <typename DATATYPE>
1327 {
1328  // Get extents of subImg as box.
1329  SubImageBox inBox = inImg.getBoxFromImageExtent();
1330 
1331  // Determine valid area in inImg which can be copied (overlap of inBox and box).
1332  // (Source area)
1333  SubImageBox srcBox = SubImageBox::intersect(inBox, box);
1334 
1335  // Get extents of virtualVolume as box.
1336  SubImageBox vvBox = _virtVol->getBox();
1337 
1338  // Determine the area where srcBox is copied to.
1339  SubImageBox tvvBox;
1340  tvvBox.v1 = srcBox.v1 + pos;
1341  tvvBox.v2 = srcBox.v2 + pos;
1342 
1343  // Restrict tvvBox to valid virtualVolume extents. (Destination area)
1344  SubImageBox dstBox = SubImageBox::intersect(vvBox, tvvBox);
1345 
1346  // Iterate over all voxels of the destination area in the virtual volume.
1347  ImageVector dPos, sPos;
1348  for (dPos.u=dstBox.v1.u, sPos.u = srcBox.v1.u; dPos.u<=dstBox.v2.u; dPos.u++, sPos.u++){
1349  for (dPos.t=dstBox.v1.t, sPos.t = srcBox.v1.t; dPos.t<=dstBox.v2.t; dPos.t++, sPos.t++){
1350  for (dPos.c=dstBox.v1.c, sPos.c = srcBox.v1.c; dPos.c<=dstBox.v2.c; dPos.c++, sPos.c++){
1351  for (dPos.z=dstBox.v1.z, sPos.z = srcBox.v1.z; dPos.z<=dstBox.v2.z; dPos.z++, sPos.z++){
1352  for (dPos.y=dstBox.v1.y, sPos.y = srcBox.v1.y; dPos.y<=dstBox.v2.y; dPos.y++, sPos.y++){
1353  for (dPos.x=dstBox.v1.x, sPos.x = srcBox.v1.x; dPos.x<=dstBox.v2.x; dPos.x++, sPos.x++){
1354  setValue(dPos, inImg.getSubImageValue(sPos));
1355  } // x
1356  }
1357  }
1358  }
1359  }
1360  } // u
1361 }
1362 
1366 template <typename DATATYPE>
1368 {
1369  // To avoid a typical programming error force a fatal error if the template data type
1370  // does not match the virtual volume data type.
1371  if (vVol.getDataType() != MLGetDataTypeFromPtr(static_cast<DATATYPE*>(nullptr))){
1372  ML_PRINT_FATAL_ERROR("TVirtualVolume<DATATYPE>::_init()", ML_BAD_DATA_TYPE,
1373  "Mismatch of data type of virtual volume and template typename");
1374  }
1375 
1376  // Get some parameters from virtual volume instance.
1377  // _convenienceInstance = ...; // Must be initialized in all constructors before.
1378  _virtVol = &vVol;
1379  _ext = vVol._origVolumeExt;
1380  _extD = vVol._origVolumeExt-ImageVector(1);
1381  _pageArray = vVol._pageArray;
1382  _rShift = vVol._rShift;
1383  _strides = vVol._strides;
1384  _pStrides = vVol._pStrides;
1385  _idxMask = vVol._idxMask;
1386  _useExc = vVol._areExceptionsOn;
1387 
1388  // Set cursor position, cursor index and cursor page.
1389  _cPos = ImageVector(0);
1390  _cIdx = 0;
1391  _cPageIdx = 0;
1392 
1393  // Dependent on the dimension of the image we can select different read/write
1394  // functions. We do this to avoid unnecessary calculations of 6d coordinates
1395  // if the volume has only e.g. 2 dimensions.
1396  if (_useExc){
1397 
1399  _moveFXFunc = _moveFXCBE;
1400  _moveFYFunc = _moveFYCBE;
1401  _moveFZFunc = _moveFZCBE;
1402  _moveFCFunc = _moveFCCBE;
1403  _moveFTFunc = _moveFTCBE;
1404  _moveFUFunc = _moveFUCBE;
1405 
1406  _moveBXFunc = _moveBXCBE;
1407  _moveBYFunc = _moveBYCBE;
1408  _moveBZFunc = _moveBZCBE;
1409  _moveBCFunc = _moveBCCBE;
1410  _moveBTFunc = _moveBTCBE;
1411  _moveBUFunc = _moveBUCBE;
1412 
1413  // Set the correct setValue/getValue and setCursorPosition functions.
1414  switch (vVol.getDim()){
1415  case 1:
1416  _getVoxelFunc = _getVoxel1DCBE;
1417  _setVoxelFunc = _setVoxel1DCBE;
1418  _setCursorPosFunc = _setCursorPos1DCBE;
1419  _moveCursorOffsetFunc = _moveCursorOffset1DCBE;
1420  _isMappedFunc = _isMapped1DCBE;
1421  break;
1422  case 2:
1423  _getVoxelFunc = _getVoxel2DCBE;
1424  _setVoxelFunc = _setVoxel2DCBE;
1425  _setCursorPosFunc = _setCursorPos2DCBE;
1426  _moveCursorOffsetFunc = _moveCursorOffset2DCBE;
1427  _isMappedFunc = _isMapped2DCBE;
1428  break;
1429  case 3:
1430  _getVoxelFunc = _getVoxel3DCBE;
1431  _setVoxelFunc = _setVoxel3DCBE;
1432  _setCursorPosFunc = _setCursorPos3DCBE;
1433  _moveCursorOffsetFunc = _moveCursorOffset3DCBE;
1434  _isMappedFunc = _isMapped3DCBE;
1435  break;
1436  case 4:
1437  _getVoxelFunc = _getVoxel4DCBE;
1438  _setVoxelFunc = _setVoxel4DCBE;
1439  _setCursorPosFunc = _setCursorPos4DCBE;
1440  _moveCursorOffsetFunc = _moveCursorOffset4DCBE;
1441  _isMappedFunc = _isMapped4DCBE;
1442  break;
1443  case 5:
1444  _getVoxelFunc = _getVoxel5DCBE;
1445  _setVoxelFunc = _setVoxel5DCBE;
1446  _setCursorPosFunc = _setCursorPos5DCBE;
1447  _moveCursorOffsetFunc = _moveCursorOffset5DCBE;
1448  _isMappedFunc = _isMapped5DCBE;
1449  break;
1450  case 6:
1451  _getVoxelFunc = _getVoxel6DCBE;
1452  _setVoxelFunc = _setVoxel6DCBE;
1453  _setCursorPosFunc = _setCursorPos6DCBE;
1454  _moveCursorOffsetFunc = _moveCursorOffset6DCBE;
1455  _isMappedFunc = _isMapped6DCBE;
1456  break;
1457  default:
1458  _getVoxelFunc = _getVoxel6DCBE;
1459  _setVoxelFunc = _setVoxel6DCBE;
1460  _moveCursorOffsetFunc = _moveCursorOffset6DCBE;
1461  _setCursorPosFunc = _setCursorPos6DCBE;
1462  _isMappedFunc = _isMapped6DCBE;
1463  _virtVol->invalidate();
1464  throw(ML_BAD_DIMENSION);
1465  break;
1466  }
1467  }
1468  else{
1469 
1471  _moveFXFunc = _moveFXCB;
1472  _moveFYFunc = _moveFYCB;
1473  _moveFZFunc = _moveFZCB;
1474  _moveFCFunc = _moveFCCB;
1475  _moveFTFunc = _moveFTCB;
1476  _moveFUFunc = _moveFUCB;
1477 
1478  _moveBXFunc = _moveBXCB;
1479  _moveBYFunc = _moveBYCB;
1480  _moveBZFunc = _moveBZCB;
1481  _moveBCFunc = _moveBCCB;
1482  _moveBTFunc = _moveBTCB;
1483  _moveBUFunc = _moveBUCB;
1484 
1485  // Set the correct setValue/getValue and setCursorPosition functions.
1486  switch (vVol.getDim()){
1487  case 1:
1488  _getVoxelFunc = _getVoxel1DCB;
1489  _setVoxelFunc = _setVoxel1DCB;
1490  _setCursorPosFunc = _setCursorPos1DCB;
1491  _moveCursorOffsetFunc = _moveCursorOffset1DCB;
1492  _isMappedFunc = _isMapped1DCB;
1493  break;
1494  case 2:
1495  _getVoxelFunc = _getVoxel2DCB;
1496  _setVoxelFunc = _setVoxel2DCB;
1497  _setCursorPosFunc = _setCursorPos2DCB;
1498  _moveCursorOffsetFunc = _moveCursorOffset2DCB;
1499  _isMappedFunc = _isMapped2DCB;
1500  break;
1501  case 3:
1502  _getVoxelFunc = _getVoxel3DCB;
1503  _setVoxelFunc = _setVoxel3DCB;
1504  _setCursorPosFunc = _setCursorPos3DCB;
1505  _moveCursorOffsetFunc = _moveCursorOffset3DCB;
1506  _isMappedFunc = _isMapped3DCB;
1507  break;
1508  case 4:
1509  _getVoxelFunc = _getVoxel4DCB;
1510  _setVoxelFunc = _setVoxel4DCB;
1511  _setCursorPosFunc = _setCursorPos4DCB;
1512  _moveCursorOffsetFunc = _moveCursorOffset4DCB;
1513  _isMappedFunc = _isMapped4DCB;
1514  break;
1515  case 5:
1516  _getVoxelFunc = _getVoxel5DCB;
1517  _setVoxelFunc = _setVoxel5DCB;
1518  _setCursorPosFunc = _setCursorPos5DCB;
1519  _moveCursorOffsetFunc = _moveCursorOffset5DCB;
1520  _isMappedFunc = _isMapped5DCB;
1521  break;
1522  case 6:
1523  _getVoxelFunc = _getVoxel6DCB;
1524  _setVoxelFunc = _setVoxel6DCB;
1525  _setCursorPosFunc = _setCursorPos6DCB;
1526  _moveCursorOffsetFunc = _moveCursorOffset6DCB;
1527  _isMappedFunc = _isMapped6DCB;
1528  break;
1529  default:
1530  _getVoxelFunc = _getVoxel6DCB;
1531  _setVoxelFunc = _setVoxel6DCB;
1532  _setCursorPosFunc = _setCursorPos6DCB;
1533  _moveCursorOffsetFunc = _moveCursorOffset6DCB;
1534  _isMappedFunc = _isMapped6DCBE;
1535  _virtVol->invalidate();
1536  ML_PRINT_ERROR("TVirtualVolume::_init()", ML_BAD_DIMENSION, "Invalid image dimension. Using dimension 6. \n");
1537  break;
1538  }
1539  }
1540 }
1541 
1543 template <typename DATATYPE>
1545 {
1546  // _convenienceInstance = ...; // Must be handled in destructor explicitly.
1547  _virtVol = nullptr;
1548  _ext = ImageVector(0);
1549  _extD = ImageVector(0);
1550  _pageArray = nullptr;
1551  _rShift = ImageVector(0);
1552  _strides = ImageVector(0);
1553  _pStrides = ImageVector(0);
1554  _getVoxelFunc = nullptr;
1555  _setVoxelFunc = nullptr;
1556  _setCursorPosFunc = nullptr;
1557  _moveCursorOffsetFunc = nullptr;
1558  _isMappedFunc = nullptr;
1559  _moveFXFunc = nullptr;
1560  _moveFYFunc = nullptr;
1561  _moveFZFunc = nullptr;
1562  _moveFCFunc = nullptr;
1563  _moveFTFunc = nullptr;
1564  _moveFUFunc = nullptr;
1565  _moveBXFunc = nullptr;
1566  _moveBYFunc = nullptr;
1567  _moveBZFunc = nullptr;
1568  _moveBCFunc = nullptr;
1569  _moveBTFunc = nullptr;
1570  _moveBUFunc = nullptr;
1571  _idxMask = ImageVector(0);
1572  _cPos = ImageVector(0);
1573  _cIdx = 0;
1574  _cPageIdx = 0;
1575  _useExc = false;
1576 }
1577 
1578 
1579 
1580 //----------------------------------------------------------------------------------------------------------
1581 // GetVoxel
1582 //----------------------------------------------------------------------------------------------------------
1583 
1585 template <typename DATATYPE>
1587 {
1588  PageBuffer * const page = _pageArray + (pos.x >> _rShift.x);
1589  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x];
1590 };
1591 
1593 template <typename DATATYPE>
1595 {
1596  const MLint px = pos.x;
1597  if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
1598  PageBuffer * const page = _pageArray + (px >> _rShift.x);
1599  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px];
1600 };
1601 
1602 
1604 template <typename DATATYPE>
1606 {
1607  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) + (pos.y >> _rShift.y)*_strides.y);
1608  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x+ pos.y*_pStrides.y];
1609 };
1610 
1612 template <typename DATATYPE>
1614 {
1615  const MLint px = pos.x;
1616  const MLint py = pos.y;
1617  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
1618  PageBuffer * const page = _pageArray + ((px >> _rShift.x) + (py >> _rShift.y)*_strides.y);
1619  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px+ py*_pStrides.y];
1620 };
1621 
1622 
1623 
1625 template <typename DATATYPE>
1627 {
1628  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1629  (pos.y >> _rShift.y)*_strides.y +
1630  (pos.z >> _rShift.z)*_strides.z);
1631  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x + pos.y*_pStrides.y + pos.z*_pStrides.z];
1632 };
1633 
1635 template <typename DATATYPE>
1637 {
1638  const MLint px = pos.x;
1639  const MLint py = pos.y;
1640  const MLint pz = pos.z;
1641  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1642  (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
1643  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1644  (py >> _rShift.y)*_strides.y +
1645  (pz >> _rShift.z)*_strides.z);
1646  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px + py*_pStrides.y + pz*_pStrides.z];
1647 };
1648 
1649 
1650 
1652 template <typename DATATYPE>
1654 {
1655  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1656  (pos.y >> _rShift.y)*_strides.y +
1657  (pos.z >> _rShift.z)*_strides.z +
1658  (pos.c >> _rShift.c)*_strides.c);
1659  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
1660  pos.y*_pStrides.y +
1661  pos.z*_pStrides.z +
1662  pos.c*_pStrides.c];
1663 };
1664 
1666 template <typename DATATYPE>
1668 {
1669  const MLint px = pos.x;
1670  const MLint py = pos.y;
1671  const MLint pz = pos.z;
1672  const MLint pc = pos.c;
1673  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1674  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
1675  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1676  (py >> _rShift.y)*_strides.y +
1677  (pz >> _rShift.z)*_strides.z +
1678  (pc >> _rShift.c)*_strides.c);
1679  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
1680  py*_pStrides.y +
1681  pz*_pStrides.z +
1682  pc*_pStrides.c];
1683 };
1684 
1686 template <typename DATATYPE>
1688 {
1689  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1690  (pos.y >> _rShift.y)*_strides.y +
1691  (pos.z >> _rShift.z)*_strides.z +
1692  (pos.c >> _rShift.c)*_strides.c +
1693  (pos.t >> _rShift.t)*_strides.t);
1694  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
1695  pos.y*_pStrides.y +
1696  pos.z*_pStrides.z +
1697  pos.c*_pStrides.c +
1698  pos.t*_pStrides.t];
1699 };
1700 
1702 template <typename DATATYPE>
1704 {
1705  const MLint px = pos.x;
1706  const MLint py = pos.y;
1707  const MLint pz = pos.z;
1708  const MLint pc = pos.c;
1709  const MLint pt = pos.t;
1710  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1711  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
1712  (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
1713  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1714  (py >> _rShift.y)*_strides.y +
1715  (pz >> _rShift.z)*_strides.z +
1716  (pc >> _rShift.c)*_strides.c +
1717  (pt >> _rShift.t)*_strides.t);
1718  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
1719  py*_pStrides.y +
1720  pz*_pStrides.z +
1721  pc*_pStrides.c +
1722  pt*_pStrides.t];
1723 };
1724 
1726 template <typename DATATYPE>
1728 {
1729  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1730  (pos.y >> _rShift.y)*_strides.y +
1731  (pos.z >> _rShift.z)*_strides.z +
1732  (pos.c >> _rShift.c)*_strides.c +
1733  (pos.t >> _rShift.t)*_strides.t +
1734  (pos.u >> _rShift.u)*_strides.u);
1735  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
1736  pos.y*_pStrides.y +
1737  pos.z*_pStrides.z +
1738  pos.c*_pStrides.c +
1739  pos.t*_pStrides.t +
1740  pos.u*_pStrides.u];
1741 };
1742 
1744 template <typename DATATYPE>
1746 {
1747  const MLint px = pos.x;
1748  const MLint py = pos.y;
1749  const MLint pz = pos.z;
1750  const MLint pc = pos.c;
1751  const MLint pt = pos.t;
1752  const MLint pu = pos.u;
1753  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1754  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
1755  (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
1756  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1757  (py >> _rShift.y)*_strides.y +
1758  (pz >> _rShift.z)*_strides.z +
1759  (pc >> _rShift.c)*_strides.c +
1760  (pt >> _rShift.t)*_strides.t +
1761  (pu >> _rShift.u)*_strides.u);
1762  return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
1763  py*_pStrides.y +
1764  pz*_pStrides.z +
1765  pc*_pStrides.c +
1766  pt*_pStrides.t +
1767  pu*_pStrides.u];
1768 };
1769 
1770 
1771 
1772 //----------------------------------------------------------------------------------------------------------
1773 // SetVoxel
1774 //----------------------------------------------------------------------------------------------------------
1775 
1776 
1777 
1779 template <typename DATATYPE>
1780 inline void TVirtualVolume<DATATYPE>::_setVoxel1D(const ImageVector &pos, DATATYPE voxVal)
1781 {
1782  PageBuffer * const page = _pageArray + (pos.x >> _rShift.x);
1783  page->_locked = true;
1784  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x] = voxVal;
1785 };
1786 
1788 template <typename DATATYPE>
1789 inline void TVirtualVolume<DATATYPE>::_setVoxel1DE(const ImageVector &pos, DATATYPE voxVal)
1790 {
1791  const MLint px = pos.x;
1792  if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
1793  PageBuffer * const page = _pageArray + (px >> _rShift.x);
1794  page->_locked = true;
1795  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px] = voxVal;
1796 };
1797 
1798 
1799 
1801 template <typename DATATYPE>
1802 inline void TVirtualVolume<DATATYPE>::_setVoxel2D(const ImageVector &pos, DATATYPE voxVal)
1803 {
1804  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) + (pos.y >> _rShift.y)*_strides.y);
1805  page->_locked = true;
1806  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x + pos.y*_pStrides.y] = voxVal;
1807 };
1808 
1810 template <typename DATATYPE>
1811 inline void TVirtualVolume<DATATYPE>::_setVoxel2DE(const ImageVector &pos, DATATYPE voxVal)
1812 {
1813  const MLint px = pos.x;
1814  const MLint py = pos.y;
1815  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
1816  PageBuffer * const page = _pageArray + ((px >> _rShift.x) + (py >> _rShift.y)*_strides.y);
1817  page->_locked = true;
1818  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px + py*_pStrides.y] = voxVal;
1819 };
1820 
1821 
1822 
1824 template <typename DATATYPE>
1825 inline void TVirtualVolume<DATATYPE>::_setVoxel3D(const ImageVector &pos, DATATYPE voxVal)
1826 {
1827  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1828  (pos.y >> _rShift.y)*_strides.y +
1829  (pos.z >> _rShift.z)*_strides.z);
1830  page->_locked = true;
1831  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x + pos.y*_pStrides.y + pos.z*_pStrides.z] = voxVal;
1832 };
1833 
1835 template <typename DATATYPE>
1836 inline void TVirtualVolume<DATATYPE>::_setVoxel3DE(const ImageVector &pos, DATATYPE voxVal)
1837 {
1838  const MLint px = pos.x;
1839  const MLint py = pos.y;
1840  const MLint pz = pos.z;
1841  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1842  (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
1843  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1844  (py >> _rShift.y)*_strides.y +
1845  (pz >> _rShift.z)*_strides.z);
1846  page->_locked = true;
1847  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px + py*_pStrides.y + pz*_pStrides.z] = voxVal;
1848 };
1849 
1850 
1851 
1853 template <typename DATATYPE>
1854 inline void TVirtualVolume<DATATYPE>::_setVoxel4D(const ImageVector &pos, DATATYPE voxVal)
1855 {
1856  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1857  (pos.y >> _rShift.y)*_strides.y +
1858  (pos.z >> _rShift.z)*_strides.z +
1859  (pos.c >> _rShift.c)*_strides.c);
1860  page->_locked = true;
1861  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
1862  pos.y*_pStrides.y +
1863  pos.z*_pStrides.z +
1864  pos.c*_pStrides.c] = voxVal;
1865 };
1866 
1868 template <typename DATATYPE>
1869 inline void TVirtualVolume<DATATYPE>::_setVoxel4DE(const ImageVector &pos, DATATYPE voxVal)
1870 {
1871  const MLint px = pos.x;
1872  const MLint py = pos.y;
1873  const MLint pz = pos.z;
1874  const MLint pc = pos.c;
1875  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1876  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
1877  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1878  (py >> _rShift.y)*_strides.y +
1879  (pz >> _rShift.z)*_strides.z +
1880  (pc >> _rShift.c)*_strides.c);
1881  page->_locked = true;
1882  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
1883  py*_pStrides.y +
1884  pz*_pStrides.z +
1885  pc*_pStrides.c] = voxVal;
1886 };
1887 
1888 
1889 
1891 template <typename DATATYPE>
1892 inline void TVirtualVolume<DATATYPE>::_setVoxel5D(const ImageVector &pos, DATATYPE voxVal)
1893 {
1894  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1895  (pos.y >> _rShift.y)*_strides.y +
1896  (pos.z >> _rShift.z)*_strides.z +
1897  (pos.c >> _rShift.c)*_strides.c +
1898  (pos.t >> _rShift.t)*_strides.t);
1899  page->_locked = true;
1900  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
1901  pos.y*_pStrides.y +
1902  pos.z*_pStrides.z +
1903  pos.c*_pStrides.c +
1904  pos.t*_pStrides.t] = voxVal;
1905 };
1906 
1908 template <typename DATATYPE>
1909 inline void TVirtualVolume<DATATYPE>::_setVoxel5DE(const ImageVector &pos, DATATYPE voxVal)
1910 {
1911  const MLint px = pos.x;
1912  const MLint py = pos.y;
1913  const MLint pz = pos.z;
1914  const MLint pc = pos.c;
1915  const MLint pt = pos.t;
1916  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1917  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
1918  (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
1919  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1920  (py >> _rShift.y)*_strides.y +
1921  (pz >> _rShift.z)*_strides.z +
1922  (pc >> _rShift.c)*_strides.c +
1923  (pt >> _rShift.t)*_strides.t);
1924  page->_locked = true;
1925  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
1926  py*_pStrides.y +
1927  pz*_pStrides.z +
1928  pc*_pStrides.c +
1929  pt*_pStrides.t] = voxVal;
1930 };
1931 
1932 
1933 
1935 template <typename DATATYPE>
1936 inline void TVirtualVolume<DATATYPE>::_setVoxel6D(const ImageVector &pos, DATATYPE voxVal)
1937 {
1938  PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
1939  (pos.y >> _rShift.y)*_strides.y +
1940  (pos.z >> _rShift.z)*_strides.z +
1941  (pos.c >> _rShift.c)*_strides.c +
1942  (pos.t >> _rShift.t)*_strides.t +
1943  (pos.u >> _rShift.u)*_strides.u);
1944  page->_locked = true;
1945  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
1946  pos.y*_pStrides.y +
1947  pos.z*_pStrides.z +
1948  pos.c*_pStrides.c +
1949  pos.t*_pStrides.t +
1950  pos.u*_pStrides.u] = voxVal;
1951 };
1952 
1954 template <typename DATATYPE>
1955 inline void TVirtualVolume<DATATYPE>::_setVoxel6DE(const ImageVector &pos, DATATYPE voxVal)
1956 {
1957  const MLint px = pos.x;
1958  const MLint py = pos.y;
1959  const MLint pz = pos.z;
1960  const MLint pc = pos.c;
1961  const MLint pt = pos.t;
1962  const MLint pu = pos.u;
1963  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
1964  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
1965  (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
1966  PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
1967  (py >> _rShift.y)*_strides.y +
1968  (pz >> _rShift.z)*_strides.z +
1969  (pc >> _rShift.c)*_strides.c +
1970  (pt >> _rShift.t)*_strides.t +
1971  (pu >> _rShift.u)*_strides.u);
1972  page->_locked = true;
1973  (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
1974  py*_pStrides.y +
1975  pz*_pStrides.z +
1976  pc*_pStrides.c +
1977  pt*_pStrides.t +
1978  pu*_pStrides.u] = voxVal;
1979 };
1980 
1981 
1982 
1983 
1984 //----------------------------------------------------------------------------------------------------------
1985 // SetCursorPos.
1986 //----------------------------------------------------------------------------------------------------------
1987 
1988 
1989 
1991 template <typename DATATYPE>
1993 {
1994  _cPos.x = p.x;
1995  _cIdx = static_cast<MLuint>(p.x);
1996  _cPageIdx = static_cast<MLuint>(p.x >> _rShift.x);
1997 }
1998 
2000 template <typename DATATYPE>
2002 {
2003  const MLint px = pos.x;
2004  if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
2005  _cPos.x = px;
2006  _cIdx = static_cast<MLuint>(px);
2007  _cPageIdx = static_cast<MLuint>(px >> _rShift.x);
2008 }
2009 
2010 
2011 
2013 template <typename DATATYPE>
2015 {
2016  _cPos.x = p.x;
2017  _cPos.y = p.y;
2018  _cIdx = static_cast<MLuint>(p.x + p.y*_pStrides.y);
2019  _cPageIdx = static_cast<MLuint>((p.x >> _rShift.x) +
2020  (p.y >> _rShift.y)*_strides.y);
2021 }
2022 
2024 template <typename DATATYPE>
2026 {
2027  const MLint px = pos.x;
2028  const MLint py = pos.y;
2029  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
2030  _cPos.x = px;
2031  _cPos.y = py;
2032  _cIdx = static_cast<MLuint>(px + py*_pStrides.y);
2033  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2034  (py >> _rShift.y)*_strides.y);
2035 }
2036 
2037 
2038 
2040 template <typename DATATYPE>
2042 {
2043  _cPos.x = p.x;
2044  _cPos.y = p.y;
2045  _cPos.z = p.z;
2046  _cIdx = static_cast<MLuint>(p.x + p.y*_pStrides.y + p.z*_pStrides.z);
2047  _cPageIdx = static_cast<MLuint>((p.x >> _rShift.x) +
2048  (p.y >> _rShift.y)*_strides.y +
2049  (p.z >> _rShift.z)*_strides.z);
2050 }
2051 
2053 template <typename DATATYPE>
2055 {
2056  const MLint px = pos.x;
2057  const MLint py = pos.y;
2058  const MLint pz = pos.z;
2059  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2060  (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
2061  _cPos.x = px;
2062  _cPos.y = py;
2063  _cPos.z = pz;
2064  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z);
2065  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2066  (py >> _rShift.y)*_strides.y +
2067  (pz >> _rShift.z)*_strides.z);
2068 }
2069 
2070 
2071 
2073 template <typename DATATYPE>
2075 {
2076  _cPos.x = p.x;
2077  _cPos.y = p.y;
2078  _cPos.z = p.z;
2079  _cPos.c = p.c;
2080  _cIdx = static_cast<MLuint>(p.x + p.y*_pStrides.y + p.z*_pStrides.z + p.c*_pStrides.c);
2081  _cPageIdx = static_cast<MLuint>((p.x >> _rShift.x) +
2082  (p.y >> _rShift.y)*_strides.y +
2083  (p.z >> _rShift.z)*_strides.z +
2084  (p.c >> _rShift.c)*_strides.c);
2085 }
2086 
2088 template <typename DATATYPE>
2090 {
2091  const MLint px = pos.x;
2092  const MLint py = pos.y;
2093  const MLint pz = pos.z;
2094  const MLint pc = pos.c;
2095  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2096  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
2097  _cPos.x = px;
2098  _cPos.y = py;
2099  _cPos.z = pz;
2100  _cPos.c = pc;
2101  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c);
2102  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2103  (py >> _rShift.y)*_strides.y +
2104  (pz >> _rShift.z)*_strides.z +
2105  (pc >> _rShift.c)*_strides.c);
2106 }
2107 
2108 
2109 
2111 template <typename DATATYPE>
2113 {
2114  // Save cursor position.
2115  _cPos = p;
2116 
2117  // Determine the index to the voxel within the page.
2118  _cIdx = static_cast<MLuint>(p.x + p.y*_pStrides.y + p.z*_pStrides.z + p.c*_pStrides.c + p.t*_pStrides.t);
2119 
2120  // Determine index of the page under the cursor position.
2121  _cPageIdx = static_cast<MLuint>((p.x >> _rShift.x) +
2122  (p.y >> _rShift.y)*_strides.y +
2123  (p.z >> _rShift.z)*_strides.z +
2124  (p.c >> _rShift.c)*_strides.c +
2125  (p.t >> _rShift.t)*_strides.t);
2126 }
2127 
2129 template <typename DATATYPE>
2131 {
2132  const MLint px = pos.x;
2133  const MLint py = pos.y;
2134  const MLint pz = pos.z;
2135  const MLint pc = pos.c;
2136  const MLint pt = pos.t;
2137  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2138  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
2139  (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
2140 
2141  // Save cursor position.
2142  _cPos = pos;
2143 
2144  // Determine the index to the voxel within the page.
2145  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c + pt*_pStrides.t);
2146 
2147  // Determine index of the page under the cursor position.
2148  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2149  (py >> _rShift.y)*_strides.y +
2150  (pz >> _rShift.z)*_strides.z +
2151  (pc >> _rShift.c)*_strides.c +
2152  (pt >> _rShift.t)*_strides.t);
2153 }
2154 
2155 
2156 
2158 template <typename DATATYPE>
2160 {
2161  // Save cursor position.
2162  _cPos = p;
2163 
2164  // Determine the index to the voxel within the page.
2165  _cIdx = static_cast<MLuint>(p.x + p.y*_pStrides.y + p.z*_pStrides.z +
2166  p.c*_pStrides.c + p.t*_pStrides.t + p.u*_pStrides.u);
2167 
2168  // Determine index of the page under the cursor position.
2169  _cPageIdx = static_cast<MLuint>((p.x >> _rShift.x) +
2170  (p.y >> _rShift.y)*_strides.y +
2171  (p.z >> _rShift.z)*_strides.z +
2172  (p.c >> _rShift.c)*_strides.c +
2173  (p.t >> _rShift.t)*_strides.t +
2174  (p.u >> _rShift.u)*_strides.u);
2175 }
2176 
2178 template <typename DATATYPE>
2180 {
2181  const MLint px = pos.x;
2182  const MLint py = pos.y;
2183  const MLint pz = pos.z;
2184  const MLint pc = pos.c;
2185  const MLint pt = pos.t;
2186  const MLint pu = pos.u;
2187  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2188  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
2189  (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
2190 
2191  // Save cursor position.
2192  _cPos = pos;
2193 
2194  // Determine the index to the voxel within the page.
2195  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z +
2196  pc*_pStrides.c + pt*_pStrides.t + pu*_pStrides.u);
2197 
2198  // Determine index of the page under the cursor position.
2199  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2200  (py >> _rShift.y)*_strides.y +
2201  (pz >> _rShift.z)*_strides.z +
2202  (pc >> _rShift.c)*_strides.c +
2203  (pt >> _rShift.t)*_strides.t +
2204  (pu >> _rShift.u)*_strides.u);
2205 }
2206 
2207 
2208 
2209 
2210 //----------------------------------------------------------------------------------------------------------
2211 // MoveCursorOffset
2212 //----------------------------------------------------------------------------------------------------------
2213 
2214 
2215 
2217 template <typename DATATYPE>
2219 {
2220  _cPos.x += off.x;
2221  _cIdx = static_cast<MLuint>(_cPos.x);
2222  _cPageIdx = static_cast<MLuint>(_cPos.x >> _rShift.x);
2223 }
2224 
2226 template <typename DATATYPE>
2228 {
2229  const MLint px = _cPos.x + off.x;
2230  if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
2231  _cPos.x = px;
2232  _cIdx = static_cast<MLuint>(px);
2233  _cPageIdx = static_cast<MLuint>(px >> _rShift.x);
2234 }
2235 
2236 
2237 
2239 template <typename DATATYPE>
2241 {
2242  _cPos.x += off.x;
2243  _cPos.y += off.y;
2244  _cIdx = static_cast<MLuint>(_cPos.x + _cPos.y*_pStrides.y);
2245  _cPageIdx = static_cast<MLuint>((_cPos.x >> _rShift.x) + (_cPos.y >> _rShift.y)*_strides.y);
2246 }
2247 
2249 template <typename DATATYPE>
2251 {
2252  const MLint px = _cPos.x + off.x;
2253  const MLint py = _cPos.y + off.y;
2254  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
2255  _cPos.x = px;
2256  _cPos.y = py;
2257  _cIdx = static_cast<MLuint>(px + py*_pStrides.y);
2258  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) + (py >> _rShift.y)*_strides.y);
2259 }
2260 
2261 
2262 
2264 template <typename DATATYPE>
2266 {
2267  _cPos.x += off.x;
2268  _cPos.y += off.y;
2269  _cPos.z += off.z;
2270  _cIdx = static_cast<MLuint>(_cPos.x + _cPos.y*_pStrides.y + _cPos.z*_pStrides.z);
2271  _cPageIdx = static_cast<MLuint>((_cPos.x >> _rShift.x) +
2272  (_cPos.y >> _rShift.y)*_strides.y +
2273  (_cPos.z >> _rShift.z)*_strides.z);
2274 }
2275 
2277 template <typename DATATYPE>
2279 {
2280  const MLint px = _cPos.x+off.x;
2281  const MLint py = _cPos.y+off.y;
2282  const MLint pz = _cPos.z+off.z;
2283  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2284  (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
2285  _cPos.x = px;
2286  _cPos.y = py;
2287  _cPos.z = pz;
2288  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z);
2289  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2290  (py >> _rShift.y)*_strides.y +
2291  (pz >> _rShift.z)*_strides.z);
2292 }
2293 
2294 
2295 
2297 template <typename DATATYPE>
2299 {
2300  _cPos.x += off.x;
2301  _cPos.y += off.y;
2302  _cPos.z += off.z;
2303  _cPos.c += off.c;
2304  _cIdx = static_cast<MLuint>(_cPos.x + _cPos.y*_pStrides.y + _cPos.z*_pStrides.z + _cPos.c*_pStrides.c);
2305  _cPageIdx = static_cast<MLuint>((_cPos.x >> _rShift.x) +
2306  (_cPos.y >> _rShift.y)*_strides.y +
2307  (_cPos.z >> _rShift.z)*_strides.z +
2308  (_cPos.c >> _rShift.c)*_strides.c);
2309 }
2310 
2312 template <typename DATATYPE>
2314 {
2315  const MLint px = _cPos.x + off.x;
2316  const MLint py = _cPos.y + off.y;
2317  const MLint pz = _cPos.z + off.z;
2318  const MLint pc = _cPos.c + off.c;
2319  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2320  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
2321  _cPos.x = px;
2322  _cPos.y = py;
2323  _cPos.z = pz;
2324  _cPos.c = pc;
2325  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c);
2326  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2327  (py >> _rShift.y)*_strides.y +
2328  (pz >> _rShift.z)*_strides.z +
2329  (pc >> _rShift.c)*_strides.c);
2330 }
2331 
2332 
2333 
2335 template <typename DATATYPE>
2337 {
2338  // Calculate new cursor position.
2339  _cPos += off;
2340 
2341  // Determine the index to the voxel within the page.
2342  _cIdx = static_cast<MLuint>(_cPos.x +
2343  _cPos.y*_pStrides.y + _cPos.z*_pStrides.z +
2344  _cPos.c*_pStrides.c + _cPos.t*_pStrides.t);
2345 
2346  // Determine index of the page under the cursor position.
2347  _cPageIdx = static_cast<MLuint>((_cPos.x >> _rShift.x) +
2348  (_cPos.y >> _rShift.y)*_strides.y +
2349  (_cPos.z >> _rShift.z)*_strides.z +
2350  (_cPos.c >> _rShift.c)*_strides.c +
2351  (_cPos.t >> _rShift.t)*_strides.t);
2352 }
2353 
2355 template <typename DATATYPE>
2357 {
2358  const MLint px = _cPos.x + off.x;
2359  const MLint py = _cPos.y + off.y;
2360  const MLint pz = _cPos.z + off.z;
2361  const MLint pc = _cPos.c + off.c;
2362  const MLint pt = _cPos.t + off.t;
2363  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2364  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
2365  (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
2366 
2367  // Save cursor position.
2368  _cPos.set(px,py,pz,pc,pt,0);
2369 
2370  // Determine the index to the voxel within the page.
2371  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c + pt*_pStrides.t);
2372 
2373  // Determine index of the page under the cursor position.
2374  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) +
2375  (py >> _rShift.y)*_strides.y +
2376  (pz >> _rShift.z)*_strides.z +
2377  (pc >> _rShift.c)*_strides.c +
2378  (pt >> _rShift.t)*_strides.t);
2379 }
2380 
2381 
2382 
2384 template <typename DATATYPE>
2386 {
2387  // Save cursor position.
2388  _cPos += off;
2389 
2390  // Determine the index to the voxel within the page.
2391  _cIdx = static_cast<MLuint>(_cPos.x + _cPos.y*_pStrides.y + _cPos.z*_pStrides.z +
2392  _cPos.c*_pStrides.c + _cPos.t*_pStrides.t + _cPos.u*_pStrides.u);
2393 
2394  // Determine index of the page under the cursor position.
2395  _cPageIdx = static_cast<MLuint>((_cPos.x >> _rShift.x) +
2396  (_cPos.y >> _rShift.y)*_strides.y +
2397  (_cPos.z >> _rShift.z)*_strides.z +
2398  (_cPos.c >> _rShift.c)*_strides.c +
2399  (_cPos.t >> _rShift.t)*_strides.t +
2400  (_cPos.u >> _rShift.u)*_strides.u);
2401 }
2402 
2404 template <typename DATATYPE>
2406 {
2407  const MLint px = _cPos.x + off.x;
2408  const MLint py = _cPos.y + off.y;
2409  const MLint pz = _cPos.z + off.z;
2410  const MLint pc = _cPos.c + off.c;
2411  const MLint pt = _cPos.t + off.t;
2412  const MLint pu = _cPos.u + off.u;
2413  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2414  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
2415  (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
2416 
2417  // Save cursor position.
2418  _cPos.set(px,py,pz,pc,pt,pu);
2419 
2420  // Determine the index to the voxel within the page.
2421  _cIdx = static_cast<MLuint>(px + py*_pStrides.y + pz*_pStrides.z +
2422  pc*_pStrides.c + pt*_pStrides.t + pu*_pStrides.u);
2423 
2424  // Determine index of the page under the cursor position.
2425  _cPageIdx = static_cast<MLuint>((px >> _rShift.x) + (py >> _rShift.y)*_strides.y +
2426  (pz >> _rShift.z)*_strides.z + (pc >> _rShift.c)*_strides.c +
2427  (pt >> _rShift.t)*_strides.t + (pu >> _rShift.u)*_strides.u);
2428 }
2429 
2430 
2431 
2432 //----------------------------------------------------------------------------------------------------------
2433 // IsMapped.
2434 //----------------------------------------------------------------------------------------------------------
2435 
2436 
2437 
2439 template <typename DATATYPE>
2441 {
2442  const PageBuffer * const page = _pageArray + (pos.x >> _rShift.x);
2443  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2444 };
2445 
2447 template <typename DATATYPE>
2449 {
2450  const MLint px = pos.x;
2451  if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
2452  const PageBuffer * const page = _pageArray + (px >> _rShift.x);
2453  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2454 };
2455 
2456 
2457 
2459 template <typename DATATYPE>
2461 {
2462  const PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) + (pos.y >> _rShift.y)*_strides.y);
2463  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2464 };
2465 
2467 template <typename DATATYPE>
2469 {
2470  const MLint px = pos.x;
2471  const MLint py = pos.y;
2472  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
2473  const PageBuffer * const page = _pageArray + ((px >> _rShift.x) + (py >> _rShift.y)*_strides.y);
2474  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2475 };
2476 
2477 
2478 
2480 template <typename DATATYPE>
2482 {
2483  const PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
2484  (pos.y >> _rShift.y)*_strides.y +
2485  (pos.z >> _rShift.z)*_strides.z);
2486  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2487 };
2488 
2490 template <typename DATATYPE>
2492 {
2493  const MLint px = pos.x;
2494  const MLint py = pos.y;
2495  const MLint pz = pos.z;
2496  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2497  (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
2498  const PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
2499  (py >> _rShift.y)*_strides.y +
2500  (pz >> _rShift.z)*_strides.z);
2501  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2502 };
2503 
2504 
2505 
2507 template <typename DATATYPE>
2509 {
2510  const PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
2511  (pos.y >> _rShift.y)*_strides.y +
2512  (pos.z >> _rShift.z)*_strides.z +
2513  (pos.c >> _rShift.c)*_strides.c);
2514  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2515 };
2516 
2518 template <typename DATATYPE>
2520 {
2521  const MLint px = pos.x;
2522  const MLint py = pos.y;
2523  const MLint pz = pos.z;
2524  const MLint pc = pos.c;
2525  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2526  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
2527  const PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
2528  (py >> _rShift.y)*_strides.y +
2529  (pz >> _rShift.z)*_strides.z +
2530  (pc >> _rShift.c)*_strides.c);
2531  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2532 };
2533 
2534 
2535 
2537 template <typename DATATYPE>
2539 {
2540  const PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
2541  (pos.y >> _rShift.y)*_strides.y +
2542  (pos.z >> _rShift.z)*_strides.z +
2543  (pos.c >> _rShift.c)*_strides.c +
2544  (pos.t >> _rShift.t)*_strides.t);
2545  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2546 };
2547 
2549 template <typename DATATYPE>
2551 {
2552  const MLint px = pos.x;
2553  const MLint py = pos.y;
2554  const MLint pz = pos.z;
2555  const MLint pc = pos.c;
2556  const MLint pt = pos.t;
2557  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2558  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
2559  (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
2560  const PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
2561  (py >> _rShift.y)*_strides.y +
2562  (pz >> _rShift.z)*_strides.z +
2563  (pc >> _rShift.c)*_strides.c +
2564  (pt >> _rShift.t)*_strides.t);
2565  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2566 };
2567 
2568 
2569 
2571 template <typename DATATYPE>
2573 {
2574  const PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
2575  (pos.y >> _rShift.y)*_strides.y +
2576  (pos.z >> _rShift.z)*_strides.z +
2577  (pos.c >> _rShift.c)*_strides.c +
2578  (pos.t >> _rShift.t)*_strides.t +
2579  (pos.u >> _rShift.u)*_strides.u);
2580  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2581 };
2582 
2584 template <typename DATATYPE>
2586 {
2587  const MLint px = pos.x;
2588  const MLint py = pos.y;
2589  const MLint pz = pos.z;
2590  const MLint pc = pos.c;
2591  const MLint pt = pos.t;
2592  const MLint pu = pos.u;
2593  if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
2594  (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
2595  (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
2596  const PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
2597  (py >> _rShift.y)*_strides.y +
2598  (pz >> _rShift.z)*_strides.z +
2599  (pc >> _rShift.c)*_strides.c +
2600  (pt >> _rShift.t)*_strides.t +
2601  (pu >> _rShift.u)*_strides.u);
2602  return page->_getPageFkt != VirtualVolume::_loadPageCB;
2603 };
2604 
2605 
2606 
2607 ML_END_NAMESPACE
2608 
2609 #endif // __mlTVirtualVolume_H
#define ML_DEPRECATED
Definition: CSOGroup.h:371
Class to manage a binary image.
Definition: mlBitImage.h:67
bool getCursorValue() const
Return true if bit under cursor is true, otherwise false. Never throws controlled diagnostic exceptio...
Definition: mlBitImage.h:247
const ImageVector & getCursorPosition() const
Return current cursor position. Never throws controlled diagnostic exceptions.
Definition: mlBitImage.h:244
void moveCursorX()
Definition: mlBitImage.h:274
void setCursorPosition(const ImageVector &pos)
Definition: mlBitImage.h:241
const ImageVector & getExtent() const
Return image size. Never throws controlled diagnostic exceptions.
Definition: mlBitImage.h:150
Base class for an image processing module of the ML.
Definition: mlModule.h:156
PagedImage * getOutputImage(MLint outputIndex=0) const
Returns output image outputIndex. The index needs to be in the range [0, getNumOutputImages()-1].
PagedImage * getUpdatedInputImage(MLint inputIndex, bool getReal=false) const
Convenience method for safe access to the input image at index inputIndex.
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
SubImageBox getBoxFromImageExtent() const
Definition: mlSubImage.h:218
const SubImageBox & getBox() const
Returns the box describing the origin/extent of the subimage.
Definition: mlSubImage.h:230
VectorType v1
Corner v1 of the subimage region (included in region).
Definition: mlSubImageBox.h:63
static TSubImageBox< intT > intersect(const TSubImageBox< intT > &box1, const TSubImageBox< intT > &box2)
Returns the overlapping region of subimage regions box1 and box2.
VectorType v2
Corner v2 of the subimage region (also included in region!).
Definition: mlSubImageBox.h:69
This template class manages/represents a rectangular 6d image region in memory which is organized lin...
Definition: mlTSubImage.h:110
const DATATYPE * getImagePointer(const ImageVector &position) const
Returns a pointer to voxel data of image voxel at 6d position position relative to the begin of the c...
Definition: mlTSubImage.h:253
DATATYPE getSubImageValue(const ImageVector &position) const
Returns voxel value at the given position where position is relative to the origin of the subimage re...
Definition: mlTSubImage.h:356
ComponentType c
Color component of the vector.
Definition: mlImageVector.h:65
ComponentType t
Time component of the vector.
Definition: mlImageVector.h:67
ComponentType u
Unit/Modality/User component of the vector.
Definition: mlImageVector.h:69
ComponentType z
Z component of the vector.
Definition: mlImageVector.h:63
ComponentType x
X component of the vector.
Definition: mlImageVector.h:59
ComponentType y
Y component of the vector.
Definition: mlImageVector.h:61
The TVirtualVolume class implements random access to a paged input image or a pure virtual image with...
static void _moveFZCB(TVirtualVolume *obj)
static void _setVoxel4DCBE(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
static void setInt64ValueWrapped(void *vv, const ImageVector &pos, MLint64 v)
static void _moveBUCBE(TVirtualVolume *obj)
static MLdouble getDoubleCursorValueWrapped(void *vv)
static void _moveCursorOffset3DCB(TVirtualVolume *obj, const ImageVector &p)
static void _moveFYCBE(TVirtualVolume *obj)
static bool _isMapped5DCB(const TVirtualVolume *obj, const ImageVector &pos)
virtual ~TVirtualVolume()
Destructor.
static void _setVoxel6DCB(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
static bool _isMapped4DCBE(const TVirtualVolume *obj, const ImageVector &pos)
void setCursorPosition(const ImageVector &pos)
Set the cursor to a certain position.
static void _moveCursorOffset2DCBE(TVirtualVolume *obj, const ImageVector &p)
static MLint64 getInt64ValueWrapped(void *vv, const ImageVector &pos)
void _setVoxel6DE(const ImageVector &pos, DATATYPE voxVal)
Set voxel at a position for a certain dimension with testing and exception throw if necessary....
static void reverseMoveCursorUWrapped(void *vv)
static void _setCursorPos4DCB(TVirtualVolume *obj, const ImageVector &p)
static void setIntValueWrapped(void *vv, const ImageVector &pos, MLint v)
static void setDoubleValueWrapped(void *vv, const ImageVector &pos, MLdouble v)
static void _moveBXCB(TVirtualVolume *obj)
void _moveCursorOffset2DE(const ImageVector &p)
Move cursor by an offset to a new position with testing and exception throw if necessary....
DATATYPE _getVoxel2D(const ImageVector &pos)
Get voxel method for a certain dimension. (2d)
static void _setCursorPos3DCB(TVirtualVolume *obj, const ImageVector &p)
static void fillDoubleWrapped(void *vv, const ImageVector &v1, const ImageVector &v2, MLdouble v)
static void _setCursorPos6DCB(TVirtualVolume *obj, const ImageVector &p)
static MLdouble getDoubleValueWrapped(void *vv, const ImageVector &pos)
static void setDoubleCursorValueWrapped(void *vv, MLdouble v)
DATATYPE _getVoxel4DE(const ImageVector &pos)
Get voxel at a position for a certain dimension with testing and exception throw if necessary....
static void reverseMoveCursorCWrapped(void *vv)
DATATYPE _getVoxel6D(const ImageVector &pos)
Get voxel method for a certain dimension. (6d)
static bool _isMapped2DCBE(const TVirtualVolume *obj, const ImageVector &pos)
static MLint64 getInt64CursorValueWrapped(void *vv)
static void setLDoubleCursorValueWrapped(void *vv, MLldouble v)
static void fillLDoubleWrapped(void *vv, const ImageVector &v1, const ImageVector &v2, MLldouble v)
DATATYPE _getVoxel1DE(const ImageVector &pos)
Get voxel at a position for a certain dimension with testing and exception throw if necessary....
static DATATYPE _getVoxel3DCBE(TVirtualVolume *obj, const ImageVector &pos)
void _setCursorPos2D(const ImageVector &p)
Set cursor position for a certain dimension. (2d)
bool _isMapped3D(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
static void _moveBTCB(TVirtualVolume *obj)
static void _setVoxel3DCBE(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
void _setCursorPos3D(const ImageVector &p)
Set cursor position for a certain dimension. (3d)
static bool _isMapped1DCB(const TVirtualVolume *obj, const ImageVector &pos)
DATATYPE ComponentType
A typedef to "export" the type of voxels components.
void _setCursorPos6D(const ImageVector &p)
Set cursor position for a certain dimension. (6d)
static void reverseMoveCursorZWrapped(void *vv)
TVirtualVolume()
Hide the default constructor to avoid incorrect usage due to missing initializations.
static DATATYPE _getVoxel1DCBE(TVirtualVolume *obj, const ImageVector &pos)
static void setIntCursorValueWrapped(void *vv, MLint v)
bool _isMapped4D(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
void _setVoxel2DE(const ImageVector &pos, DATATYPE voxVal)
Set voxel at a position for a certain dimension with testing and exception throw if necessary....
static void setCursorPositionWrapped(void *vv, const ImageVector &pos)
static void _moveCursorOffset3DCBE(TVirtualVolume *obj, const ImageVector &p)
static MLint getIntCursorValueWrapped(void *vv)
static void _moveFTCB(TVirtualVolume *obj)
static void _setCursorPos5DCBE(TVirtualVolume *obj, const ImageVector &p)
static MLint getIntValueWrapped(void *vv, const ImageVector &pos)
Wrapper functions for non template application interfaces.
static const ImageVector & getCursorPositionWrapped(void *vv)
void _setVoxel3DE(const ImageVector &pos, DATATYPE voxVal)
Set voxel at a position for a certain dimension with testing and exception throw if necessary....
void _setVoxel4DE(const ImageVector &pos, DATATYPE voxVal)
Set voxel at a position for a certain dimension with testing and exception throw if necessary....
static void moveCursorByOffsetWrapped(void *vv, const ImageVector &off)
static void _moveCursorOffset1DCB(TVirtualVolume *obj, const ImageVector &p)
void _setCursorPos4DE(const ImageVector &p)
Set cursor position for a certain dimension with testing and exception throw if necessary....
static DATATYPE _getVoxel4DCBE(TVirtualVolume *obj, const ImageVector &pos)
static void _moveFYCB(TVirtualVolume *obj)
static void moveCursorUWrapped(void *vv)
static void moveCursorYWrapped(void *vv)
void _setVoxel4D(const ImageVector &pos, DATATYPE voxVal)
Set voxel method for a certain dimension. (4d)
static bool isMappedWrapped(void *vv, const ImageVector &pos)
static void moveCursorTWrapped(void *vv)
static bool _isMapped6DCB(const TVirtualVolume *obj, const ImageVector &pos)
static void _setVoxel5DCBE(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
static void _setCursorPos3DCBE(TVirtualVolume *obj, const ImageVector &p)
static void _setCursorPos2DCBE(TVirtualVolume *obj, const ImageVector &p)
bool _isMapped1DE(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
void _setCursorPos5DE(const ImageVector &p)
Set cursor position for a certain dimension with testing and exception throw if necessary....
bool _isMapped3DE(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
static void _setVoxel6DCBE(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
void _setVoxel6D(const ImageVector &pos, DATATYPE voxVal)
Set voxel method for a certain dimension. (6d)
static void _moveCursorOffset5DCBE(TVirtualVolume *obj, const ImageVector &p)
void _setVoxel3D(const ImageVector &pos, DATATYPE voxVal)
Set voxel method for a certain dimension. (3d)
static void _moveBXCBE(TVirtualVolume *obj)
static void _moveBCCBE(TVirtualVolume *obj)
static void _moveFXCBE(TVirtualVolume *obj)
bool _isMapped2DE(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
DATATYPE _getVoxel2DE(const ImageVector &pos)
Get voxel at a position for a certain dimension with testing and exception throw if necessary....
static void _moveFUCBE(TVirtualVolume *obj)
void copyMaskToSubImage(TSubImage< OUTDTYPE > &outSubImg, BitImage &maskBits, bool maskValue=true, bool writeBK=false, OUTDTYPE bkVal=ml_cast_from_scalar< OUTDTYPE >(0))
Takes overlapping region from *this, outSubImg and maskBits and copies all voxels from *this to outSu...
static DATATYPE _getVoxel4DCB(TVirtualVolume *obj, const ImageVector &pos)
static bool _isMapped3DCBE(const TVirtualVolume *obj, const ImageVector &pos)
static void moveCursorXWrapped(void *vv)
static void _moveCursorOffset5DCB(TVirtualVolume *obj, const ImageVector &p)
void _setVoxel1DE(const ImageVector &pos, DATATYPE voxVal)
Set voxel at a position for a certain dimension with testing and exception throw if necessary....
TVirtualVolume(const ImageVector &ext, MLdouble fillVal=0, MLint maxNumKB=-1, bool areExceptionsOn=false)
Convenience constructor (3) creating an untyped virtual volume inside the typed one to avoid addition...
static bool _isMapped1DCBE(const TVirtualVolume *obj, const ImageVector &pos)
static void _setVoxel1DCBE(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
void _moveCursorOffset6D(const ImageVector &p)
Move cursor by an offset to a new position. (6d)
void _moveCursorOffset5DE(const ImageVector &p)
Move cursor by an offset to a new position with testing and exception throw if necessary....
static void _moveBTCBE(TVirtualVolume *obj)
static bool _isMapped6DCBE(const TVirtualVolume *obj, const ImageVector &pos)
VirtualVolume & getVirtualVolume()
Returns the pointer to the wrapped untyped virtual volume.
static void _setVoxel2DCB(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
static void reverseMoveCursorTWrapped(void *vv)
static bool _isMapped2DCB(const TVirtualVolume *obj, const ImageVector &pos)
void _moveCursorOffset4DE(const ImageVector &p)
Move cursor by an offset to a new position with testing and exception throw if necessary....
static void resetCursorWrapped(void *vv)
void _setVoxel1D(const ImageVector &pos, DATATYPE voxVal)
Set voxel method for a certain dimension. (1d)
static void _moveFZCBE(TVirtualVolume *obj)
DATATYPE getValue(const ImageVector &pos)
Get a voxel value from the virtual volume.
static void fillIntWrapped(void *vv, const ImageVector &v1, const ImageVector &v2, MLint v)
static void _setCursorPos6DCBE(TVirtualVolume *obj, const ImageVector &p)
static void _moveFCCB(TVirtualVolume *obj)
DATATYPE _getVoxel5D(const ImageVector &pos)
Get voxel method for a certain dimension. (5d)
void _setVoxel2D(const ImageVector &pos, DATATYPE voxVal)
Set voxel method for a certain dimension. (2d)
TVirtualVolume & operator=(const TVirtualVolume &)
Hide the default assignment operator to avoid incorrect usage due to missing initializations.
static void _setCursorPos2DCB(TVirtualVolume *obj, const ImageVector &p)
static void _setCursorPos1DCB(TVirtualVolume *obj, const ImageVector &p)
static void _setVoxel4DCB(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
static void moveCursorCWrapped(void *vv)
bool _isMapped5D(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
void _moveCursorOffset1DE(const ImageVector &p)
Move cursor by an offset to a new position with testing and exception throw if necessary....
static bool _isMapped5DCBE(const TVirtualVolume *obj, const ImageVector &pos)
static DATATYPE _getVoxel1DCB(TVirtualVolume *obj, const ImageVector &pos)
static void _setCursorPos4DCBE(TVirtualVolume *obj, const ImageVector &p)
DATATYPE * getWrittenPageData(MLuint32 wp) const
Returns typed pointer to data of written page with page id wp.
static void _moveBYCB(TVirtualVolume *obj)
static DATATYPE _getVoxel6DCBE(TVirtualVolume *obj, const ImageVector &pos)
static DATATYPE _getVoxel2DCB(TVirtualVolume *obj, const ImageVector &pos)
static bool moveCursorXWrapAroundWrapped(void *vv)
static void moveCursorZWrapped(void *vv)
static void setInt64CursorValueWrapped(void *vv, MLint64 v)
void _setCursorPos1DE(const ImageVector &p)
Set cursor position for a certain dimension with testing and exception throw if necessary....
static void _moveBUCB(TVirtualVolume *obj)
static bool _isMapped4DCB(const TVirtualVolume *obj, const ImageVector &pos)
bool _isMapped5DE(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
TVirtualVolume(PagedImage *image, MLint maxNumKB=-1, bool areExceptionsOn=false)
Convenience constructor (2) creating an untyped virtual volume inside the typed one to avoid addition...
static void _setCursorPos1DCBE(TVirtualVolume *obj, const ImageVector &p)
static DATATYPE _getVoxel2DCBE(TVirtualVolume *obj, const ImageVector &pos)
static DATATYPE _getVoxel5DCBE(TVirtualVolume *obj, const ImageVector &pos)
static void _moveFXCB(TVirtualVolume *obj)
static void _moveBZCBE(TVirtualVolume *obj)
TVirtualVolume(VirtualVolume &vVol)
Constructor 1.
static void fillInt64Wrapped(void *vv, const ImageVector &v1, const ImageVector &v2, MLint64 v)
static DATATYPE _getVoxel6DCB(TVirtualVolume *obj, const ImageVector &pos)
bool _isMapped6D(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
DATATYPE _getVoxel4D(const ImageVector &pos)
Get voxel method for a certain dimension. (4d)
static void _moveCursorOffset1DCBE(TVirtualVolume *obj, const ImageVector &p)
void _moveCursorOffset5D(const ImageVector &p)
Move cursor by an offset to a new position. (5d)
void _setVoxel5DE(const ImageVector &pos, DATATYPE voxVal)
Set voxel at a position for a certain dimension with testing and exception throw if necessary....
bool _isMapped1D(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
bool _isMapped4DE(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
void _setVoxel5D(const ImageVector &pos, DATATYPE voxVal)
Set voxel method for a certain dimension. (5d)
static void _moveBCCB(TVirtualVolume *obj)
void _moveCursorOffset4D(const ImageVector &p)
Move cursor by an offset to a new position. (4d)
void _moveCursorOffset3D(const ImageVector &p)
Move cursor by an offset to a new position. (3d)
static void _setVoxel5DCB(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
DATATYPE _getVoxel1D(const ImageVector &pos)
Get voxel method for a certain dimension. (1d)
static void _moveCursorOffset2DCB(TVirtualVolume *obj, const ImageVector &p)
static MLldouble getLDoubleValueWrapped(void *vv, const ImageVector &pos)
DATATYPE _getVoxel6DE(const ImageVector &pos)
Get voxel at a position for a certain dimension with testing and exception throw if necessary....
static void _moveCursorOffset6DCB(TVirtualVolume *obj, const ImageVector &p)
static void _moveFCCBE(TVirtualVolume *obj)
DATATYPE _getVoxel3D(const ImageVector &pos)
Get voxel method for a certain dimension. (3d)
void _setCursorPos1D(const ImageVector &p)
Set cursor position for a certain dimension. (1d)
static void _moveFTCBE(TVirtualVolume *obj)
static void _moveBZCB(TVirtualVolume *obj)
static bool _isMapped3DCB(const TVirtualVolume *obj, const ImageVector &pos)
bool _isMapped6DE(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
static void reverseMoveCursorXWrapped(void *vv)
void setValue(const ImageVector &pos, DATATYPE data)
Write a voxel into the virtual volume.
static void _moveCursorOffset6DCBE(TVirtualVolume *obj, const ImageVector &p)
static void _moveFUCB(TVirtualVolume *obj)
static void _moveCursorOffset4DCB(TVirtualVolume *obj, const ImageVector &p)
void _moveCursorOffset2D(const ImageVector &p)
Move cursor by an offset to a new position. (2d)
void _setCursorPos5D(const ImageVector &p)
Set cursor position for a certain dimension. (5d)
void _moveCursorOffset6DE(const ImageVector &p)
Move cursor by an offset to a new position with testing and exception throw if necessary....
bool isMapped(const ImageVector &pos) const
Returns true if voxel is mapped into memory, otherwise it returns false.
static void _setVoxel1DCB(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
void moveCursorByOffset(const ImageVector &off)
Shift cursor to current position + offset.
static void _moveBYCBE(TVirtualVolume *obj)
void copyToSubImage(TSubImage< DATATYPE > &outSubImg)
Copy area from the virtual volume into the subimage given by outSubImg.
static DATATYPE _getVoxel3DCB(TVirtualVolume *obj, const ImageVector &pos)
void _setCursorPos2DE(const ImageVector &p)
Set cursor position for a certain dimension with testing and exception throw if necessary....
static void reverseMoveCursorYWrapped(void *vv)
static void _moveCursorOffset4DCBE(TVirtualVolume *obj, const ImageVector &p)
static void _setVoxel3DCB(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
static void _setVoxel2DCBE(TVirtualVolume *obj, const ImageVector &pos, DATATYPE voxVal)
static MLldouble getLDoubleCursorValueWrapped(void *vv)
void _setCursorPos3DE(const ImageVector &p)
Set cursor position for a certain dimension with testing and exception throw if necessary....
void _setCursorPos4D(const ImageVector &p)
Set cursor position for a certain dimension. (4d)
static DATATYPE _getVoxel5DCB(TVirtualVolume *obj, const ImageVector &pos)
const ImageVector & getCursorPosition() const
Return the current cursor coordinates.
bool _isMapped2D(const ImageVector &pos) const
Returns true if voxel is mapped in memory for a certain dimension, otherwise false....
DATATYPE _getVoxel5DE(const ImageVector &pos)
Get voxel at a position for a certain dimension with testing and exception throw if necessary....
static void _setCursorPos5DCB(TVirtualVolume *obj, const ImageVector &p)
void _setCursorPos6DE(const ImageVector &p)
Set cursor position for a certain dimension with testing and exception throw if necessary....
void _moveCursorOffset3DE(const ImageVector &p)
Move cursor by an offset to a new position with testing and exception throw if necessary....
static void setLDoubleValueWrapped(void *vv, const ImageVector &pos, MLldouble v)
DATATYPE _getVoxel3DE(const ImageVector &pos)
Get voxel at a position for a certain dimension with testing and exception throw if necessary....
void _moveCursorOffset1D(const ImageVector &p)
Move cursor by an offset to a new position. (1d)
This class manages a virtual volume organizing efficient voxel access to the output image of an input...
MLint getDim() const
Return dimension of specified volume.
MLDataType getDataType() const
Return data type enum.
#define ML_BAD_DATA_TYPE
A wrong or unexpected data type has been passed to an algorithm which often is a programming error; t...
Definition: mlTypeDefs.h:884
#define ML_BAD_DIMENSION
he image or data structure has wrong extent or dimensions.
Definition: mlTypeDefs.h:937
#define ML_OUT_OF_RANGE
Any coordinate or value is out of range, often a voxel address which is outside of an image or it is ...
Definition: mlTypeDefs.h:974
#define ML_PRINT_FATAL_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be du...
#define ML_PRINT_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define _VV_MOVEBE_TEST(Q)
Macro to save cursor movement with exception handling if outside image.
MLDataType MLGetDataTypeFromPtr(const T *)
long double MLldouble
Definition: mlTypeDefs.h:238
unsigned int MLuint32
Definition: mlTypeDefs.h:191
MLuint64 MLuint
An unsigned ML integer type with at least 64 bits used for index calculations on very large images ev...
Definition: mlTypeDefs.h:594
double MLdouble
Definition: mlTypeDefs.h:223
INT64 MLint64
Include 64 bit integer support for Windows or Unix.
Definition: mlTypeDefs.h:500
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578
MLWEM_EXPORT void intersect(WEMTrianglePatch *inPatch1, WEMTrianglePatch *inPatch2, WEMTrianglePatch *outPatch, unsigned int outputMode, TriangulationModes triangulationMode, WEMVector< WEMCut > *cuts=nullptr)
Returns the intersection of the given patches.
TSubImageBox< MLint > SubImageBox
Define the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type.
TImageVector< MLint > ImageVector
Defines the standard ImageVector type which is used by the ML for indexing and coordinates.
PageBuffer is a helper structure to manage one page of input data of the VirtualVolume class and it a...
ReturnPageFunc _getPageFkt
Pointer to function to return the page managed by the PageBuffer.
bool _locked
If true this page contains written data and must not be removed.