ML Reference
MeVis/Foundation/Sources/ML/include/mlMedicalImageProperties.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //-------------------------------------------------------------------------
00011 //-------------------------------------------------------------------------
00012 #ifndef __mlMedicalImageProperties_H
00013 #define __mlMedicalImageProperties_H
00014 
00015 // ML-includes
00016 #ifndef __mlInitSystemML_H
00017 #include "mlInitSystemML.h"
00018 #endif
00019 #ifndef __mlBasics_H
00020 #include "mlBasics.h"
00021 #endif
00022 #ifndef __mlDateTime_H
00023 #include "mlDateTime.h"
00024 #endif
00025 #ifndef __mlImageProperties_H
00026 #include "mlImageProperties.h"
00027 #endif
00028 #ifndef __mlLinearAlgebra_H
00029 #include "mlLinearAlgebra.h"
00030 #endif
00031 #ifndef __mlImagePropertyExtensionContainer_H
00032 #include "mlImagePropertyExtensionContainer.h"
00033 #endif
00034 
00035 #ifdef _MSC_VER
00036 // Save warning state.
00037 #pragma warning( push )
00038 
00039 // Warning disabled: 'warning C4275': non DLL-interface
00040 // Reason: Exporting is done manually or as inline functions for the 
00041 // template class ImageProperties.
00042 #pragma warning(disable : 4275 )
00043 #endif
00044 
00045 ML_START_NAMESPACE
00046 
00047 // Use incomplete type to reduce header file dependencies.
00048 class RuntimeType;
00049 
00050 //-------------------------------------------------------------------------
00076 //-------------------------------------------------------------------------
00077 class MLEXPORT MedicalImageProperties : public ImageProperties
00078 {
00079   
00080 public:
00081   
00082   //-------------------------------------------------------------------
00084 
00085   //-------------------------------------------------------------------
00089   MedicalImageProperties();
00090   
00092   virtual ~MedicalImageProperties();
00093   
00096   MedicalImageProperties(const MedicalImageProperties& medicalImageProperties);
00097   
00100   MedicalImageProperties &operator=(const MedicalImageProperties& medicalImageProperties);
00101   
00105   void setImageProperties(const MedicalImageProperties& medicalImageProperties);
00107   
00108   //-------------------------------------------------------------------
00110 
00111   //-------------------------------------------------------------------
00113   bool operator==(const MedicalImageProperties& medicalImageProperties) const;
00114   
00116   bool operator!=(const MedicalImageProperties& medicalImageProperties) const;
00118   
00119   //-------------------------------------------------------------------
00121 
00122   //-------------------------------------------------------------------
00124   void setVoxelSize(MLdouble dx, MLdouble dy, MLdouble dz);
00125   
00127   void setVoxelSize(const Vector3& voxelSize);  
00128   
00129   // Returns the voxel size.
00130   Vector3 getVoxelSize() const;
00132   
00133   //-------------------------------------------------------------------
00135 
00136   //-------------------------------------------------------------------
00147   bool isVoxelToWorldMatrixValid() const;
00148   
00151   void setVoxelToWorldMatrixValid(bool valid);
00152     
00154   const Matrix4& getVoxelToWorldMatrix() const;
00155   
00157   void setVoxelToWorldMatrix(const Matrix4& matrix);
00158   
00160   const Matrix4& getWorldToVoxelMatrix() const;
00161   
00163   Vector3 mapVoxelToWorld(const Vector3& voxelPosition) const;  
00164     
00166   Vector3 mapWorldToVoxel(const Vector3& worldPosition) const;  
00167   
00170   void scaleVoxelToWorldMatrix(const Vector3& scaleFactors);
00171   
00173   void translateVoxelToWorldMatrix(const Vector3& offsetVector);
00175   
00176   //--------------------------------------------------------------------------------
00178 
00179   //--------------------------------------------------------------------------------
00198   std::vector<std::string>& getCDimensionInfos() { return _cDimInfos; };
00199   std::vector<DateTime>&    getTDimensionInfos() { return _tDimInfos; };
00200   std::vector<std::string>& getUDimensionInfos() { return _uDimInfos; };
00201 
00202   const std::vector<std::string>& getCDimensionInfos() const { return _cDimInfos; };
00203   const std::vector<DateTime>&    getTDimensionInfos() const { return _tDimInfos; };
00204   const std::vector<std::string>& getUDimensionInfos() const { return _uDimInfos; };
00205   
00207   
00208   //--------------------------------------------------------------------------------
00210 
00211   //--------------------------------------------------------------------------------
00213   ImagePropertyExtensionContainer&       getImagePropertyContainer()            { return _imagePropertyExtensions; }
00214   const ImagePropertyExtensionContainer& getConstImagePropertyContainer() const { return _imagePropertyExtensions; }
00216   
00217   
00218 private:
00219   
00220   //-------------------------------------------------------------------
00222 
00223   //-------------------------------------------------------------------
00226   void updateVoxelSizeFromToWorldMatrix();
00227   
00233   void updateToWorldMatrixFromVoxelSize();
00234   
00238   void correctToWorldMatrix();
00240   
00241   
00247   void _assignMembers(const MedicalImageProperties& medicalImageProperties);
00248   
00249   //-------------------------------------------------------------------
00251 
00252   //-------------------------------------------------------------------
00254   MLdouble _x_VoxelSize;
00255   
00257   MLdouble _y_VoxelSize;
00258   
00260   MLdouble _z_VoxelSize;
00261   
00263   Matrix4 _toWorldMatrix;
00264   
00267   Matrix4 _toVoxelMatrix;
00268   
00271   bool _isToWorldMatrixValid;
00273   
00274   //-------------------------------------------------------------------
00276 
00277   //-------------------------------------------------------------------
00280   std::vector<std::string> _cDimInfos;
00281   std::vector<DateTime>    _tDimInfos;
00282   std::vector<std::string> _uDimInfos;
00284   
00285   
00286   //-------------------------------------------------------------------
00288 
00289 
00290   //-------------------------------------------------------------------
00291   ImagePropertyExtensionContainer _imagePropertyExtensions;
00293   
00294 #ifdef ML_DEPRECATED
00295   
00297 
00298   
00299 public:
00300   
00303   inline ML_DEPRECATED void setImgProps(const MedicalImageProperties &medImgProps) { setImageProperties(medImgProps); }
00306   inline ML_DEPRECATED bool isToWorldMatrixValid() const { return isVoxelToWorldMatrixValid(); }
00309   inline ML_DEPRECATED void setToWorldMatrixValid(bool valid) { setVoxelToWorldMatrixValid(valid); }
00312   ML_DEPRECATED void getVoxelSize(MLfloat *dx, MLfloat *dy, MLfloat *dz) const;
00315   ML_DEPRECATED void getToWorldMatrix(MLfloat *mat) const;
00318   ML_DEPRECATED void setToWorldMatrix(MLfloat *mat);
00321   ML_DEPRECATED const Matrix4* getToWorldMatrix() const;
00324   ML_DEPRECATED void setToWorldMatrix(const Matrix4 *mat);
00327   ML_DEPRECATED void setToWorldMatrixIdentity();
00330   ML_DEPRECATED void getToVoxelMatrix(MLfloat *mat) const;
00333   ML_DEPRECATED const Matrix4* getToVoxelMatrix() const;
00336   ML_DEPRECATED void transformToWorldCoord (MLfloat *x, MLfloat *y, MLfloat *z) const;
00339   ML_DEPRECATED void transformToWorldCoord (MLdouble *x, MLdouble *y, MLdouble *z) const;
00342   ML_DEPRECATED void transformToWorldCoord (const Vector3& voxel, Vector3& world) const;
00345   ML_DEPRECATED void transformToVoxelCoord (MLfloat *x, MLfloat *y, MLfloat *z) const;
00348   ML_DEPRECATED void transformToVoxelCoord (MLdouble *x, MLdouble *y, MLdouble *z) const;
00351   ML_DEPRECATED void transformToVoxelCoord (const Vector3& world, Vector3& voxel) const;
00354   inline ML_DEPRECATED void scaleImage(MLfloat x, MLfloat y, MLfloat z) { scaleVoxelToWorldMatrix(Vector3(x,y,z)); }
00357   inline ML_DEPRECATED void translateImage(MLfloat x, MLfloat y, MLfloat z) { translateVoxelToWorldMatrix(Vector3(x,y,z)); }
00360   inline ML_DEPRECATED std::vector<std::string>& getCDimInfos() { return getCDimensionInfos(); };
00363   inline ML_DEPRECATED std::vector<DateTime>&    getTDimInfos() { return getTDimensionInfos(); };
00366   inline ML_DEPRECATED std::vector<std::string>& getUDimInfos() { return getUDimensionInfos(); };
00369   inline ML_DEPRECATED const std::vector<std::string>   &getConstCDimInfos() const  { return getCDimensionInfos(); };
00372   inline ML_DEPRECATED const std::vector<DateTime>      &getConstTDimInfos() const  { return getTDimensionInfos(); };
00375   inline ML_DEPRECATED const std::vector<std::string>   &getConstUDimInfos() const  { return getUDimensionInfos(); };
00376   
00378   
00379 #endif // ML_DEPRECATED
00380   
00381 };
00382 
00383 
00384 #ifdef _MSC_VER
00385 
00386 #pragma warning( pop )
00387 #endif
00388 
00389 
00390 ML_END_NAMESPACE
00391 
00392 
00393 
00394 
00395 
00396 #endif //of  __mlMedicalImageProperties_H
00397 
00398 
00399