ML Reference
MeVis/Foundation/Sources/ML/include/mlImageProperties.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //-------------------------------------------------------------------------
00011 //-------------------------------------------------------------------------
00012 #ifndef __mlImageProperties_H
00013 #define __mlImageProperties_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 
00023 ML_START_NAMESPACE
00024 
00025 
00026 //-------------------------------------------------------------------------
00039 //-------------------------------------------------------------------------
00040 class ImageProperties
00041 {
00042 
00043 public:
00044   //-------------------------------------------------------------------
00046 
00047   //-------------------------------------------------------------------
00050   MLEXPORT ImageProperties();
00051 
00053   MLEXPORT virtual ~ImageProperties();
00054 
00057   MLEXPORT ImageProperties(ImageVector extent,
00058                            MLDataType  dataType,
00059                            MLdouble    minValue,
00060                            MLdouble    maxValue);
00061 
00064   MLEXPORT ImageProperties(const ImageProperties& imageProperties);
00065 
00068   MLEXPORT ImageProperties &operator=(const ImageProperties& imageProperties);
00069 
00071   MLEXPORT void setImageProperties(const ImageProperties& imageProperties);
00073 
00074   //-------------------------------------------------------------------
00076 
00077   //-------------------------------------------------------------------
00079   MLEXPORT bool operator==(const ImageProperties& imageProperties) const;
00080 
00082   MLEXPORT bool operator!=(const ImageProperties& imageProperties) const;
00084 
00085   //-------------------------------------------------------------------
00087 
00088   //-------------------------------------------------------------------
00090   MLEXPORT void setImageExtent(const ImageVector& extent)  { _extent=extent; }
00091 
00093   inline ImageVector getImageExtent() const { return _extent; }
00094 
00096   inline SubImageBox getBoxFromImageExtent() const { return SubImageBox(ImageVector(static_cast<MLint>(0)), getImageExtent()-ImageVector(static_cast<MLint>(1))); }
00097 
00099   inline bool hasValidExtent() const {
00100     return getNumVoxels() > 0;
00101   }
00102 
00105   inline MLint getNumVoxels() const { const MLint retVal = ImageVector::compMul(_extent); return retVal < 0 ? 0 : retVal; }
00106 
00109   inline MLint getSizeInBytes() const{ return getNumVoxels() * static_cast<MLint>(MLSizeOf(_dataType)); }
00111 
00112   //-------------------------------------------------------------------
00114 
00115   //-------------------------------------------------------------------
00117   MLEXPORT virtual void setDataType(MLDataType dataType);
00118 
00120   inline MLDataType getDataType() const { return _dataType;        }
00122 
00123   //-------------------------------------------------------------------
00125 
00126   //-------------------------------------------------------------------
00128   inline void     setMinVoxelValue(MLdouble minval)    { _minVoxelValue=minval; }
00130   inline MLdouble getMinVoxelValue()             const { return _minVoxelValue; }
00132   inline void     setMaxVoxelValue(MLdouble maxval)    { _maxVoxelValue=maxval; }
00134   inline MLdouble getMaxVoxelValue()             const { return _maxVoxelValue; }
00136 
00137 private:
00138 
00141   void _assignMembers(const ImageProperties &imgProps);
00142 
00143   //-------------------------------------------------------------------
00145 
00146   //-------------------------------------------------------------------
00148   MLDataType   _dataType;
00149 
00151   ImageVector _extent;
00152 
00154   MLdouble  _minVoxelValue;
00155 
00157   MLdouble  _maxVoxelValue;
00158 
00160 
00161 #ifdef ML_DEPRECATED
00162 
00164 
00165 
00166 public:
00167 
00170   inline MLEXPORT ML_DEPRECATED void setImgProps(const ImageProperties &imgProps) { setImageProperties(imgProps); }
00173   inline MLEXPORT ML_DEPRECATED void setImgExt(const ImageVector &ext)  { _extent=ext; }
00176   inline ML_DEPRECATED ImageVector getImgExt() const { return _extent; }
00179   inline ML_DEPRECATED SubImageBox getBoxFromImgExt() const  { return getBoxFromImageExtent(); }
00182   inline ML_DEPRECATED MLint getSize() const { return getNumVoxels(); }
00185   inline ML_DEPRECATED MLint getByteSize() const { return getSizeInBytes(); }
00186 
00188 
00189 #endif // ML_DEPRECATED
00190 
00191 };
00192 
00193 
00194 ML_END_NAMESPACE
00195 
00196 #endif //of  __mlImageProperties_H
00197 
00198 
00199