MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
26
27
28//-------------------------------------------------------------------------
41//-------------------------------------------------------------------------
43{
44
45public:
46 //-------------------------------------------------------------------
49 //-------------------------------------------------------------------
53
56
60
64
68
72
73 //-------------------------------------------------------------------
76 //-------------------------------------------------------------------
79
83
84 //-------------------------------------------------------------------
87 //-------------------------------------------------------------------
90 {
91 _extent = extent;
92 }
93
96 {
97 return _extent;
98 }
99
102 {
103 return SubImageBox(ImageVector(static_cast<MLint>(0)), getImageExtent() - ImageVector(static_cast<MLint>(1)));
104 }
105
107 inline bool hasValidExtent() const
108 {
109 return getNumVoxels() > 0;
110 }
111
114 inline MLint getNumVoxels() const
115 {
116 const MLint retVal = ImageVector::compMul(_extent);
117 return retVal < 0 ? 0 : retVal;
118 }
119
122 inline MLint getSizeInBytes() const
123 {
124 return getNumVoxels() * static_cast<MLint>(MLSizeOf(_dataType));
125 }
127
128 //-------------------------------------------------------------------
131 //-------------------------------------------------------------------
133 MLEXPORT virtual void setDataType(MLDataType dataType);
134
136 inline MLDataType getDataType() const
137 {
138 return _dataType;
139 }
141
142 //-------------------------------------------------------------------
145 //-------------------------------------------------------------------
148 {
149 _minVoxelValue = minval;
150 }
153 {
154 return _minVoxelValue;
155 }
158 {
159 _maxVoxelValue = maxval;
160 }
163 {
164 return _maxVoxelValue;
165 }
167
168private:
171 void _assignMembers(const ImageProperties& imgProps);
172
173 //-------------------------------------------------------------------
176 //-------------------------------------------------------------------
178 MLDataType _dataType;
179
181 ImageVector _extent;
182
184 MLdouble _minVoxelValue;
185
187 MLdouble _maxVoxelValue;
188
190};
191
192
194
195#endif // of __mlImageProperties_H
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, it returns 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,...
bool hasValidExtent() const
Returns whether 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 the size of image as box with origin 0.
MLint getNumVoxels() const
Returns the 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)
Copies property parameters from another image property instance imageProperties.
MLEXPORT bool operator==(const ImageProperties &imageProperties) const
Returns true if *this and imageProperties are identical; otherwise, it returns false.
MLint getSizeInBytes() const
Returns the 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:592
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
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:489