MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLTools/include/mlTVirtualVolume.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00005 
00018 //----------------------------------------------------------------------------------
00019 #ifndef __mlTVirtualVolume_H
00020 #define __mlTVirtualVolume_H
00021 
00022 // Include dll-specific settings.
00023 #ifndef __MLToolsSystem_H
00024 #include "MLToolsSystem.h"
00025 #endif
00026 
00027 // Include most ml specific things.
00028 #ifndef __mlVirtualVolume_H
00029 #include "mlVirtualVolume.h"
00030 #endif
00031 
00032 // Include BitImage.
00033 #ifndef __mlBitImage_H
00034 #include "mlBitImage.h"
00035 #endif
00036 
00037 ML_START_NAMESPACE
00038 
00039 //---------------------------------------------------------------------------------------------------------
00208 //---------------------------------------------------------------------------------------------------------
00209 template<typename DATATYPE> class TVirtualVolume {
00210 
00211 protected:
00213   inline TVirtualVolume(){}
00214 
00217   inline TVirtualVolume &operator=(const TVirtualVolume &){}
00218 
00219 public:
00220     
00222   typedef DATATYPE ComponentType;
00223 
00226   inline TVirtualVolume(VirtualVolume &vVol)
00227   {
00228     _convenienceInstance = NULL;
00229     _init(vVol);
00230   }
00231 
00239   TVirtualVolume(PagedImage *image, MLint maxNumKB=-1,
00240                  bool areExceptionsOn=false)
00241   {
00242     _convenienceInstance = new VirtualVolume(image,
00243                                              MLGetDataTypeFromPtr(static_cast<DATATYPE*>(NULL)),
00244                                              maxNumKB,
00245                                              areExceptionsOn);
00246     _init(*_convenienceInstance);
00247   }
00248 
00256   TVirtualVolume(const ImageVector &ext,
00257                  MLdouble      fillVal         = 0,
00258                  MLint         maxNumKB        = -1,
00259                  bool          areExceptionsOn = false)
00260   {
00261     _convenienceInstance = new VirtualVolume(ext,
00262                                              fillVal,
00263                                              MLGetDataTypeFromPtr(static_cast<DATATYPE*>(NULL)),
00264                                              maxNumKB,
00265                                              areExceptionsOn);
00266     _init(*_convenienceInstance);
00267   }
00268 
00272   virtual ~TVirtualVolume()
00273   {
00274     _cleanUp();
00275     ML_DELETE(_convenienceInstance);
00276   }
00277 
00279   inline VirtualVolume &getVirtualVolume()                                 { return *_virtVol;                }
00280 
00286   inline void          getValues(register const ImageVector *pos, DATATYPE *results, MLuint num);
00287 
00290   inline DATATYPE      getValue(register const ImageVector &pos)                { return _getVoxelFunc(this, pos); }
00291 
00294   inline void          setValue(register const ImageVector &pos, DATATYPE data) { _setVoxelFunc(this, pos, data);  }
00295 
00297   inline void          setCursorPosition(const ImageVector & pos)                    { _setCursorPosFunc(this, pos);    }
00298 
00300   inline const ImageVector &getCursorPosition() const                                { return _cPos;                    }
00301 
00303   inline void          setCursorValue(DATATYPE val);
00304 
00306   inline DATATYPE      getCursorValue();
00307 
00309   inline bool          isMapped(const ImageVector &pos) const                   { return _isMappedFunc(this, pos); }
00310 
00312 
00313   inline void  moveCursorX() { _moveFXFunc(this); }
00314   inline void  moveCursorY() { _moveFYFunc(this); }
00315   inline void  moveCursorZ() { _moveFZFunc(this); }
00316   inline void  moveCursorC() { _moveFCFunc(this); }
00317   inline void  moveCursorT() { _moveFTFunc(this); }
00318   inline void  moveCursorU() { _moveFUFunc(this); }
00319 
00320   inline void  reverseMoveCursorX() { _moveBXFunc(this); }
00321   inline void  reverseMoveCursorY() { _moveBYFunc(this); }
00322   inline void  reverseMoveCursorZ() { _moveBZFunc(this); }
00323   inline void  reverseMoveCursorC() { _moveBCFunc(this); }
00324   inline void  reverseMoveCursorT() { _moveBTFunc(this); }
00325   inline void  reverseMoveCursorU() { _moveBUFunc(this); }
00327 
00329   inline void          moveCursorByOffset(const ImageVector &off)                       { _moveCursorOffsetFunc(this, off);}
00330 
00332 
00333 
00334   void resetCursor();
00335 
00345   bool moveCursorXWrapAround();
00347 
00351   void fill(const SubImageBox &box, DATATYPE value);
00352 
00357   void copyToSubImage(TSubImage<DATATYPE> &outSubImg);
00358 
00363   void copyFromSubImage(const TSubImage<DATATYPE> &inImg, const SubImageBox &box, const ImageVector &pos);
00364 
00384   //
00385   // It would be desirable to have this function in the implementation part, but I
00386   // don't know how to do that syntactically with the second template argument.
00387   // (Maybe the VC++6 compiler does not support that?)
00388   //
00389   template <typename OUTDTYPE>
00390   void copyMaskToSubImage(TSubImage<OUTDTYPE> &outSubImg,
00391                           BitImage          &maskBits,
00392                           bool               maskValue  = true,
00393                           bool               writeBK    = false,
00394                           OUTDTYPE           bkVal      = ml_cast_from_scalar<OUTDTYPE>(0))
00395   {
00396     ML_TRACE_IN("TVirtualVolume::copyMaskToSubImage()")
00397 
00398     // Save cursor positions of *this, maskBits and outSubImg.
00399     const ImageVector    vvCursorPos(getCursorPosition());
00400     const ImageVector    bitImgCursorPos(maskBits.getCursorPosition());
00401 
00402     // Determine valid overlapping region of virtual volume and output page.
00403     SubImageBox box = SubImageBox::intersect(_virtVol->getBox(), outSubImg.getBox());
00404 
00405     // Clamp box against bitImage box.
00406     box = box.intersect(SubImageBox(maskBits.getExtent()));
00407 
00408     // Scan all voxels in both input subimages which have identical
00409     // extents (as specified in calculateInputSubImageBox).
00410     ImageVector p = box.v1;
00411     for (p.u = box.v1.u;   p.u <= box.v2.u;  p.u++){
00412       for (p.t = box.v1.t;   p.t <= box.v2.t;  p.t++){
00413         for (p.c = box.v1.c;   p.c <= box.v2.c;  p.c++){
00414           for (p.z = box.v1.z;  p.z <= box.v2.z;  p.z++){
00415             for (p.y = box.v1.y;  p.y <= box.v2.y;  p.y++){
00416 
00417               // Calculate first voxel position in x row.
00418               p.x = box.v1.x;
00419 
00420               // Get pointer to first voxels in x-rows of output subimage.
00421               OUTDTYPE* oP = outSubImg.getImagePointer(p);
00422 
00423               // Set cursor position in virtual volume.
00424               setCursorPosition(p);
00425 
00426               // Set cursor in bitImage of _drawImage.
00427               maskBits.setCursorPosition(p);
00428 
00429               // Iterate over all voxels in voxel rows.
00430               for (;  p.x <= box.v2.x;  p.x++){
00431 
00432                 // Copy value from virtual volume if corresponding bit
00433                 // image flag denotes a modified value.
00434                 if (maskBits.getCursorValue() == maskValue){
00435                   *oP = static_cast<OUTDTYPE>(getCursorValue());
00436                 }
00437                 else{
00438                   // No copy desired. Set bkVal if writeBK permits it.
00439                   if (writeBK){ *oP =bkVal; }
00440                 }
00441 
00442                 // Move all image cursors forward, but do not move them
00443                 // outside image areas in last column to avoid exceptions.
00444                 if (p.x < box.v2.x){
00445                   // Move forward the output data pointer.
00446                   ++oP;
00447 
00448                   // Move forward the virtual volume cursor.
00449                   moveCursorX();
00450 
00451                   // Move forward the bit image cursor.
00452                   maskBits.moveCursorX();
00453                 }
00454               }
00455             }
00456           }
00457         }
00458       }
00459     }
00460 
00461     // Restore cursor positions.
00462     setCursorPosition(vvCursorPos);
00463     maskBits.setCursorPosition(bitImgCursorPos);
00464   }
00465 
00466 
00473   inline DATATYPE *getWrittenPageData(MLuint32 wp) const { return static_cast<DATATYPE*>(_virtVol->getWrittenPageData(wp)); }
00474 
00475 
00476 
00484 
00485   static MLint         getIntValueWrapped           (void *vv, const ImageVector &pos)              { return static_cast<MLint    >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
00486   static MLint64       getInt64ValueWrapped         (void *vv, const ImageVector &pos)              { return static_cast<MLint64  >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
00487   static MLdouble      getDoubleValueWrapped        (void *vv, const ImageVector &pos)              { return static_cast<MLdouble >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
00488   static MLldouble     getLDoubleValueWrapped       (void *vv, const ImageVector &pos)              { return static_cast<MLldouble>((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getValue(pos)); }
00489   static MLint         getIntCursorValueWrapped     (void *vv)                                      { return static_cast<MLint    >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
00490   static MLint64       getInt64CursorValueWrapped   (void *vv)                                      { return static_cast<MLint64  >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
00491   static MLdouble      getDoubleCursorValueWrapped  (void *vv)                                      { return static_cast<MLdouble >((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
00492   static MLldouble     getLDoubleCursorValueWrapped (void *vv)                                      { return static_cast<MLldouble>((static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorValue()); }
00493   static const ImageVector &getCursorPositionWrapped(void *vv)                                      { return (static_cast<TVirtualVolume<DATATYPE>*>(vv))->getCursorPosition(); }
00494   static bool          isMappedWrapped              (void *vv, const ImageVector &pos)              { return (static_cast<TVirtualVolume<DATATYPE>*>(vv))->isMapped(pos); }
00495   static void          setCursorPositionWrapped     (void *vv, const ImageVector &pos)              { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorPosition(pos); }
00496   static void          setIntValueWrapped           (void *vv, const ImageVector &pos, MLint     v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
00497   static void          setInt64ValueWrapped         (void *vv, const ImageVector &pos, MLint64   v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
00498   static void          setDoubleValueWrapped        (void *vv, const ImageVector &pos, MLdouble  v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
00499   static void          setLDoubleValueWrapped       (void *vv, const ImageVector &pos, MLldouble v) { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setValue(pos, static_cast<DATATYPE>(v)); }
00500   static void          setIntCursorValueWrapped     (void *vv, MLint     v)                         { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
00501   static void          setInt64CursorValueWrapped   (void *vv, MLint64   v)                         { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
00502   static void          setDoubleCursorValueWrapped  (void *vv, MLdouble  v)                         { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
00503   static void          setLDoubleCursorValueWrapped (void *vv, MLldouble v)                         { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->setCursorValue(static_cast<DATATYPE>(v)); }
00504   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)); }
00505   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)); }
00506   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)); }
00507   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)); }
00508   static void          moveCursorXWrapped           (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorX(); }
00509   static void          moveCursorYWrapped           (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorY(); }
00510   static void          moveCursorZWrapped           (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorZ(); }
00511   static void          moveCursorCWrapped           (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorC(); }
00512   static void          moveCursorTWrapped           (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorT(); }
00513   static void          moveCursorUWrapped           (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorU(); }
00514   static void          reverseMoveCursorXWrapped    (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorX(); }
00515   static void          reverseMoveCursorYWrapped    (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorY(); }
00516   static void          reverseMoveCursorZWrapped    (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorZ(); }
00517   static void          reverseMoveCursorCWrapped    (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorC(); }
00518   static void          reverseMoveCursorTWrapped    (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorT(); }
00519   static void          reverseMoveCursorUWrapped    (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->reverseMoveCursorU(); }
00520   static void          moveCursorByOffsetWrapped    (void *vv, const ImageVector &off)              { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorByOffset(off); }
00521   static void          resetCursorWrapped           (void *vv)                                      { (static_cast<TVirtualVolume<DATATYPE>*>(vv))->resetCursor(); }
00522   static bool          moveCursorXWrapAroundWrapped (void *vv)                                      { return (static_cast<TVirtualVolume<DATATYPE>*>(vv))->moveCursorXWrapAround(); }
00524 
00525 #ifdef ML_DEPRECATED
00526 
00528 
00529 
00530 public:
00533   ML_DEPRECATED_CONSTRUCTOR TVirtualVolume(Module *module, MLint connIdx, MLint maxNumKB=-1,
00534     bool areExceptionsOn=false, bool useOutConnectors=false)
00535   {
00536     PagedImage* image = NULL;
00537     if (useOutConnectors) {
00538       image = module->getOutputImage(connIdx);
00539     } else {
00540       image = module->getUpdatedInputImage(connIdx);
00541     }
00542     _convenienceInstance = new VirtualVolume(image,
00543       MLGetDataTypeFromPtr(static_cast<DATATYPE*>(NULL)),
00544       maxNumKB,
00545       areExceptionsOn);
00546     _init(*_convenienceInstance);
00547   }
00550   inline ML_DEPRECATED void copyToSubImg(TSubImage<DATATYPE> &outSubImg) { copyToSubImage(outSubImg); }
00551 
00554   inline ML_DEPRECATED void copyFromSubImg(const TSubImage<DATATYPE> &inImg, const SubImageBox &box, const ImageVector &pos) { copyFromSubImage(inImg, box, pos); }
00555 
00558   inline ML_DEPRECATED void getVoxels(register const ImageVector *pos, DATATYPE *results, MLuint num) { getValues(pos, results, num); }
00559 
00562   inline ML_DEPRECATED DATATYPE getVoxel(register const ImageVector &pos)  { return getValue(pos); }
00563 
00566   inline ML_DEPRECATED void setVoxel(register const ImageVector &pos, DATATYPE data) { setValue(pos, data);  }
00567 
00570   inline ML_DEPRECATED void setCursorPos(const ImageVector & pos) { setCursorPosition(pos); }
00571 
00574   inline ML_DEPRECATED const ImageVector &getCursorPos() const { return getCursorPosition(); }
00575 
00578   inline ML_DEPRECATED void setCursorVoxel(DATATYPE val) { setCursorValue(val); }
00579 
00582   inline ML_DEPRECATED DATATYPE getCursorVoxel() { return getCursorValue(); }
00583 
00586   inline ML_DEPRECATED void  moveFX() { moveCursorX(); }
00589   inline ML_DEPRECATED void  moveFY() { moveCursorY(); }
00592   inline ML_DEPRECATED void  moveFZ() { moveCursorZ(); }
00595   inline ML_DEPRECATED void  moveFC() { moveCursorC(); }
00598   inline ML_DEPRECATED void  moveFT() { moveCursorT(); }
00601   inline ML_DEPRECATED void  moveFU() { moveCursorU(); }
00602 
00605   inline ML_DEPRECATED void  moveBX() { reverseMoveCursorX(); }
00608   inline ML_DEPRECATED void  moveBY() { reverseMoveCursorY(); }
00611   inline ML_DEPRECATED void  moveBZ() { reverseMoveCursorZ(); }
00614   inline ML_DEPRECATED void  moveBC() { reverseMoveCursorC(); }
00617   inline ML_DEPRECATED void  moveBT() { reverseMoveCursorT(); }
00620   inline ML_DEPRECATED void  moveBU() { reverseMoveCursorU(); }
00623   inline ML_DEPRECATED bool moveCursorFXLF() { return moveCursorXWrapAround(); }
00624 
00627   inline ML_DEPRECATED void          moveOffset(const ImageVector &off)                       { moveCursorByOffset(off);}
00628 
00629 
00632   static ML_DEPRECATED MLint         getIntVoxelW          (void *vv, const ImageVector &pos)               { return getIntValueWrapped(vv, pos); }
00635   static ML_DEPRECATED MLint64       getInt64VoxelW        (void *vv, const ImageVector &pos)               { return getInt64ValueWrapped(vv, pos); }
00638   static ML_DEPRECATED MLdouble      getDoubleVoxelW       (void *vv, const ImageVector &pos)               { return getDoubleValueWrapped(vv, pos); }
00641   static ML_DEPRECATED MLldouble     getLDoubleVoxelW      (void *vv, const ImageVector &pos)               { return getLDoubleValueWrapped(vv, pos); }
00644   static ML_DEPRECATED MLint         getIntCursorVoxelW    (void *vv)                                       { return getIntCursorValueWrapped(vv); }
00647   static ML_DEPRECATED MLint64       getInt64CursorVoxelW  (void *vv)                                       { return getInt64CursorValueWrapped(vv); }
00650   static ML_DEPRECATED MLdouble      getDoubleCursorVoxelW (void *vv)                                       { return getDoubleCursorValueWrapped(vv); }
00653   static ML_DEPRECATED MLldouble     getLDoubleCursorVoxelW(void *vv)                                       { return getLDoubleCursorValueWrapped(vv); }
00656   static ML_DEPRECATED const ImageVector &getCursorPosW         (void *vv)                                  { return getCursorPositionWrapped(vv); }
00659   static ML_DEPRECATED bool          isMappedW             (void *vv, const ImageVector &pos)               { return isMappedWrapped(vv, pos); }
00662   static ML_DEPRECATED void          setCursorPosW         (void *vv, const ImageVector &pos)               { setCursorPositionWrapped(vv, pos); }
00665   static ML_DEPRECATED void          setIntVoxelW          (void *vv, const ImageVector &pos, MLint     v)  { setIntValueWrapped(vv, pos, v); }
00668   static ML_DEPRECATED void          setInt64VoxelW        (void *vv, const ImageVector &pos, MLint64   v)  { setInt64ValueWrapped(vv, pos, v); }
00671   static ML_DEPRECATED void          setDoubleVoxelW       (void *vv, const ImageVector &pos, MLdouble  v)  { setDoubleValueWrapped(vv, pos, v); }
00674   static ML_DEPRECATED void          setLDoubleVoxelW      (void *vv, const ImageVector &pos, MLldouble v)  { setLDoubleValueWrapped(vv, pos, v); }
00677   static ML_DEPRECATED void          setIntCursorVoxelW    (void *vv, MLint     v)                          { setIntCursorValueWrapped(vv, v); }
00680   static ML_DEPRECATED void          setInt64CursorVoxelW  (void *vv, MLint64   v)                          { setInt64CursorValueWrapped(vv, v); }
00683   static ML_DEPRECATED void          setDoubleCursorVoxelW (void *vv, MLdouble  v)                          { setDoubleCursorValueWrapped(vv, v); }
00686   static ML_DEPRECATED void          setLDoubleCursorVoxelW(void *vv, MLldouble v)                          { setLDoubleCursorValueWrapped(vv, v); }
00689   static ML_DEPRECATED void          fillIntW              (void *vv, const ImageVector &v1, const ImageVector &v2, MLint     v){ fillIntWrapped(vv, v1, v2, v); }
00692   static ML_DEPRECATED void          fillInt64W            (void *vv, const ImageVector &v1, const ImageVector &v2, MLint64   v){ fillInt64Wrapped(vv, v1, v2, v); }
00695   static ML_DEPRECATED void          fillDoubleW           (void *vv, const ImageVector &v1, const ImageVector &v2, MLdouble  v){ fillDoubleWrapped(vv, v1, v2, v); }
00698   static ML_DEPRECATED void          fillLDoubleW          (void *vv, const ImageVector &v1, const ImageVector &v2, MLldouble v){ fillLDoubleWrapped(vv, v1, v2, v); }
00701   static ML_DEPRECATED void          moveFXW               (void *vv)                            { moveCursorXWrapped(vv); }
00704   static ML_DEPRECATED void          moveFYW               (void *vv)                            { moveCursorYWrapped(vv); }
00707   static ML_DEPRECATED void          moveFZW               (void *vv)                            { moveCursorZWrapped(vv); }
00710   static ML_DEPRECATED void          moveFCW               (void *vv)                            { moveCursorCWrapped(vv); }
00713   static ML_DEPRECATED void          moveFTW               (void *vv)                            { moveCursorTWrapped(vv); }
00716   static ML_DEPRECATED void          moveFUW               (void *vv)                            { moveCursorUWrapped(vv); }
00719   static ML_DEPRECATED void          moveBXW               (void *vv)                            { reverseMoveCursorXWrapped(vv); }
00722   static ML_DEPRECATED void          moveBYW               (void *vv)                            { reverseMoveCursorYWrapped(vv); }
00725   static ML_DEPRECATED void          moveBZW               (void *vv)                            { reverseMoveCursorZWrapped(vv); }
00728   static ML_DEPRECATED void          moveBCW               (void *vv)                            { reverseMoveCursorCWrapped(vv); }
00731   static ML_DEPRECATED void          moveBTW               (void *vv)                            { reverseMoveCursorTWrapped(vv); }
00734   static ML_DEPRECATED void          moveBUW               (void *vv)                            { reverseMoveCursorUWrapped(vv); }
00737   static ML_DEPRECATED void          moveOffsetW           (void *vv, const ImageVector &off)    { moveCursorByOffsetWrapped(vv, off); }
00740   static ML_DEPRECATED void          resetCursorW          (void *vv)                            { resetCursorWrapped(vv); }
00743   static ML_DEPRECATED bool          moveCursorFXLFW       (void *vv)                            { return moveCursorXWrapAroundWrapped(vv); }
00744 
00746 
00747 #endif // ML_DEPRECATED
00748 
00749 protected:
00750 
00751   //------------------------------------------------------------------------------------------------------
00752   //------------------------------------------------------------------------------------------------------
00753   //------------------------------------------------------------------------------------------------------
00754   //
00755   //
00756   //                  NOTHING BELOW FOR NORMAL VIRTUAL VOLUME USAGE.
00757   //
00758   //
00759   //------------------------------------------------------------------------------------------------------
00760   //------------------------------------------------------------------------------------------------------
00761   //------------------------------------------------------------------------------------------------------
00762 
00763 
00764   //------------------------------------------------------------------------------------------------------
00766   //------------------------------------------------------------------------------------------------------
00767   void _init(VirtualVolume &vVol);
00768 
00769   //------------------------------------------------------------------------------------------------------
00771   //------------------------------------------------------------------------------------------------------
00772   void _cleanUp();
00773 
00774   //------------------------------------------------------------------------------------------------------
00775   //------------------------------------------------------------------------------------------------------
00776   // GetVoxel, SetVoxel and IsMapped implementations.
00777   //------------------------------------------------------------------------------------------------------
00778   //------------------------------------------------------------------------------------------------------
00779 
00780   //------------------------------------------------------------------------------------------------------
00787   //------------------------------------------------------------------------------------------------------
00789   inline DATATYPE _getVoxel1D (register const ImageVector &pos);
00790   inline DATATYPE _getVoxel2D (register const ImageVector &pos);
00791   inline DATATYPE _getVoxel3D (register const ImageVector &pos);
00792   inline DATATYPE _getVoxel4D (register const ImageVector &pos);
00793   inline DATATYPE _getVoxel5D (register const ImageVector &pos);
00794   inline DATATYPE _getVoxel6D (register const ImageVector &pos);
00795 
00796   inline DATATYPE _getVoxel1DE(register const ImageVector &pos);
00797   inline DATATYPE _getVoxel2DE(register const ImageVector &pos);
00798   inline DATATYPE _getVoxel3DE(register const ImageVector &pos);
00799   inline DATATYPE _getVoxel4DE(register const ImageVector &pos);
00800   inline DATATYPE _getVoxel5DE(register const ImageVector &pos);
00801   inline DATATYPE _getVoxel6DE(register const ImageVector &pos);
00803 
00804   //----------------------------------------------------------------------------------
00811   //----------------------------------------------------------------------------------
00813   inline void _setVoxel1D (register const ImageVector &pos, DATATYPE voxVal);
00814   inline void _setVoxel2D (register const ImageVector &pos, DATATYPE voxVal);
00815   inline void _setVoxel3D (register const ImageVector &pos, DATATYPE voxVal);
00816   inline void _setVoxel4D (register const ImageVector &pos, DATATYPE voxVal);
00817   inline void _setVoxel5D (register const ImageVector &pos, DATATYPE voxVal);
00818   inline void _setVoxel6D (register const ImageVector &pos, DATATYPE voxVal);
00819 
00820   inline void _setVoxel1DE(register const ImageVector &pos, DATATYPE voxVal);
00821   inline void _setVoxel2DE(register const ImageVector &pos, DATATYPE voxVal);
00822   inline void _setVoxel3DE(register const ImageVector &pos, DATATYPE voxVal);
00823   inline void _setVoxel4DE(register const ImageVector &pos, DATATYPE voxVal);
00824   inline void _setVoxel5DE(register const ImageVector &pos, DATATYPE voxVal);
00825   inline void _setVoxel6DE(register const ImageVector &pos, DATATYPE voxVal);
00827 
00828   //----------------------------------------------------------------------------------
00834   //----------------------------------------------------------------------------------
00836   inline bool _isMapped1D (register const ImageVector &pos) const;
00837   inline bool _isMapped2D (register const ImageVector &pos) const;
00838   inline bool _isMapped3D (register const ImageVector &pos) const;
00839   inline bool _isMapped4D (register const ImageVector &pos) const;
00840   inline bool _isMapped5D (register const ImageVector &pos) const;
00841   inline bool _isMapped6D (register const ImageVector &pos) const;
00842 
00843   inline bool _isMapped1DE(register const ImageVector &pos) const;
00844   inline bool _isMapped2DE(register const ImageVector &pos) const;
00845   inline bool _isMapped3DE(register const ImageVector &pos) const;
00846   inline bool _isMapped4DE(register const ImageVector &pos) const;
00847   inline bool _isMapped5DE(register const ImageVector &pos) const;
00848   inline bool _isMapped6DE(register const ImageVector &pos) const;
00850 
00851 
00852   //--------------------------------------------------------------------------------------------------------------------------
00857   //--------------------------------------------------------------------------------------------------------------------------
00859   inline static DATATYPE _getVoxel1DCB  (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel1D(pos);   };
00860   inline static DATATYPE _getVoxel2DCB  (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel2D(pos);   };
00861   inline static DATATYPE _getVoxel3DCB  (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel3D(pos);   };
00862   inline static DATATYPE _getVoxel4DCB  (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel4D(pos);   };
00863   inline static DATATYPE _getVoxel5DCB  (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel5D(pos);   };
00864   inline static DATATYPE _getVoxel6DCB  (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel6D(pos);   };
00865 
00866   inline static DATATYPE _getVoxel1DCBE (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel1DE(pos);  };
00867   inline static DATATYPE _getVoxel2DCBE (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel2DE(pos);  };
00868   inline static DATATYPE _getVoxel3DCBE (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel3DE(pos);  };
00869   inline static DATATYPE _getVoxel4DCBE (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel4DE(pos);  };
00870   inline static DATATYPE _getVoxel5DCBE (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel5DE(pos);  };
00871   inline static DATATYPE _getVoxel6DCBE (register TVirtualVolume *obj, register const ImageVector &pos)                  { return obj->_getVoxel6DE(pos);  };
00872 
00873   inline static void     _setVoxel1DCB  (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel1D(pos, voxVal);  };
00874   inline static void     _setVoxel2DCB  (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel2D(pos, voxVal);  };
00875   inline static void     _setVoxel3DCB  (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel3D(pos, voxVal);  };
00876   inline static void     _setVoxel4DCB  (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel4D(pos, voxVal);  };
00877   inline static void     _setVoxel5DCB  (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel5D(pos, voxVal);  };
00878   inline static void     _setVoxel6DCB  (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel6D(pos, voxVal);  };
00879 
00880   inline static void     _setVoxel1DCBE (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel1DE(pos, voxVal); };
00881   inline static void     _setVoxel2DCBE (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel2DE(pos, voxVal); };
00882   inline static void     _setVoxel3DCBE (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel3DE(pos, voxVal); };
00883   inline static void     _setVoxel4DCBE (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel4DE(pos, voxVal); };
00884   inline static void     _setVoxel5DCBE (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel5DE(pos, voxVal); };
00885   inline static void     _setVoxel6DCBE (register TVirtualVolume *obj, register const ImageVector &pos, DATATYPE voxVal) { obj->_setVoxel6DE(pos, voxVal); };
00886 
00887   inline static bool     _isMapped1DCB  (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped1D (pos);  }
00888   inline static bool     _isMapped2DCB  (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped2D (pos);  };
00889   inline static bool     _isMapped3DCB  (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped3D (pos);  };
00890   inline static bool     _isMapped4DCB  (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped4D (pos);  };
00891   inline static bool     _isMapped5DCB  (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped5D (pos);  };
00892   inline static bool     _isMapped6DCB  (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped6D (pos);  };
00893 
00894   inline static bool     _isMapped1DCBE (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped1DE(pos);  };
00895   inline static bool     _isMapped2DCBE (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped2DE(pos);  };
00896   inline static bool     _isMapped3DCBE (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped3DE(pos);  };
00897   inline static bool     _isMapped4DCBE (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped4DE(pos);  };
00898   inline static bool     _isMapped5DCBE (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped5DE(pos);  };
00899   inline static bool     _isMapped6DCBE (register const TVirtualVolume *obj, register const ImageVector &pos)            { return obj->_isMapped6DE(pos);  };
00901 
00902 
00903 
00904   //----------------------------------------------------------------------------------
00905   //----------------------------------------------------------------------------------
00907   //----------------------------------------------------------------------------------
00908   //----------------------------------------------------------------------------------
00909 
00910   //----------------------------------------------------------------------------------
00912   //----------------------------------------------------------------------------------
00914   inline void _setCursorPos1D (register const ImageVector & p);
00915   inline void _setCursorPos2D (register const ImageVector & p);
00916   inline void _setCursorPos3D (register const ImageVector & p);
00917   inline void _setCursorPos4D (register const ImageVector & p);
00918   inline void _setCursorPos5D (register const ImageVector & p);
00919   inline void _setCursorPos6D (register const ImageVector & p);
00920 
00921   inline void _setCursorPos1DE(register const ImageVector & p);
00922   inline void _setCursorPos2DE(register const ImageVector & p);
00923   inline void _setCursorPos3DE(register const ImageVector & p);
00924   inline void _setCursorPos4DE(register const ImageVector & p);
00925   inline void _setCursorPos5DE(register const ImageVector & p);
00926   inline void _setCursorPos6DE(register const ImageVector & p);
00928 
00929   //--------------------------------------------------------------------------------------------------------------------------
00931   //--------------------------------------------------------------------------------------------------------------------------
00933   inline static void _setCursorPos1DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos1D(p);  };
00934   inline static void _setCursorPos2DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos2D(p);  };
00935   inline static void _setCursorPos3DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos3D(p);  };
00936   inline static void _setCursorPos4DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos4D(p);  };
00937   inline static void _setCursorPos5DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos5D(p);  };
00938   inline static void _setCursorPos6DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos6D(p);  };
00939 
00940   inline static void _setCursorPos1DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos1DE(p); };
00941   inline static void _setCursorPos2DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos2DE(p); };
00942   inline static void _setCursorPos3DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos3DE(p); };
00943   inline static void _setCursorPos4DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos4DE(p); };
00944   inline static void _setCursorPos5DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos5DE(p); };
00945   inline static void _setCursorPos6DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_setCursorPos6DE(p); };
00947 
00948 
00949   //----------------------------------------------------------------------------------
00950   //----------------------------------------------------------------------------------
00952   //----------------------------------------------------------------------------------
00953   //----------------------------------------------------------------------------------
00954 
00955   //----------------------------------------------------------------------------------
00957   //----------------------------------------------------------------------------------
00959   inline void _moveCursorOffset1D (register const ImageVector & p);
00960   inline void _moveCursorOffset2D (register const ImageVector & p);
00961   inline void _moveCursorOffset3D (register const ImageVector & p);
00962   inline void _moveCursorOffset4D (register const ImageVector & p);
00963   inline void _moveCursorOffset5D (register const ImageVector & p);
00964   inline void _moveCursorOffset6D (register const ImageVector & p);
00965 
00966   inline void _moveCursorOffset1DE(register const ImageVector & p);
00967   inline void _moveCursorOffset2DE(register const ImageVector & p);
00968   inline void _moveCursorOffset3DE(register const ImageVector & p);
00969   inline void _moveCursorOffset4DE(register const ImageVector & p);
00970   inline void _moveCursorOffset5DE(register const ImageVector & p);
00971   inline void _moveCursorOffset6DE(register const ImageVector & p);
00973 
00974   //--------------------------------------------------------------------------------------------------------------------------
00976   //--------------------------------------------------------------------------------------------------------------------------
00978   inline static void _moveCursorOffset1DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset1D(p);  };
00979   inline static void _moveCursorOffset2DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset2D(p);  };
00980   inline static void _moveCursorOffset3DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset3D(p);  };
00981   inline static void _moveCursorOffset4DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset4D(p);  };
00982   inline static void _moveCursorOffset5DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset5D(p);  };
00983   inline static void _moveCursorOffset6DCB (register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset6D(p);  };
00984 
00985   inline static void _moveCursorOffset1DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset1DE(p); };
00986   inline static void _moveCursorOffset2DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset2DE(p); };
00987   inline static void _moveCursorOffset3DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset3DE(p); };
00988   inline static void _moveCursorOffset4DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset4DE(p); };
00989   inline static void _moveCursorOffset5DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset5DE(p); };
00990   inline static void _moveCursorOffset6DCBE(register TVirtualVolume *obj, register const ImageVector &p) { obj->_moveCursorOffset6DE(p); };
00992 
00993 
00994   //----------------------------------------------------------------------------------
00995   //----------------------------------------------------------------------------------
00997   //----------------------------------------------------------------------------------
00998   //----------------------------------------------------------------------------------
00999 
01000   //--------------------------------------------------------------------------------------------------------------------------
01002   //--------------------------------------------------------------------------------------------------------------------------
01004   inline void _moveFX()  { _cPos.x++; _cIdx += _pStrides.x; if ((_cPos.x & _idxMask.x) == 0){ _cPageIdx += _strides.x; } }
01005   inline void _moveFY()  { _cPos.y++; _cIdx += _pStrides.y; if ((_cPos.y & _idxMask.y) == 0){ _cPageIdx += _strides.y; } }
01006   inline void _moveFZ()  { _cPos.z++; _cIdx += _pStrides.z; if ((_cPos.z & _idxMask.z) == 0){ _cPageIdx += _strides.z; } }
01007   inline void _moveFC()  { _cPos.c++; _cIdx += _pStrides.c; if ((_cPos.c & _idxMask.c) == 0){ _cPageIdx += _strides.c; } }
01008   inline void _moveFT()  { _cPos.t++; _cIdx += _pStrides.t; if ((_cPos.t & _idxMask.t) == 0){ _cPageIdx += _strides.t; } }
01009   inline void _moveFU()  { _cPos.u++; _cIdx += _pStrides.u; if ((_cPos.u & _idxMask.u) == 0){ _cPageIdx += _strides.u; } }
01010 
01011   inline void _moveFXE() { if (_cPos.x < _extD.x){ _moveFX(); } else{ throw(ML_OUT_OF_RANGE); } }
01012   inline void _moveFYE() { if (_cPos.y < _extD.y){ _moveFY(); } else{ throw(ML_OUT_OF_RANGE); } }
01013   inline void _moveFZE() { if (_cPos.z < _extD.z){ _moveFZ(); } else{ throw(ML_OUT_OF_RANGE); } }
01014   inline void _moveFCE() { if (_cPos.c < _extD.c){ _moveFC(); } else{ throw(ML_OUT_OF_RANGE); } }
01015   inline void _moveFTE() { if (_cPos.t < _extD.t){ _moveFT(); } else{ throw(ML_OUT_OF_RANGE); } }
01016   inline void _moveFUE() { if (_cPos.u < _extD.u){ _moveFU(); } else{ throw(ML_OUT_OF_RANGE); } }
01018 
01019   //--------------------------------------------------------------------------------------------------------------------------
01021   //--------------------------------------------------------------------------------------------------------------------------
01023   inline static void _moveFXCB (register TVirtualVolume *obj) { obj->_moveFX();  }
01024   inline static void _moveFYCB (register TVirtualVolume *obj) { obj->_moveFY();  }
01025   inline static void _moveFZCB (register TVirtualVolume *obj) { obj->_moveFZ();  }
01026   inline static void _moveFCCB (register TVirtualVolume *obj) { obj->_moveFC();  }
01027   inline static void _moveFTCB (register TVirtualVolume *obj) { obj->_moveFT();  }
01028   inline static void _moveFUCB (register TVirtualVolume *obj) { obj->_moveFU();  }
01029 
01030   inline static void _moveFXCBE(register TVirtualVolume *obj) { obj->_moveFXE(); }
01031   inline static void _moveFYCBE(register TVirtualVolume *obj) { obj->_moveFYE(); }
01032   inline static void _moveFZCBE(register TVirtualVolume *obj) { obj->_moveFZE(); }
01033   inline static void _moveFCCBE(register TVirtualVolume *obj) { obj->_moveFCE(); }
01034   inline static void _moveFTCBE(register TVirtualVolume *obj) { obj->_moveFTE(); }
01035   inline static void _moveFUCBE(register TVirtualVolume *obj) { obj->_moveFUE(); }
01037 
01038   //--------------------------------------------------------------------------------------------------------------------------
01040   //--------------------------------------------------------------------------------------------------------------------------
01042   inline void _moveBX()  { _cPos.x--; _cIdx -= _pStrides.x; if ((_cPos.x & _idxMask.x) == _idxMask.x){ _cPageIdx -= _strides.x; } }
01043   inline void _moveBY()  { _cPos.y--; _cIdx -= _pStrides.y; if ((_cPos.y & _idxMask.y) == _idxMask.y){ _cPageIdx -= _strides.y; } }
01044   inline void _moveBZ()  { _cPos.z--; _cIdx -= _pStrides.z; if ((_cPos.z & _idxMask.z) == _idxMask.z){ _cPageIdx -= _strides.z; } }
01045   inline void _moveBC()  { _cPos.c--; _cIdx -= _pStrides.c; if ((_cPos.c & _idxMask.c) == _idxMask.c){ _cPageIdx -= _strides.c; } }
01046   inline void _moveBT()  { _cPos.t--; _cIdx -= _pStrides.t; if ((_cPos.t & _idxMask.t) == _idxMask.t){ _cPageIdx -= _strides.t; } }
01047   inline void _moveBU()  { _cPos.u--; _cIdx -= _pStrides.u; if ((_cPos.u & _idxMask.u) == _idxMask.u){ _cPageIdx -= _strides.u; } }
01048 
01051 #define _VV_MOVEBE_TEST(Q) if (_cPos.Q >= 0){ _cPageIdx -= _strides.Q; } else{ _cPos.Q++; _cIdx += _pStrides.Q; throw(ML_OUT_OF_RANGE); }
01052 
01053   inline void _moveBXE() { _cPos.x--; _cIdx -= _pStrides.x; if ((_cPos.x & _idxMask.x) == _idxMask.x){ _VV_MOVEBE_TEST(x); } }
01054   inline void _moveBYE() { _cPos.y--; _cIdx -= _pStrides.y; if ((_cPos.y & _idxMask.y) == _idxMask.y){ _VV_MOVEBE_TEST(y); } }
01055   inline void _moveBZE() { _cPos.z--; _cIdx -= _pStrides.z; if ((_cPos.z & _idxMask.z) == _idxMask.z){ _VV_MOVEBE_TEST(z); } }
01056   inline void _moveBCE() { _cPos.c--; _cIdx -= _pStrides.c; if ((_cPos.c & _idxMask.c) == _idxMask.c){ _VV_MOVEBE_TEST(c); } }
01057   inline void _moveBTE() { _cPos.t--; _cIdx -= _pStrides.t; if ((_cPos.t & _idxMask.t) == _idxMask.t){ _VV_MOVEBE_TEST(t); } }
01058   inline void _moveBUE() { _cPos.u--; _cIdx -= _pStrides.u; if ((_cPos.u & _idxMask.u) == _idxMask.u){ _VV_MOVEBE_TEST(u); } }
01059 #undef _VV_MOVEBE_TEST
01060 
01061 
01062 
01063 
01064   //--------------------------------------------------------------------------------------------------------------------------
01066   //--------------------------------------------------------------------------------------------------------------------------
01068   inline static void _moveBXCB (register TVirtualVolume *obj) { obj->_moveBX();  }
01069   inline static void _moveBYCB (register TVirtualVolume *obj) { obj->_moveBY();  }
01070   inline static void _moveBZCB (register TVirtualVolume *obj) { obj->_moveBZ();  }
01071   inline static void _moveBCCB (register TVirtualVolume *obj) { obj->_moveBC();  }
01072   inline static void _moveBTCB (register TVirtualVolume *obj) { obj->_moveBT();  }
01073   inline static void _moveBUCB (register TVirtualVolume *obj) { obj->_moveBU();  }
01074 
01075   inline static void _moveBXCBE(register TVirtualVolume *obj) { obj->_moveBXE(); }
01076   inline static void _moveBYCBE(register TVirtualVolume *obj) { obj->_moveBYE(); }
01077   inline static void _moveBZCBE(register TVirtualVolume *obj) { obj->_moveBZE(); }
01078   inline static void _moveBCCBE(register TVirtualVolume *obj) { obj->_moveBCE(); }
01079   inline static void _moveBTCBE(register TVirtualVolume *obj) { obj->_moveBTE(); }
01080   inline static void _moveBUCBE(register TVirtualVolume *obj) { obj->_moveBUE(); }
01082 
01083 
01084 
01085 private:
01086 
01088   typedef DATATYPE (*GetVoxelFunc)        (register TVirtualVolume *obj, register const ImageVector &p);
01089 
01091   typedef void     (*SetVoxelFunc)        (register TVirtualVolume *obj, register const ImageVector &p, register DATATYPE voxVal);
01092 
01094   typedef bool     (*IsMappedFunc)        (register const TVirtualVolume *obj, register const ImageVector &p);
01095 
01097   typedef void     (*SetCursorPosFunc)    (register TVirtualVolume *obj, register const ImageVector &p);
01098 
01100   typedef void     (*MoveCursorOffsetFunc)(register TVirtualVolume *obj, register const ImageVector &p);
01101 
01103   typedef void     (*MoveCursorPosFunc)   (register TVirtualVolume *obj);
01104 
01108   VirtualVolume       *_convenienceInstance;
01109 
01111   VirtualVolume       *_virtVol;
01112 
01114   ImageVector               _ext;
01115 
01117   ImageVector               _extD;
01118 
01120   PageBuffer          *_pageArray;
01121 
01124   ImageVector               _rShift;
01125 
01127   ImageVector               _strides;
01128 
01130   ImageVector               _pStrides;
01131 
01133   ImageVector               _idxMask;
01134 
01136   GetVoxelFunc         _getVoxelFunc;
01137 
01139   SetVoxelFunc         _setVoxelFunc;
01140 
01142   IsMappedFunc         _isMappedFunc;
01143 
01145   SetCursorPosFunc     _setCursorPosFunc;
01146 
01148   MoveCursorOffsetFunc _moveCursorOffsetFunc;
01149 
01151 
01152   MoveCursorPosFunc    _moveFXFunc;
01153   MoveCursorPosFunc    _moveFYFunc;
01154   MoveCursorPosFunc    _moveFZFunc;
01155   MoveCursorPosFunc    _moveFCFunc;
01156   MoveCursorPosFunc    _moveFTFunc;
01157   MoveCursorPosFunc    _moveFUFunc;
01158 
01159   MoveCursorPosFunc    _moveBXFunc;
01160   MoveCursorPosFunc    _moveBYFunc;
01161   MoveCursorPosFunc    _moveBZFunc;
01162   MoveCursorPosFunc    _moveBCFunc;
01163   MoveCursorPosFunc    _moveBTFunc;
01164   MoveCursorPosFunc    _moveBUFunc;
01166 
01168   ImageVector               _cPos;
01169 
01171   MLuint               _cPageIdx;
01172 
01174   MLuint               _cIdx;
01175 
01177   bool                 _useExc;
01178 };
01179 
01180 //--------------------------------------------------------------------------------------------------------
01181 // END OF USER INTERFACE
01182 //--------------------------------------------------------------------------------------------------------
01183 
01184 
01185 
01186 
01187 
01188 //--------------------------------------------------------------------------------------------------------
01189 //--------------------------------------------------------------------------------------------------------
01190 // Implementation part of Virtual Volume.
01191 //--------------------------------------------------------------------------------------------------------
01192 //--------------------------------------------------------------------------------------------------------
01193 
01194 template <typename DATATYPE>
01195 inline void TVirtualVolume<DATATYPE>::getValues(register const ImageVector *pos, DATATYPE *results, MLuint num)
01196 {
01197   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::getValues()");
01198 
01199   for (register MLuint c=0; c < num; c++){
01200     *results = _getVoxelFunc(this, *pos);
01201     results++;
01202     pos++;
01203   }
01204 }
01205 
01206 template <typename DATATYPE>
01207 inline void     TVirtualVolume<DATATYPE>::setCursorValue(DATATYPE val)
01208 {
01209   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::setCursorValue(DATATYPE val)");
01210 
01211   PageBuffer *page = _pageArray + _cPageIdx;
01212   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[_cIdx] = val;
01213   page->_locked = true;
01214 }
01215 
01217 template <typename DATATYPE>
01218 inline DATATYPE TVirtualVolume<DATATYPE>::getCursorValue()
01219 {
01220   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::getCursorValue()");
01221 
01222   PageBuffer *page = _pageArray + _cPageIdx;
01223   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[_cIdx];
01224 }
01225 
01227 template <typename DATATYPE>
01228 inline void TVirtualVolume<DATATYPE>::resetCursor()
01229 {
01230   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::resetCursor()");
01231 
01232   static const ImageVector zeroPos(0);
01233   _setCursorPosFunc(this, zeroPos);
01234 }
01235 
01245 template <typename DATATYPE>
01246 inline bool TVirtualVolume<DATATYPE>::moveCursorXWrapAround()
01247 {
01248   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::moveCursorXWrapAround()")
01249 
01250   if (_cPos.x < _extD.x){ _moveFXFunc(this); return true; }
01251   else{
01252     if (_cPos.y < _extD.y){ _moveFYFunc(this); }
01253     else{
01254       if (_cPos.z < _extD.z){ _moveFZFunc(this); }
01255       else{
01256         if (_cPos.c < _extD.c){ _moveFCFunc(this); }
01257         else{
01258           if (_cPos.t < _extD.t){ _moveFTFunc(this); }
01259           else{
01260             if (_cPos.u < _extD.u){ _moveFUFunc(this); }
01261             else{
01262               // Just return false but do not move cursor any
01263               // further. This makes loops much easier.
01264               return false;
01265             }
01266             _cPos.t = 0;
01267           }
01268           _cPos.c = 0;
01269         }
01270         _cPos.z = 0;
01271       }
01272       _cPos.y = 0;
01273     }
01274     _cPos.x = 0;
01275 
01276     // Cursor position has been reset in any component. Update settings.
01277     _setCursorPosFunc(this, _cPos);
01278     return true;
01279   }
01280 }
01281 
01283 template <typename DATATYPE>
01284 void TVirtualVolume<DATATYPE>::fill(const SubImageBox &box, DATATYPE value)
01285 {
01286   ML_TRACE_IN("TVirtualVolume<DATATYPE>::fill(const SubImageBox &box, DATATYPE value)")
01287 
01288   // Restrict size of filled area to valid image regions.
01289   SubImageBox subImgBox = SubImageBox::intersect(box, _virtVol->getBox());
01290 
01291   // Note: Future versions could optimise inner loop significantly
01292   //       by filling complete rows in pages with memcpy statements
01293   //       from a prefilled row (or even by using subimage copies
01294   //       from a prefilled page if many pages are filled).
01295   ImageVector p;
01296   for (p.u=subImgBox.v1.u;  p.u<=subImgBox.v2.u;  p.u++){
01297     for (p.t=subImgBox.v1.t;  p.t<=subImgBox.v2.t;  p.t++){
01298       for (p.c=subImgBox.v1.c;  p.c<=subImgBox.v2.c;  p.c++){
01299         for (p.z=subImgBox.v1.z;  p.z<=subImgBox.v2.z;  p.z++){
01300           for (p.y=subImgBox.v1.y;  p.y<=subImgBox.v2.y;  p.y++){
01301             for (p.x=subImgBox.v1.x;  p.x<=subImgBox.v2.x;  p.x++){
01302               setValue(p, value);
01303             } // x
01304           }
01305         }
01306       }
01307     }
01308   } // u
01309 }
01310 
01311 //-----------------------------------------------------------------------------------------------
01313 //-----------------------------------------------------------------------------------------------
01314 template <typename DATATYPE>
01315 void TVirtualVolume<DATATYPE>::copyToSubImage(TSubImage<DATATYPE> &outSubImg)
01316 {
01317   ML_TRACE_IN("TVirtualVolume<DATATYPE>::copyToSubImage(TSubImage<DATATYPE> &outSubImg)")
01318 
01319   _virtVol->copyToSubImage(outSubImg);
01320 }
01321 
01322 //-----------------------------------------------------------------------------------------------
01324 //-----------------------------------------------------------------------------------------------
01325 template <typename DATATYPE>
01326 void TVirtualVolume<DATATYPE>::copyFromSubImage(const TSubImage<DATATYPE> &inImg, const SubImageBox &box, const ImageVector &pos)
01327 {
01328   ML_TRACE_IN("TVirtualVolume<DATATYPE>::copyFromSubImage(const TSubImage<DATATYPE> &inImg, const SubImageBox &box, const ImageVector &pos)")
01329 
01330   // Get extents of subImg as box.
01331   SubImageBox inBox = inImg.getBoxFromImageExtent();
01332 
01333   // Determine valid area in inImg which can be copied (overlap of inBox and box).
01334   // (Source area)
01335   SubImageBox srcBox = SubImageBox::intersect(inBox, box);
01336 
01337   // Get extents of virtualVolume as box.
01338   SubImageBox vvBox = _virtVol->getBox();
01339 
01340   // Determine the area where srcBox is copied to.
01341   SubImageBox tvvBox;
01342   tvvBox.v1 = srcBox.v1 + pos;
01343   tvvBox.v2 = srcBox.v2 + pos;
01344 
01345   // Restrict tvvBox to valid virtualVolume extents. (Destination area)
01346   SubImageBox dstBox = SubImageBox::intersect(vvBox, tvvBox);
01347 
01348   // Iterate over all voxels of the destination area in the virtual volume.
01349   ImageVector dPos, sPos;
01350   for (dPos.u=dstBox.v1.u, sPos.u = srcBox.v1.u;  dPos.u<=dstBox.v2.u;  dPos.u++, sPos.u++){
01351     for (dPos.t=dstBox.v1.t, sPos.t = srcBox.v1.t;  dPos.t<=dstBox.v2.t;  dPos.t++, sPos.t++){
01352       for (dPos.c=dstBox.v1.c, sPos.c = srcBox.v1.c;  dPos.c<=dstBox.v2.c;  dPos.c++, sPos.c++){
01353         for (dPos.z=dstBox.v1.z, sPos.z = srcBox.v1.z;  dPos.z<=dstBox.v2.z;  dPos.z++, sPos.z++){
01354           for (dPos.y=dstBox.v1.y, sPos.y = srcBox.v1.y;  dPos.y<=dstBox.v2.y;  dPos.y++, sPos.y++){
01355             for (dPos.x=dstBox.v1.x, sPos.x = srcBox.v1.x;  dPos.x<=dstBox.v2.x;  dPos.x++, sPos.x++){
01356               setValue(dPos, inImg.getSubImageValue(sPos));
01357             } // x
01358           }
01359         }
01360       }
01361     }
01362   } // u
01363 }
01364 
01368 template <typename DATATYPE>
01369 void TVirtualVolume<DATATYPE>::_init(VirtualVolume &vVol)
01370 {
01371   ML_TRACE_IN("TVirtualVolume<DATATYPE>::_init(VirtualVolume &vVol)")
01372 
01373   // To avoid a typical programming error force a fatal error if the template data type
01374   // does not match the virtual volume data type.
01375   if (vVol.getDataType() != MLGetDataTypeFromPtr(static_cast<DATATYPE*>(NULL))){
01376     ML_PRINT_FATAL_ERROR("TVirtualVolume<DATATYPE>::_init()", ML_BAD_DATA_TYPE,
01377                          "Mismatch of data type of virtual volume and template typename");
01378   }
01379 
01380   // Get some parameters from virtual volume instance.
01381   // _convenienceInstance = ...;   // Must be initialized in all constructors before.
01382   _virtVol    = &vVol;
01383   _ext        = vVol._origVolumeExt;
01384   _extD       = vVol._origVolumeExt-ImageVector(1);
01385   _pageArray  = vVol._pageArray;
01386   _rShift     = vVol._rShift;
01387   _strides    = vVol._strides;
01388   _pStrides   = vVol._pStrides;
01389   _idxMask    = vVol._idxMask;
01390   _useExc     = vVol._areExceptionsOn;
01391 
01392   // Set cursor position, cursor index and cursor page.
01393   _cPos       = ImageVector(0);
01394   _cIdx       = 0;
01395   _cPageIdx   = 0;
01396 
01397   // Dependent on the dimension of the image we can select different read/write
01398   // functions. We do this to avoid unnecessary calculations of 6d coordinates
01399   // if the volume has only e.g. 2 dimensions.
01400   if (_useExc){
01401 
01403     _moveFXFunc = _moveFXCBE;
01404     _moveFYFunc = _moveFYCBE;
01405     _moveFZFunc = _moveFZCBE;
01406     _moveFCFunc = _moveFCCBE;
01407     _moveFTFunc = _moveFTCBE;
01408     _moveFUFunc = _moveFUCBE;
01409 
01410     _moveBXFunc = _moveBXCBE;
01411     _moveBYFunc = _moveBYCBE;
01412     _moveBZFunc = _moveBZCBE;
01413     _moveBCFunc = _moveBCCBE;
01414     _moveBTFunc = _moveBTCBE;
01415     _moveBUFunc = _moveBUCBE;
01416 
01417     // Set the correct setValue/getValue and setCursorPosition functions.
01418     switch (vVol.getDim()){
01419       case 1:
01420         _getVoxelFunc         = _getVoxel1DCBE;
01421         _setVoxelFunc         = _setVoxel1DCBE;
01422         _setCursorPosFunc     = _setCursorPos1DCBE;
01423         _moveCursorOffsetFunc = _moveCursorOffset1DCBE;
01424         _isMappedFunc         = _isMapped1DCBE;
01425         break;
01426       case 2:
01427         _getVoxelFunc         = _getVoxel2DCBE;
01428         _setVoxelFunc         = _setVoxel2DCBE;
01429         _setCursorPosFunc     = _setCursorPos2DCBE;
01430         _moveCursorOffsetFunc = _moveCursorOffset2DCBE;
01431         _isMappedFunc         = _isMapped2DCBE;
01432         break;
01433       case 3:
01434         _getVoxelFunc         = _getVoxel3DCBE;
01435         _setVoxelFunc         = _setVoxel3DCBE;
01436         _setCursorPosFunc     = _setCursorPos3DCBE;
01437         _moveCursorOffsetFunc = _moveCursorOffset3DCBE;
01438         _isMappedFunc         = _isMapped3DCBE;
01439         break;
01440       case 4:
01441         _getVoxelFunc         = _getVoxel4DCBE;
01442         _setVoxelFunc         = _setVoxel4DCBE;
01443         _setCursorPosFunc     = _setCursorPos4DCBE;
01444         _moveCursorOffsetFunc = _moveCursorOffset4DCBE;
01445         _isMappedFunc         = _isMapped4DCBE;
01446         break;
01447       case 5:
01448         _getVoxelFunc         = _getVoxel5DCBE;
01449         _setVoxelFunc         = _setVoxel5DCBE;
01450         _setCursorPosFunc     = _setCursorPos5DCBE;
01451         _moveCursorOffsetFunc = _moveCursorOffset5DCBE;
01452         _isMappedFunc         = _isMapped5DCBE;
01453         break;
01454       case 6:
01455         _getVoxelFunc         = _getVoxel6DCBE;
01456         _setVoxelFunc         = _setVoxel6DCBE;
01457         _setCursorPosFunc     = _setCursorPos6DCBE;
01458         _moveCursorOffsetFunc = _moveCursorOffset6DCBE;
01459         _isMappedFunc         = _isMapped6DCBE;
01460         break;
01461       default:
01462         _getVoxelFunc         = _getVoxel6DCBE;
01463         _setVoxelFunc         = _setVoxel6DCBE;
01464         _moveCursorOffsetFunc = _moveCursorOffset6DCBE;
01465         _setCursorPosFunc     = _setCursorPos6DCBE;
01466         _isMappedFunc         = _isMapped6DCBE;
01467         _virtVol->invalidate();
01468         throw(ML_BAD_DIMENSION);
01469         break;
01470     }
01471   }
01472   else{
01473 
01475     _moveFXFunc = _moveFXCB;
01476     _moveFYFunc = _moveFYCB;
01477     _moveFZFunc = _moveFZCB;
01478     _moveFCFunc = _moveFCCB;
01479     _moveFTFunc = _moveFTCB;
01480     _moveFUFunc = _moveFUCB;
01481 
01482     _moveBXFunc = _moveBXCB;
01483     _moveBYFunc = _moveBYCB;
01484     _moveBZFunc = _moveBZCB;
01485     _moveBCFunc = _moveBCCB;
01486     _moveBTFunc = _moveBTCB;
01487     _moveBUFunc = _moveBUCB;
01488 
01489     // Set the correct setValue/getValue and setCursorPosition functions.
01490     switch (vVol.getDim()){
01491       case 1:
01492         _getVoxelFunc         = _getVoxel1DCB;
01493         _setVoxelFunc         = _setVoxel1DCB;
01494         _setCursorPosFunc     = _setCursorPos1DCB;
01495         _moveCursorOffsetFunc = _moveCursorOffset1DCB;
01496         _isMappedFunc         = _isMapped1DCB;
01497         break;
01498       case 2:
01499         _getVoxelFunc         = _getVoxel2DCB;
01500         _setVoxelFunc         = _setVoxel2DCB;
01501         _setCursorPosFunc     = _setCursorPos2DCB;
01502         _moveCursorOffsetFunc = _moveCursorOffset2DCB;
01503         _isMappedFunc         = _isMapped2DCB;
01504         break;
01505       case 3:
01506         _getVoxelFunc         = _getVoxel3DCB;
01507         _setVoxelFunc         = _setVoxel3DCB;
01508         _setCursorPosFunc     = _setCursorPos3DCB;
01509         _moveCursorOffsetFunc = _moveCursorOffset3DCB;
01510         _isMappedFunc         = _isMapped3DCB;
01511         break;
01512       case 4:
01513         _getVoxelFunc         = _getVoxel4DCB;
01514         _setVoxelFunc         = _setVoxel4DCB;
01515         _setCursorPosFunc     = _setCursorPos4DCB;
01516         _moveCursorOffsetFunc = _moveCursorOffset4DCB;
01517         _isMappedFunc         = _isMapped4DCB;
01518         break;
01519       case 5:
01520         _getVoxelFunc         = _getVoxel5DCB;
01521         _setVoxelFunc         = _setVoxel5DCB;
01522         _setCursorPosFunc     = _setCursorPos5DCB;
01523         _moveCursorOffsetFunc = _moveCursorOffset5DCB;
01524         _isMappedFunc         = _isMapped5DCB;
01525         break;
01526       case 6:
01527         _getVoxelFunc         = _getVoxel6DCB;
01528         _setVoxelFunc         = _setVoxel6DCB;
01529         _setCursorPosFunc     = _setCursorPos6DCB;
01530         _moveCursorOffsetFunc = _moveCursorOffset6DCB;
01531         _isMappedFunc         = _isMapped6DCB;
01532         break;
01533       default:
01534         _getVoxelFunc         = _getVoxel6DCB;
01535         _setVoxelFunc         = _setVoxel6DCB;
01536         _setCursorPosFunc     = _setCursorPos6DCB;
01537         _moveCursorOffsetFunc = _moveCursorOffset6DCB;
01538         _isMappedFunc         = _isMapped6DCBE;
01539         _virtVol->invalidate();
01540         ML_PRINT_ERROR("TVirtualVolume::_init()", ML_BAD_DIMENSION, "Invalid image dimension. Using dimension 6. \n");
01541         break;
01542     }
01543   }
01544 }
01545 
01547 template <typename DATATYPE>
01548 void TVirtualVolume<DATATYPE>::_cleanUp()
01549 {
01550   ML_TRACE_IN("TVirtualVolume<DATATYPE>::_cleanUp()");
01551 
01552   // _convenienceInstance = ...;   // Must be handled in destructor explicitly.
01553   _virtVol              = NULL;
01554   _ext                  = ImageVector(0);
01555   _extD                 = ImageVector(0);
01556   _pageArray            = NULL;
01557   _rShift               = ImageVector(0);
01558   _strides              = ImageVector(0);
01559   _pStrides             = ImageVector(0);
01560   _getVoxelFunc         = NULL;
01561   _setVoxelFunc         = NULL;
01562   _setCursorPosFunc     = NULL;
01563   _moveCursorOffsetFunc = NULL;
01564   _isMappedFunc         = NULL;
01565   _moveFXFunc           = NULL;
01566   _moveFYFunc           = NULL;
01567   _moveFZFunc           = NULL;
01568   _moveFCFunc           = NULL;
01569   _moveFTFunc           = NULL;
01570   _moveFUFunc           = NULL;
01571   _moveBXFunc           = NULL;
01572   _moveBYFunc           = NULL;
01573   _moveBZFunc           = NULL;
01574   _moveBCFunc           = NULL;
01575   _moveBTFunc           = NULL;
01576   _moveBUFunc           = NULL;
01577   _idxMask              = ImageVector(0);
01578   _cPos                 = ImageVector(0);
01579   _cIdx                 = 0;
01580   _cPageIdx             = 0;
01581   _useExc               = false;
01582 }
01583 
01584 
01585 
01586 //----------------------------------------------------------------------------------------------------------
01587 //  GetVoxel
01588 //----------------------------------------------------------------------------------------------------------
01589 
01591 template <typename DATATYPE>
01592 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel1D(register const ImageVector &pos)
01593 {
01594   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel1D(register const ImageVector &pos)");
01595 
01596   register PageBuffer * const page = _pageArray + (pos.x >> _rShift.x);
01597   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x];
01598 };
01599 
01601 template <typename DATATYPE>
01602 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel1DE(register const ImageVector &pos)
01603 {
01604   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel1DE(register const ImageVector &pos)");
01605 
01606   const register MLint px = pos.x;
01607   if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
01608   register PageBuffer * const page = _pageArray + (px >> _rShift.x);
01609   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px];
01610 };
01611 
01612 
01614 template <typename DATATYPE>
01615 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel2D(register const ImageVector &pos)
01616 {
01617   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel2D(register const ImageVector &pos)");
01618 
01619   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) + (pos.y >> _rShift.y)*_strides.y);
01620   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x+ pos.y*_pStrides.y];
01621 };
01622 
01624 template <typename DATATYPE>
01625 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel2DE(register const ImageVector &pos)
01626 {
01627   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel2DE(register const ImageVector &pos)");
01628 
01629   const register MLint px = pos.x;
01630   const register MLint py = pos.y;
01631   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
01632   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) + (py >> _rShift.y)*_strides.y);
01633   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px+ py*_pStrides.y];
01634 };
01635 
01636 
01637 
01639 template <typename DATATYPE>
01640 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel3D(register const ImageVector &pos)
01641 {
01642   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel3D(register const ImageVector &pos)");
01643 
01644   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01645                                                    (pos.y >> _rShift.y)*_strides.y +
01646                                                    (pos.z >> _rShift.z)*_strides.z);
01647   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x + pos.y*_pStrides.y + pos.z*_pStrides.z];
01648 };
01649 
01651 template <typename DATATYPE>
01652 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel3DE(register const ImageVector &pos)
01653 {
01654   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel3DE(register const ImageVector &pos)");
01655 
01656   const register MLint px = pos.x;
01657   const register MLint py = pos.y;
01658   const register MLint pz = pos.z;
01659   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
01660       (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
01661   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
01662                                                    (py >> _rShift.y)*_strides.y +
01663                                                    (pz >> _rShift.z)*_strides.z);
01664   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px + py*_pStrides.y + pz*_pStrides.z];
01665 };
01666 
01667 
01668 
01670 template <typename DATATYPE>
01671 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel4D(register const ImageVector &pos)
01672 {
01673   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel4D(register const ImageVector &pos)");
01674 
01675   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01676                                                    (pos.y >> _rShift.y)*_strides.y +
01677                                                    (pos.z >> _rShift.z)*_strides.z +
01678                                                    (pos.c >> _rShift.c)*_strides.c);
01679   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
01680                                                            pos.y*_pStrides.y +
01681                                                            pos.z*_pStrides.z +
01682                                                            pos.c*_pStrides.c];
01683 };
01684 
01686 template <typename DATATYPE>
01687 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel4DE(register const ImageVector &pos)
01688 {
01689   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel4DE(register const ImageVector &pos)");
01690 
01691   const register MLint px = pos.x;
01692   const register MLint py = pos.y;
01693   const register MLint pz = pos.z;
01694   const register MLint pc = pos.c;
01695   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
01696       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
01697   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
01698                                                    (py >> _rShift.y)*_strides.y +
01699                                                    (pz >> _rShift.z)*_strides.z +
01700                                                    (pc >> _rShift.c)*_strides.c);
01701   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
01702                                                            py*_pStrides.y +
01703                                                            pz*_pStrides.z +
01704                                                            pc*_pStrides.c];
01705 };
01706 
01708 template <typename DATATYPE>
01709 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel5D(register const ImageVector &pos)
01710 {
01711   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel5D(register const ImageVector &pos)");
01712 
01713   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01714                                                    (pos.y >> _rShift.y)*_strides.y +
01715                                                    (pos.z >> _rShift.z)*_strides.z +
01716                                                    (pos.c >> _rShift.c)*_strides.c +
01717                                                    (pos.t >> _rShift.t)*_strides.t);
01718   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
01719                                                            pos.y*_pStrides.y +
01720                                                            pos.z*_pStrides.z +
01721                                                            pos.c*_pStrides.c +
01722                                                            pos.t*_pStrides.t];
01723 };
01724 
01726 template <typename DATATYPE>
01727 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel5DE(register const ImageVector &pos)
01728 {
01729   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel5DE(register const ImageVector &pos)");
01730 
01731   const register MLint px = pos.x;
01732   const register MLint py = pos.y;
01733   const register MLint pz = pos.z;
01734   const register MLint pc = pos.c;
01735   const register MLint pt = pos.t;
01736   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
01737       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
01738       (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
01739   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
01740                                                    (py >> _rShift.y)*_strides.y +
01741                                                    (pz >> _rShift.z)*_strides.z +
01742                                                    (pc >> _rShift.c)*_strides.c +
01743                                                    (pt >> _rShift.t)*_strides.t);
01744   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
01745                                                            py*_pStrides.y +
01746                                                            pz*_pStrides.z +
01747                                                            pc*_pStrides.c +
01748                                                            pt*_pStrides.t];
01749 };
01750 
01752 template <typename DATATYPE>
01753 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel6D(register const ImageVector &pos)
01754 {
01755   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel6D(register const ImageVector &pos)");
01756 
01757   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01758                                                    (pos.y >> _rShift.y)*_strides.y +
01759                                                    (pos.z >> _rShift.z)*_strides.z +
01760                                                    (pos.c >> _rShift.c)*_strides.c +
01761                                                    (pos.t >> _rShift.t)*_strides.t +
01762                                                    (pos.u >> _rShift.u)*_strides.u);
01763   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
01764                                                            pos.y*_pStrides.y +
01765                                                            pos.z*_pStrides.z +
01766                                                            pos.c*_pStrides.c +
01767                                                            pos.t*_pStrides.t +
01768                                                            pos.u*_pStrides.u];
01769 };
01770 
01772 template <typename DATATYPE>
01773 inline DATATYPE TVirtualVolume<DATATYPE>::_getVoxel6DE(register const ImageVector &pos)
01774 {
01775   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_getVoxel6DE(register const ImageVector &pos)");
01776 
01777   const register MLint px = pos.x;
01778   const register MLint py = pos.y;
01779   const register MLint pz = pos.z;
01780   const register MLint pc = pos.c;
01781   const register MLint pt = pos.t;
01782   const register MLint pu = pos.u;
01783   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
01784       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
01785       (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
01786   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
01787                                                    (py >> _rShift.y)*_strides.y +
01788                                                    (pz >> _rShift.z)*_strides.z +
01789                                                    (pc >> _rShift.c)*_strides.c +
01790                                                    (pt >> _rShift.t)*_strides.t +
01791                                                    (pu >> _rShift.u)*_strides.u);
01792   return (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
01793                                                            py*_pStrides.y +
01794                                                            pz*_pStrides.z +
01795                                                            pc*_pStrides.c +
01796                                                            pt*_pStrides.t +
01797                                                            pu*_pStrides.u];
01798 };
01799 
01800 
01801 
01802 //----------------------------------------------------------------------------------------------------------
01803 //  SetVoxel
01804 //----------------------------------------------------------------------------------------------------------
01805 
01806 
01807 
01809 template <typename DATATYPE>
01810 inline void TVirtualVolume<DATATYPE>::_setVoxel1D(register const ImageVector &pos, DATATYPE voxVal)
01811 {
01812   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel1D(register const ImageVector &pos, DATATYPE voxVal)");
01813 
01814   register PageBuffer * const page = _pageArray + (pos.x >> _rShift.x);
01815   page->_locked = true;
01816   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x] = voxVal;
01817 };
01818 
01820 template <typename DATATYPE>
01821 inline void TVirtualVolume<DATATYPE>::_setVoxel1DE(register const ImageVector &pos, DATATYPE voxVal)
01822 {
01823   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel1DE(register const ImageVector &pos, DATATYPE voxVal)");
01824 
01825   const register MLint px = pos.x;
01826   if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
01827   register PageBuffer * const page = _pageArray + (px >> _rShift.x);
01828   page->_locked = true;
01829   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px] = voxVal;
01830 };
01831 
01832 
01833 
01835 template <typename DATATYPE>
01836 inline void TVirtualVolume<DATATYPE>::_setVoxel2D(register const ImageVector &pos, DATATYPE voxVal)
01837 {
01838   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel2D(register const ImageVector &pos, DATATYPE voxVal)");
01839 
01840   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) + (pos.y >> _rShift.y)*_strides.y);
01841   page->_locked = true;
01842   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x + pos.y*_pStrides.y] = voxVal;
01843 };
01844 
01846 template <typename DATATYPE>
01847 inline void TVirtualVolume<DATATYPE>::_setVoxel2DE(register const ImageVector &pos, DATATYPE voxVal)
01848 {
01849   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel2DE(register const ImageVector &pos, DATATYPE voxVal)");
01850 
01851   const register MLint px = pos.x;
01852   const register MLint py = pos.y;
01853   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
01854   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) + (py >> _rShift.y)*_strides.y);
01855   page->_locked = true;
01856   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px + py*_pStrides.y] = voxVal;
01857 };
01858 
01859 
01860 
01862 template <typename DATATYPE>
01863 inline void TVirtualVolume<DATATYPE>::_setVoxel3D(register const ImageVector &pos, DATATYPE voxVal)
01864 {
01865   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel3D(register const ImageVector &pos, DATATYPE voxVal)");
01866 
01867   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01868                                                    (pos.y >> _rShift.y)*_strides.y +
01869                                                    (pos.z >> _rShift.z)*_strides.z);
01870   page->_locked = true;
01871   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x + pos.y*_pStrides.y + pos.z*_pStrides.z] = voxVal;
01872 };
01873 
01875 template <typename DATATYPE>
01876 inline void TVirtualVolume<DATATYPE>::_setVoxel3DE(register const ImageVector &pos, DATATYPE voxVal)
01877 {
01878   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel3DE(register const ImageVector &pos, DATATYPE voxVal)");
01879 
01880   const register MLint px = pos.x;
01881   const register MLint py = pos.y;
01882   const register MLint pz = pos.z;
01883   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
01884       (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
01885   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
01886                                                    (py >> _rShift.y)*_strides.y +
01887                                                    (pz >> _rShift.z)*_strides.z);
01888   page->_locked = true;
01889   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px + py*_pStrides.y + pz*_pStrides.z] = voxVal;
01890 };
01891 
01892 
01893 
01895 template <typename DATATYPE>
01896 inline void TVirtualVolume<DATATYPE>::_setVoxel4D(register const ImageVector &pos, DATATYPE voxVal)
01897 {
01898   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel4D(register const ImageVector &pos, DATATYPE voxVal)");
01899 
01900   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01901                                                    (pos.y >> _rShift.y)*_strides.y +
01902                                                    (pos.z >> _rShift.z)*_strides.z +
01903                                                    (pos.c >> _rShift.c)*_strides.c);
01904   page->_locked = true;
01905   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
01906                                                     pos.y*_pStrides.y +
01907                                                     pos.z*_pStrides.z +
01908                                                     pos.c*_pStrides.c] = voxVal;
01909 };
01910 
01912 template <typename DATATYPE>
01913 inline void TVirtualVolume<DATATYPE>::_setVoxel4DE(register const ImageVector &pos, DATATYPE voxVal)
01914 {
01915   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel4DE(register const ImageVector &pos, DATATYPE voxVal)");
01916 
01917   const register MLint px = pos.x;
01918   const register MLint py = pos.y;
01919   const register MLint pz = pos.z;
01920   const register MLint pc = pos.c;
01921   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
01922       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
01923   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
01924                                                    (py >> _rShift.y)*_strides.y +
01925                                                    (pz >> _rShift.z)*_strides.z +
01926                                                    (pc >> _rShift.c)*_strides.c);
01927   page->_locked = true;
01928   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
01929                                                     py*_pStrides.y +
01930                                                     pz*_pStrides.z +
01931                                                     pc*_pStrides.c] = voxVal;
01932 };
01933 
01934 
01935 
01937 template <typename DATATYPE>
01938 inline void TVirtualVolume<DATATYPE>::_setVoxel5D(register const ImageVector &pos, DATATYPE voxVal)
01939 {
01940   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel5D(register const ImageVector &pos, DATATYPE voxVal)");
01941 
01942   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01943                                                    (pos.y >> _rShift.y)*_strides.y +
01944                                                    (pos.z >> _rShift.z)*_strides.z +
01945                                                    (pos.c >> _rShift.c)*_strides.c +
01946                                                    (pos.t >> _rShift.t)*_strides.t);
01947   page->_locked = true;
01948   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
01949                                                     pos.y*_pStrides.y +
01950                                                     pos.z*_pStrides.z +
01951                                                     pos.c*_pStrides.c +
01952                                                     pos.t*_pStrides.t] = voxVal;
01953 };
01954 
01956 template <typename DATATYPE>
01957 inline void TVirtualVolume<DATATYPE>::_setVoxel5DE(register const ImageVector &pos, DATATYPE voxVal)
01958 {
01959   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel5DE(register const ImageVector &pos, DATATYPE voxVal)");
01960 
01961   const register MLint px = pos.x;
01962   const register MLint py = pos.y;
01963   const register MLint pz = pos.z;
01964   const register MLint pc = pos.c;
01965   const register MLint pt = pos.t;
01966   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
01967       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
01968       (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
01969   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
01970                                                    (py >> _rShift.y)*_strides.y +
01971                                                    (pz >> _rShift.z)*_strides.z +
01972                                                    (pc >> _rShift.c)*_strides.c +
01973                                                    (pt >> _rShift.t)*_strides.t);
01974   page->_locked = true;
01975   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
01976                                                     py*_pStrides.y +
01977                                                     pz*_pStrides.z +
01978                                                     pc*_pStrides.c +
01979                                                     pt*_pStrides.t] = voxVal;
01980 };
01981 
01982 
01983 
01985 template <typename DATATYPE>
01986 inline void TVirtualVolume<DATATYPE>::_setVoxel6D(register const ImageVector &pos, DATATYPE voxVal)
01987 {
01988   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel6D(register const ImageVector &pos, DATATYPE voxVal)");
01989 
01990   register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
01991                                                    (pos.y >> _rShift.y)*_strides.y +
01992                                                    (pos.z >> _rShift.z)*_strides.z +
01993                                                    (pos.c >> _rShift.c)*_strides.c +
01994                                                    (pos.t >> _rShift.t)*_strides.t +
01995                                                    (pos.u >> _rShift.u)*_strides.u);
01996   page->_locked = true;
01997   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[pos.x +
01998                                                     pos.y*_pStrides.y +
01999                                                     pos.z*_pStrides.z +
02000                                                     pos.c*_pStrides.c +
02001                                                     pos.t*_pStrides.t +
02002                                                     pos.u*_pStrides.u] = voxVal;
02003 };
02004 
02006 template <typename DATATYPE>
02007 inline void TVirtualVolume<DATATYPE>::_setVoxel6DE(register const ImageVector &pos, DATATYPE voxVal)
02008 {
02009   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setVoxel6DE(register const ImageVector &pos, DATATYPE voxVal)");
02010 
02011   const register MLint px = pos.x;
02012   const register MLint py = pos.y;
02013   const register MLint pz = pos.z;
02014   const register MLint pc = pos.c;
02015   const register MLint pt = pos.t;
02016   const register MLint pu = pos.u;
02017   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02018       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
02019       (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
02020   register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
02021                                                    (py >> _rShift.y)*_strides.y +
02022                                                    (pz >> _rShift.z)*_strides.z +
02023                                                    (pc >> _rShift.c)*_strides.c +
02024                                                    (pt >> _rShift.t)*_strides.t +
02025                                                    (pu >> _rShift.u)*_strides.u);
02026   page->_locked = true;
02027   (static_cast<DATATYPE*>(page->_getPageFkt(page)))[px +
02028                                                     py*_pStrides.y +
02029                                                     pz*_pStrides.z +
02030                                                     pc*_pStrides.c +
02031                                                     pt*_pStrides.t +
02032                                                     pu*_pStrides.u] = voxVal;
02033 };
02034 
02035 
02036 
02037 
02038 //----------------------------------------------------------------------------------------------------------
02039 //  SetCursorPos.
02040 //----------------------------------------------------------------------------------------------------------
02041 
02042 
02043 
02045 template <typename DATATYPE>
02046 inline void TVirtualVolume<DATATYPE>::_setCursorPos1D(register const ImageVector & p)
02047 {
02048   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos1D(register const ImageVector & p)");
02049 
02050   _cPos.x   = p.x;
02051   _cIdx     = p.x;
02052   _cPageIdx = p.x >> _rShift.x;
02053 }
02054 
02056 template <typename DATATYPE>
02057 inline void TVirtualVolume<DATATYPE>::_setCursorPos1DE(register const ImageVector & pos)
02058 {
02059   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos1DE(register const ImageVector & pos)");
02060 
02061   const register MLint px = pos.x;
02062   if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
02063   _cPos.x   = px;
02064   _cIdx     = px;
02065   _cPageIdx = px >> _rShift.x;
02066 }
02067 
02068 
02069 
02071 template <typename DATATYPE>
02072 inline void TVirtualVolume<DATATYPE>::_setCursorPos2D(register const ImageVector & p)
02073 {
02074   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos2D(register const ImageVector & p)");
02075 
02076   _cPos.x = p.x;
02077   _cPos.y = p.y;
02078   _cIdx   = p.x + p.y*_pStrides.y;
02079   _cPageIdx = (p.x >> _rShift.x) + (p.y >> _rShift.y)*_strides.y;
02080 }
02081 
02083 template <typename DATATYPE>
02084 inline void TVirtualVolume<DATATYPE>::_setCursorPos2DE(register const ImageVector & pos)
02085 {
02086   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos2DE(register const ImageVector & pos)");
02087 
02088   const register MLint px = pos.x;
02089   const register MLint py = pos.y;
02090   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
02091   _cPos.x   = px;
02092   _cPos.y   = py;
02093   _cIdx     = px + py*_pStrides.y;
02094   _cPageIdx = (px >> _rShift.x) + (py >> _rShift.y)*_strides.y;
02095 }
02096 
02097 
02098 
02100 template <typename DATATYPE>
02101 inline void TVirtualVolume<DATATYPE>::_setCursorPos3D(register const ImageVector & p)
02102 {
02103   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos3D(register const ImageVector & p)");
02104 
02105   _cPos.x   = p.x;
02106   _cPos.y   = p.y;
02107   _cPos.z   = p.z;
02108   _cIdx     = p.x + p.y*_pStrides.y + p.z*_pStrides.z;
02109   _cPageIdx = (p.x >> _rShift.x) + (p.y >> _rShift.y)*_strides.y + (p.z >> _rShift.z)*_strides.z;
02110 }
02111 
02113 template <typename DATATYPE>
02114 inline void TVirtualVolume<DATATYPE>::_setCursorPos3DE(register const ImageVector & pos)
02115 {
02116   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos3DE(register const ImageVector & pos)");
02117 
02118   const register MLint px = pos.x;
02119   const register MLint py = pos.y;
02120   const register MLint pz = pos.z;
02121   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02122       (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
02123   _cPos.x   = px;
02124   _cPos.y   = py;
02125   _cPos.z   = pz;
02126   _cIdx     = px + py*_pStrides.y + pz*_pStrides.z;
02127   _cPageIdx = (px >> _rShift.x) + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z;
02128 }
02129 
02130 
02131 
02133 template <typename DATATYPE>
02134 inline void TVirtualVolume<DATATYPE>::_setCursorPos4D(register const ImageVector &p)
02135 {
02136   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos4D(register const ImageVector &p)");
02137 
02138   _cPos.x   = p.x;
02139   _cPos.y   = p.y;
02140   _cPos.z   = p.z;
02141   _cPos.c   = p.c;
02142   _cIdx     = p.x + p.y*_pStrides.y + p.z*_pStrides.z + p.c*_pStrides.c;
02143   _cPageIdx = (p.x >> _rShift.x) + (p.y >> _rShift.y)*_strides.y + (p.z >> _rShift.z)*_strides.z + (p.c >> _rShift.c)*_strides.c;
02144 }
02145 
02147 template <typename DATATYPE>
02148 inline void TVirtualVolume<DATATYPE>::_setCursorPos4DE(register const ImageVector &pos)
02149 {
02150   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos4DE(register const ImageVector &pos)");
02151 
02152   const register MLint px = pos.x;
02153   const register MLint py = pos.y;
02154   const register MLint pz = pos.z;
02155   const register MLint pc = pos.c;
02156   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02157       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
02158   _cPos.x   = px;
02159   _cPos.y   = py;
02160   _cPos.z   = pz;
02161   _cPos.c   = pc;
02162   _cIdx     = px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c;
02163   _cPageIdx = (px >> _rShift.x) + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z + (pc >> _rShift.c)*_strides.c;
02164 }
02165 
02166 
02167 
02169 template <typename DATATYPE>
02170 inline void TVirtualVolume<DATATYPE>::_setCursorPos5D(register const ImageVector & p)
02171 {
02172   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos5D(register const ImageVector & p)");
02173 
02174   // Save cursor position.
02175   _cPos = p;
02176 
02177   // Determine the index to the voxel within the page.
02178   _cIdx = p.x + p.y*_pStrides.y + p.z*_pStrides.z + p.c*_pStrides.c + p.t*_pStrides.t;
02179 
02180   // Determine index of the page under the cursor position.
02181   _cPageIdx = (p.x >> _rShift.x)            + (p.y >> _rShift.y)*_strides.y + (p.z >> _rShift.z)*_strides.z +
02182   (p.c >> _rShift.c)*_strides.c + (p.t >> _rShift.t)*_strides.t;
02183 }
02184 
02186 template <typename DATATYPE>
02187 inline void TVirtualVolume<DATATYPE>::_setCursorPos5DE(register const ImageVector & pos)
02188 {
02189   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos5DE(register const ImageVector & pos)");
02190 
02191   const register MLint px = pos.x;
02192   const register MLint py = pos.y;
02193   const register MLint pz = pos.z;
02194   const register MLint pc = pos.c;
02195   const register MLint pt = pos.t;
02196   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02197       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
02198       (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
02199 
02200   // Save cursor position.
02201   _cPos = pos;
02202 
02203   // Determine the index to the voxel within the page.
02204   _cIdx = px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c + pt*_pStrides.t;
02205 
02206   // Determine index of the page under the cursor position.
02207   _cPageIdx = (px >> _rShift.x)            + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z +
02208   (pc >> _rShift.c)*_strides.c + (pt >> _rShift.t)*_strides.t;
02209 }
02210 
02211 
02212 
02214 template <typename DATATYPE>
02215 inline void TVirtualVolume<DATATYPE>::_setCursorPos6D(register const ImageVector & p)
02216 {
02217   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos6D(register const ImageVector & p)");
02218 
02219   // Save cursor position.
02220   _cPos = p;
02221 
02222   // Determine the index to the voxel within the page.
02223   _cIdx = p.x + p.y*_pStrides.y + p.z*_pStrides.z + p.c*_pStrides.c + p.t*_pStrides.t + p.u*_pStrides.u;
02224 
02225   // Determine index of the page under the cursor position.
02226   _cPageIdx = (p.x >> _rShift.x)            + (p.y >> _rShift.y)*_strides.y + (p.z >> _rShift.z)*_strides.z +
02227   (p.c >> _rShift.c)*_strides.c + (p.t >> _rShift.t)*_strides.t + (p.u >> _rShift.u)*_strides.u;
02228 }
02229 
02231 template <typename DATATYPE>
02232 inline void TVirtualVolume<DATATYPE>::_setCursorPos6DE(register const ImageVector & pos)
02233 {
02234   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_setCursorPos6DE(register const ImageVector & pos)");
02235 
02236   const register MLint px = pos.x;
02237   const register MLint py = pos.y;
02238   const register MLint pz = pos.z;
02239   const register MLint pc = pos.c;
02240   const register MLint pt = pos.t;
02241   const register MLint pu = pos.u;
02242   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02243       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
02244       (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
02245 
02246   // Save cursor position.
02247   _cPos = pos;
02248 
02249   // Determine the index to the voxel within the page.
02250   _cIdx = px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c + pt*_pStrides.t + pu*_pStrides.u;
02251 
02252   // Determine index of the page under the cursor position.
02253   _cPageIdx = (px >> _rShift.x)            + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z +
02254   (pc >> _rShift.c)*_strides.c + (pt >> _rShift.t)*_strides.t + (pu >> _rShift.u)*_strides.u;
02255 }
02256 
02257 
02258 
02259 
02260 //----------------------------------------------------------------------------------------------------------
02261 //  MoveCursorOffset
02262 //----------------------------------------------------------------------------------------------------------
02263 
02264 
02265 
02267 template <typename DATATYPE>
02268 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset1D(register const ImageVector & off)
02269 {
02270   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset1D(register const ImageVector & off)");
02271 
02272   _cPos.x  += off.x;
02273   _cIdx     = _cPos.x;
02274   _cPageIdx = _cPos.x >> _rShift.x;
02275 }
02276 
02278 template <typename DATATYPE>
02279 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset1DE(register const ImageVector & off)
02280 {
02281   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset1DE(register const ImageVector & off)");
02282 
02283   const register MLint px = _cPos.x + off.x;
02284   if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
02285   _cPos.x   = px;
02286   _cIdx     = px;
02287   _cPageIdx = px >> _rShift.x;
02288 }
02289 
02290 
02291 
02293 template <typename DATATYPE>
02294 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset2D(register const ImageVector & off)
02295 {
02296   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset2D(register const ImageVector & off)");
02297 
02298   _cPos.x  += off.x;
02299   _cPos.y  += off.y;
02300   _cIdx     = _cPos.x + _cPos.y*_pStrides.y;
02301   _cPageIdx = (_cPos.x >> _rShift.x) + (_cPos.y >> _rShift.y)*_strides.y;
02302 }
02303 
02305 template <typename DATATYPE>
02306 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset2DE(register const ImageVector & off)
02307 {
02308   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset2DE(register const ImageVector & off)");
02309 
02310   const register MLint px = _cPos.x + off.x;
02311   const register MLint py = _cPos.y + off.y;
02312   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
02313   _cPos.x   = px;
02314   _cPos.y   = py;
02315   _cIdx     = px + py*_pStrides.y;
02316   _cPageIdx = (px >> _rShift.x) + (py >> _rShift.y)*_strides.y;
02317 }
02318 
02319 
02320 
02322 template <typename DATATYPE>
02323 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset3D(register const ImageVector & off)
02324 {
02325   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset3D(register const ImageVector & off)");
02326 
02327   _cPos.x  += off.x;
02328   _cPos.y  += off.y;
02329   _cPos.z  += off.z;
02330   _cIdx     = _cPos.x + _cPos.y*_pStrides.y + _cPos.z*_pStrides.z;
02331   _cPageIdx = (_cPos.x >> _rShift.x) + (_cPos.y >> _rShift.y)*_strides.y + (_cPos.z >> _rShift.z)*_strides.z;
02332 }
02333 
02335 template <typename DATATYPE>
02336 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset3DE(register const ImageVector & off)
02337 {
02338   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset3DE(register const ImageVector & off)");
02339 
02340   const register MLint px = _cPos.x+off.x;
02341   const register MLint py = _cPos.y+off.y;
02342   const register MLint pz = _cPos.z+off.z;
02343   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02344       (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
02345   _cPos.x   = px;
02346   _cPos.y   = py;
02347   _cPos.z   = pz;
02348   _cIdx     = px + py*_pStrides.y + pz*_pStrides.z;
02349   _cPageIdx = (px >> _rShift.x) + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z;
02350 }
02351 
02352 
02353 
02355 template <typename DATATYPE>
02356 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset4D(register const ImageVector &off)
02357 {
02358   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset4D(register const ImageVector &off)");
02359 
02360   _cPos.x  += off.x;
02361   _cPos.y  += off.y;
02362   _cPos.z  += off.z;
02363   _cPos.c  += off.c;
02364   _cIdx = _cPos.x + _cPos.y*_pStrides.y + _cPos.z*_pStrides.z + _cPos.c*_pStrides.c;
02365   _cPageIdx = (_cPos.x >> _rShift.x) + (_cPos.y >> _rShift.y)*_strides.y + (_cPos.z >> _rShift.z)*_strides.z + (_cPos.c >> _rShift.c)*_strides.c;
02366 }
02367 
02369 template <typename DATATYPE>
02370 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset4DE(register const ImageVector &off)
02371 {
02372   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset4DE(register const ImageVector &off)");
02373 
02374   const register MLint px = _cPos.x + off.x;
02375   const register MLint py = _cPos.y + off.y;
02376   const register MLint pz = _cPos.z + off.z;
02377   const register MLint pc = _cPos.c + off.c;
02378   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02379       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
02380   _cPos.x   = px;
02381   _cPos.y   = py;
02382   _cPos.z   = pz;
02383   _cPos.c   = pc;
02384   _cIdx     = px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c;
02385   _cPageIdx = (px >> _rShift.x) + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z + (pc >> _rShift.c)*_strides.c;
02386 }
02387 
02388 
02389 
02391 template <typename DATATYPE>
02392 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset5D(register const ImageVector & off)
02393 {
02394   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset5D(register const ImageVector & off)");
02395 
02396   // Calculate new cursor position.
02397   _cPos += off;
02398 
02399   // Determine the index to the voxel within the page.
02400   _cIdx = _cPos.x + _cPos.y*_pStrides.y + _cPos.z*_pStrides.z + _cPos.c*_pStrides.c + _cPos.t*_pStrides.t;
02401 
02402   // Determine index of the page under the cursor position.
02403   _cPageIdx = (_cPos.x >> _rShift.x)            + (_cPos.y >> _rShift.y)*_strides.y + (_cPos.z >> _rShift.z)*_strides.z +
02404   (_cPos.c >> _rShift.c)*_strides.c + (_cPos.t >> _rShift.t)*_strides.t;
02405 }
02406 
02408 template <typename DATATYPE>
02409 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset5DE(register const ImageVector & off)
02410 {
02411   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset5DE(register const ImageVector & off)");
02412 
02413   const register MLint px = _cPos.x + off.x;
02414   const register MLint py = _cPos.y + off.y;
02415   const register MLint pz = _cPos.z + off.z;
02416   const register MLint pc = _cPos.c + off.c;
02417   const register MLint pt = _cPos.t + off.t;
02418   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02419       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
02420       (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
02421 
02422   // Save cursor position.
02423   _cPos.set(px,py,pz,pc,pt,0);
02424 
02425   // Determine the index to the voxel within the page.
02426   _cIdx     = px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c + pt*_pStrides.t;
02427 
02428   // Determine index of the page under the cursor position.
02429   _cPageIdx = (px >> _rShift.x)            + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z +
02430   (pc >> _rShift.c)*_strides.c + (pt >> _rShift.t)*_strides.t;
02431 }
02432 
02433 
02434 
02436 template <typename DATATYPE>
02437 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset6D(register const ImageVector & off)
02438 {
02439   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset6D(register const ImageVector & off)");
02440 
02441   // Save cursor position.
02442   _cPos    += off;
02443 
02444   // Determine the index to the voxel within the page.
02445   _cIdx     = _cPos.x + _cPos.y*_pStrides.y + _cPos.z*_pStrides.z + _cPos.c*_pStrides.c + _cPos.t*_pStrides.t + _cPos.u*_pStrides.u;
02446 
02447   // Determine index of the page under the cursor position.
02448   _cPageIdx = (_cPos.x >> _rShift.x)            + (_cPos.y >> _rShift.y)*_strides.y + (_cPos.z >> _rShift.z)*_strides.z +
02449   (_cPos.c >> _rShift.c)*_strides.c + (_cPos.t >> _rShift.t)*_strides.t + (_cPos.u >> _rShift.u)*_strides.u;
02450 }
02451 
02453 template <typename DATATYPE>
02454 inline void TVirtualVolume<DATATYPE>::_moveCursorOffset6DE(register const ImageVector & off)
02455 {
02456   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_moveCursorOffset6DE(register const ImageVector & off)");
02457 
02458   const register MLint px = _cPos.x + off.x;
02459   const register MLint py = _cPos.y + off.y;
02460   const register MLint pz = _cPos.z + off.z;
02461   const register MLint pc = _cPos.c + off.c;
02462   const register MLint pt = _cPos.t + off.t;
02463   const register MLint pu = _cPos.u + off.u;
02464   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02465       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
02466       (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
02467 
02468   // Save cursor position.
02469   _cPos.set(px,py,pz,pc,pt,pu);
02470 
02471   // Determine the index to the voxel within the page.
02472   _cIdx = px + py*_pStrides.y + pz*_pStrides.z + pc*_pStrides.c + pt*_pStrides.t + pu*_pStrides.u;
02473 
02474   // Determine index of the page under the cursor position.
02475   _cPageIdx = (px >> _rShift.x)            + (py >> _rShift.y)*_strides.y + (pz >> _rShift.z)*_strides.z +
02476   (pc >> _rShift.c)*_strides.c + (pt >> _rShift.t)*_strides.t + (pu >> _rShift.u)*_strides.u;
02477 }
02478 
02479 
02480 
02481 //----------------------------------------------------------------------------------------------------------
02482 //  IsMapped.
02483 //----------------------------------------------------------------------------------------------------------
02484 
02485 
02486 
02488 template <typename DATATYPE>
02489 inline bool TVirtualVolume<DATATYPE>::_isMapped1D(register const ImageVector &pos) const
02490 {
02491   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped1D(register const ImageVector &pos) const");
02492 
02493   const register PageBuffer * const page = _pageArray + (pos.x >> _rShift.x);
02494   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02495 };
02496 
02498 template <typename DATATYPE>
02499 inline bool TVirtualVolume<DATATYPE>::_isMapped1DE(register const ImageVector &pos) const
02500 {
02501   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped1DE(register const ImageVector &pos) const");
02502 
02503   const register MLint px = pos.x;
02504   if ((px < 0) || (px >= _ext.x)){ throw(ML_OUT_OF_RANGE); }
02505   const register PageBuffer * const page = _pageArray + (px >> _rShift.x);
02506   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02507 };
02508 
02509 
02510 
02512 template <typename DATATYPE>
02513 inline bool TVirtualVolume<DATATYPE>::_isMapped2D(register const ImageVector &pos) const
02514 {
02515   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped2D(register const ImageVector &pos) const");
02516 
02517   const register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) + (pos.y >> _rShift.y)*_strides.y);
02518   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02519 };
02520 
02522 template <typename DATATYPE>
02523 inline bool TVirtualVolume<DATATYPE>::_isMapped2DE(register const ImageVector &pos) const
02524 {
02525   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped2DE(register const ImageVector &pos) const");
02526 
02527   const register MLint px = pos.x;
02528   const register MLint py = pos.y;
02529   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y)){ throw(ML_OUT_OF_RANGE); }
02530   const register PageBuffer * const page = _pageArray + ((px >> _rShift.x) + (py >> _rShift.y)*_strides.y);
02531   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02532 };
02533 
02534 
02535 
02537 template <typename DATATYPE>
02538 inline bool TVirtualVolume<DATATYPE>::_isMapped3D(register const ImageVector &pos) const
02539 {
02540   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped3D(register const ImageVector &pos) const");
02541 
02542   const register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
02543                                                          (pos.y >> _rShift.y)*_strides.y +
02544                                                          (pos.z >> _rShift.z)*_strides.z);
02545   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02546 };
02547 
02549 template <typename DATATYPE>
02550 inline bool TVirtualVolume<DATATYPE>::_isMapped3DE(register const ImageVector &pos) const
02551 {
02552   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped3DE(register const ImageVector &pos) const");
02553 
02554   const register MLint px = pos.x;
02555   const register MLint py = pos.y;
02556   const register MLint pz = pos.z;
02557   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02558       (pz < 0) || (pz >= _ext.z)){ throw(ML_OUT_OF_RANGE); }
02559   const register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
02560                                                          (py >> _rShift.y)*_strides.y +
02561                                                          (pz >> _rShift.z)*_strides.z);
02562   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02563 };
02564 
02565 
02566 
02568 template <typename DATATYPE>
02569 inline bool TVirtualVolume<DATATYPE>::_isMapped4D(register const ImageVector &pos) const
02570 {
02571   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped4D(register const ImageVector &pos) const");
02572 
02573   const register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
02574                                                          (pos.y >> _rShift.y)*_strides.y +
02575                                                          (pos.z >> _rShift.z)*_strides.z +
02576                                                          (pos.c >> _rShift.c)*_strides.c);
02577   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02578 };
02579 
02581 template <typename DATATYPE>
02582 inline bool TVirtualVolume<DATATYPE>::_isMapped4DE(register const ImageVector &pos) const
02583 {
02584   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped4DE(register const ImageVector &pos) const");
02585 
02586   const register MLint px = pos.x;
02587   const register MLint py = pos.y;
02588   const register MLint pz = pos.z;
02589   const register MLint pc = pos.c;
02590   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02591       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c)){ throw(ML_OUT_OF_RANGE); }
02592   const register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
02593                                                          (py >> _rShift.y)*_strides.y +
02594                                                          (pz >> _rShift.z)*_strides.z +
02595                                                          (pc >> _rShift.c)*_strides.c);
02596   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02597 };
02598 
02599 
02600 
02602 template <typename DATATYPE>
02603 inline bool TVirtualVolume<DATATYPE>::_isMapped5D(register const ImageVector &pos) const
02604 {
02605   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped5D(register const ImageVector &pos) const");
02606 
02607   const register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
02608                                                          (pos.y >> _rShift.y)*_strides.y +
02609                                                          (pos.z >> _rShift.z)*_strides.z +
02610                                                          (pos.c >> _rShift.c)*_strides.c +
02611                                                          (pos.t >> _rShift.t)*_strides.t);
02612   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02613 };
02614 
02616 template <typename DATATYPE>
02617 inline bool TVirtualVolume<DATATYPE>::_isMapped5DE(register const ImageVector &pos) const
02618 {
02619   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped5DE(register const ImageVector &pos) const");
02620 
02621   const register MLint px = pos.x;
02622   const register MLint py = pos.y;
02623   const register MLint pz = pos.z;
02624   const register MLint pc = pos.c;
02625   const register MLint pt = pos.t;
02626   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02627       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
02628       (pt < 0) || (pt >= _ext.t)){ throw(ML_OUT_OF_RANGE); }
02629   const register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
02630                                                          (py >> _rShift.y)*_strides.y +
02631                                                          (pz >> _rShift.z)*_strides.z +
02632                                                          (pc >> _rShift.c)*_strides.c +
02633                                                          (pt >> _rShift.t)*_strides.t);
02634   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02635 };
02636 
02637 
02638 
02640 template <typename DATATYPE>
02641 inline bool TVirtualVolume<DATATYPE>::_isMapped6D(register const ImageVector &pos) const
02642 {
02643   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped6D(register const ImageVector &pos) const");
02644 
02645   const register PageBuffer * const page = _pageArray + ((pos.x >> _rShift.x) +
02646                                                          (pos.y >> _rShift.y)*_strides.y +
02647                                                          (pos.z >> _rShift.z)*_strides.z +
02648                                                          (pos.c >> _rShift.c)*_strides.c +
02649                                                          (pos.t >> _rShift.t)*_strides.t +
02650                                                          (pos.u >> _rShift.u)*_strides.u);
02651   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02652 };
02653 
02655 template <typename DATATYPE>
02656 inline bool TVirtualVolume<DATATYPE>::_isMapped6DE(register const ImageVector &pos) const
02657 {
02658   ML_TRACE_IN_TIME_CRITICAL("TVirtualVolume<DATATYPE>::_isMapped6DE(register const ImageVector &pos) const");
02659 
02660   const register MLint px = pos.x;
02661   const register MLint py = pos.y;
02662   const register MLint pz = pos.z;
02663   const register MLint pc = pos.c;
02664   const register MLint pt = pos.t;
02665   const register MLint pu = pos.u;
02666   if ((px < 0) || (px >= _ext.x) || (py < 0) || (py >= _ext.y) ||
02667       (pz < 0) || (pz >= _ext.z) || (pc < 0) || (pc >= _ext.c) ||
02668       (pt < 0) || (pt >= _ext.t) || (pu < 0) || (pu >= _ext.u)){ throw(ML_OUT_OF_RANGE); }
02669   const register PageBuffer * const page = _pageArray + ((px >> _rShift.x) +
02670                                                          (py >> _rShift.y)*_strides.y +
02671                                                          (pz >> _rShift.z)*_strides.z +
02672                                                          (pc >> _rShift.c)*_strides.c +
02673                                                          (pt >> _rShift.t)*_strides.t +
02674                                                          (pu >> _rShift.u)*_strides.u);
02675   return page->_getPageFkt != VirtualVolume::_loadPageCB;
02676 };
02677 
02678 
02679 
02680 ML_END_NAMESPACE
02681 
02682 #endif // __mlTVirtualVolume_H
02683