ML Reference
mlImageProperties.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_IMAGE_PROPERTIES_H
14#define ML_IMAGE_PROPERTIES_H
15
19
20#include "mlInitSystemML.h"
21#include "mlSubImageBox.h"
22
23#include <mlImageVector.h>
24
25ML_START_NAMESPACE
26
27
28//-------------------------------------------------------------------------
41//-------------------------------------------------------------------------
42class ML_UNIX_ONLY_EXPORT(MLEXPORT) ImageProperties
43{
44
45public:
46 //-------------------------------------------------------------------
49 //-------------------------------------------------------------------
53
56
60 MLDataType dataType,
61 MLdouble minValue,
62 MLdouble maxValue);
63
66 MLEXPORT ImageProperties(const ImageProperties& imageProperties);
67
71
73 MLEXPORT void setImageProperties(const ImageProperties& imageProperties);
75
76 //-------------------------------------------------------------------
79 //-------------------------------------------------------------------
81 MLEXPORT bool operator==(const ImageProperties& imageProperties) const;
82
84 MLEXPORT bool operator!=(const ImageProperties& imageProperties) const;
86
87 //-------------------------------------------------------------------
90 //-------------------------------------------------------------------
92 MLEXPORT void setImageExtent(const ImageVector& extent) { _extent=extent; }
93
95 inline ImageVector getImageExtent() const { return _extent; }
96
98 inline SubImageBox getBoxFromImageExtent() const { return SubImageBox(ImageVector(static_cast<MLint>(0)), getImageExtent()-ImageVector(static_cast<MLint>(1))); }
99
101 inline bool hasValidExtent() const {
102 return getNumVoxels() > 0;
103 }
104
107 inline MLint getNumVoxels() const { const MLint retVal = ImageVector::compMul(_extent); return retVal < 0 ? 0 : retVal; }
108
111 inline MLint getSizeInBytes() const{ return getNumVoxels() * static_cast<MLint>(MLSizeOf(_dataType)); }
113
114 //-------------------------------------------------------------------
117 //-------------------------------------------------------------------
119 MLEXPORT virtual void setDataType(MLDataType dataType);
120
122 inline MLDataType getDataType() const { return _dataType; }
124
125 //-------------------------------------------------------------------
128 //-------------------------------------------------------------------
130 inline void setMinVoxelValue(MLdouble minval) { _minVoxelValue=minval; }
132 inline MLdouble getMinVoxelValue() const { return _minVoxelValue; }
134 inline void setMaxVoxelValue(MLdouble maxval) { _maxVoxelValue=maxval; }
136 inline MLdouble getMaxVoxelValue() const { return _maxVoxelValue; }
138
139private:
140
143 void _assignMembers(const ImageProperties &imgProps);
144
145 //-------------------------------------------------------------------
148 //-------------------------------------------------------------------
150 MLDataType _dataType;
151
153 ImageVector _extent;
154
156 MLdouble _minVoxelValue;
157
159 MLdouble _maxVoxelValue;
160
162};
163
164
165ML_END_NAMESPACE
166
167#endif //of __mlImageProperties_H
168
169
170
This class represents basic image properties:
MLEXPORT ImageProperties()
Constructor.
MLdouble getMaxVoxelValue() const
Returns the assumed maximum value in data.
MLEXPORT bool operator!=(const ImageProperties &imageProperties) const
Returns true if *this and imageProperties differ, otherwise false.
MLEXPORT ImageProperties(ImageVector extent, MLDataType dataType, MLdouble minValue, MLdouble maxValue)
Constructor to set extent to extent, data type to dataType, minimum value to minValue and maximum val...
bool hasValidExtent() const
Returns if the image has a valid extent (which means that all components are greater than 0).
MLDataType getDataType() const
Returns the data type of the image.
void setMaxVoxelValue(MLdouble maxval)
Sets assumed maximum value to maxval.
MLEXPORT void setImageExtent(const ImageVector &extent)
Sets the extent of the (sub)image.
virtual MLEXPORT void setDataType(MLDataType dataType)
Sets type of data to dataType.
MLEXPORT ImageProperties & operator=(const ImageProperties &imageProperties)
Assignment operator from an existing imageProperties object to get an identical copy.
SubImageBox getBoxFromImageExtent() const
Returns size of image as box with origin 0.
MLint getNumVoxels() const
Returns number of voxels in (sub)image.
virtual MLEXPORT ~ImageProperties()
Virtual destructor to suppress compiler warnings.
ImageVector getImageExtent() const
Returns the extent of the (sub)image.
void setMinVoxelValue(MLdouble minval)
Sets assumed minimum value to minval.
MLEXPORT ImageProperties(const ImageProperties &imageProperties)
Copy constructor from an existing imageProperties object to get an identical copy.
MLdouble getMinVoxelValue() const
Returns the assumed minimum value in data.
MLEXPORT void setImageProperties(const ImageProperties &imageProperties)
Copy property parameters from another image property instance imageProperties.
MLEXPORT bool operator==(const ImageProperties &imageProperties) const
Returns true if *this and imageProperties are identical, otherwise false.
MLint getSizeInBytes() const
Returns number of potential bytes in (sub)image.
MLEXPORT size_t MLSizeOf(MLDataType dataType)
Returns the size of the data type dataType in bytes.
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:596
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
double MLdouble
Definition mlTypeDefs.h:217
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:490