#include <HxImageSignature.h>
Inheritance diagram for HxImageSignature::
Constructors | |
HxImageSignature () | |
Default constructor. More... | |
HxImageSignature (const HxImageSignature &) | |
Copy constructor. More... | |
HxImageSignature (int imageDimensionality, int pixelDimensionality, HxValueType pixelType, int pixelPrecision) | |
Construct signature with given description. More... | |
Operators | |
HxImageSignature & | operator= (const HxImageSignature &) |
Assignment operator. More... | |
bool | isEqual (const HxImageSignature &) const |
Equality for signatures. More... | |
HxImageSignature | broadest (const HxImageSignature &) const |
Broadest signature. More... | |
bool | operator== (const HxImageSignature &) const |
Equal. More... | |
int | operator!= (const HxImageSignature &) const |
Not equal. More... | |
bool | operator< (const HxImageSignature &) const |
Smaller. More... | |
Inquiry | |
int | imageDimensionality () const |
The dimensionality of the image (1, 2, or 3). More... | |
int | pixelDimensionality () const |
The dimensionality of the pixel values in the image (1: scalar value, 2: vector of 2 scalars, 3: vector of 3 scalars). More... | |
HxValueType | pixelType () const |
The type of the pixel values. More... | |
int | pixelPrecision () const |
The number of bits used in the representation of a pixel value (8, 16, 32, or 64). More... | |
Modification | |
void | setImageDimensionality (int) |
Set the image dimensionality. More... | |
void | setPixelDimensionality (int) |
Set the dimensionality of the pixel values. More... | |
void | setPixelType (HxValueType) |
Set the type of the pixel values. More... | |
void | setPixelPrecision (int) |
Set the number of bits used in the representation. More... | |
Output | |
virtual STD_OSTREAM & | put (STD_OSTREAM &) const |
Print value on stream. More... | |
virtual HxString | toString () const |
Value as a string. More... | |
HxImageSignature | NameToSignature (HxString name) |
Make signature from name. More... | |
Public Methods | |
int | ident () const |
Protected Attributes | |
int | _imageDimensionality |
int | _pixelDimensionality |
HxValueType | _pixelType |
int | _pixelPrecision |
The signature gives a description of the characteristics of an image type (class).
|
Default constructor.
00203 { 00204 _imageDimensionality = 2; 00205 _pixelDimensionality = 1; 00206 _pixelType = INT_VALUE; 00207 _pixelPrecision = sizeof(short) << 3; 00208 } |
|
Copy constructor.
00222 : _imageDimensionality(rhs._imageDimensionality), 00223 _pixelDimensionality(rhs._pixelDimensionality), 00224 _pixelType(rhs._pixelType), 00225 _pixelPrecision(rhs._pixelPrecision) 00226 { 00227 } |
|
Construct signature with given description.
00213 { 00214 _imageDimensionality = imgDim; 00215 _pixelDimensionality = pixDim; 00216 _pixelType = pixType; 00217 _pixelPrecision = pixPrec; 00218 } |
|
Assignment operator.
00232 { 00233 _imageDimensionality = rhs._imageDimensionality; 00234 _pixelDimensionality = rhs._pixelDimensionality; 00235 _pixelType = rhs._pixelType; 00236 _pixelPrecision = rhs._pixelPrecision; 00237 return *this; 00238 } |
|
Equality for signatures. Same as operator==
00126 { 00127 if (_imageDimensionality != sig2._imageDimensionality) 00128 return false; 00129 if (_pixelDimensionality != sig2._pixelDimensionality) 00130 return false; 00131 if (_pixelType != sig2._pixelType) 00132 return false; 00133 if (_pixelPrecision != sig2._pixelPrecision) 00134 return false; 00135 return true; 00136 } |
|
Broadest signature. Defined as the "piecewise max" where max of integer and real equals real. In case one of the arguments has a pixel value type integer and the broadest signature has a pixel type real then the pixel precision of the result is doubled before computing the max to compensate for the loss of precision that occurs when integers are represented as floating point values.
00158 { 00159 HxImageSignature m; 00160 00161 m._imageDimensionality = std::max( _imageDimensionality, 00162 sig2._imageDimensionality); 00163 m._pixelDimensionality = std::max( _pixelDimensionality, 00164 sig2._pixelDimensionality); 00165 m._pixelType = std::max( _pixelType, 00166 sig2._pixelType); 00167 00168 int p1 = _pixelPrecision; 00169 int p2 = sig2._pixelPrecision; 00170 if ((m._pixelType == REAL_VALUE) || (m._pixelType == COMPLEX_VALUE)) 00171 { 00172 if (_pixelType == INT_VALUE) 00173 p1 = ((p1 << 1) <= doubleSize) ? (p1 << 1) : p1; 00174 if (sig2._pixelType == INT_VALUE) 00175 p2 = ((p2 << 1) <= doubleSize) ? (p2 << 1) : p2; 00176 } 00177 m._pixelPrecision = std::max(p1, p2); 00178 00179 return m; 00180 } |
|
Equal.
00290 { 00291 return isEqual(rhs); 00292 } |
|
Not equal.
00296 { 00297 return !isEqual(rhs); 00298 } |
|
Smaller. Only for sorting purposes!
00140 { 00141 if (_imageDimensionality < sig2._imageDimensionality) 00142 return true; 00143 if (_imageDimensionality > sig2._imageDimensionality) 00144 return false; 00145 if (_pixelDimensionality < sig2._pixelDimensionality) 00146 return true; 00147 if (_pixelDimensionality > sig2._pixelDimensionality) 00148 return false; 00149 if (_pixelType < sig2._pixelType) 00150 return true; 00151 if (_pixelType > sig2._pixelType) 00152 return false; 00153 return (_pixelPrecision < sig2._pixelPrecision); 00154 } |
|
The dimensionality of the image (1, 2, or 3).
00242 { 00243 return _imageDimensionality; 00244 } |
|
The dimensionality of the pixel values in the image (1: scalar value, 2: vector of 2 scalars, 3: vector of 3 scalars).
00248 { 00249 return _pixelDimensionality; 00250 } |
|
The type of the pixel values.
00254 { 00255 return _pixelType; 00256 } |
|
The number of bits used in the representation of a pixel value (8, 16, 32, or 64).
00260 { 00261 return _pixelPrecision; 00262 } |
|
Set the image dimensionality.
00266 { 00267 _imageDimensionality = i; 00268 } |
|
Set the dimensionality of the pixel values.
00272 { 00273 _pixelDimensionality = i; 00274 } |
|
Set the type of the pixel values.
00278 { 00279 _pixelType = t; 00280 } |
|
Set the number of bits used in the representation.
00284 { 00285 _pixelPrecision = i; 00286 } |
|
Print value on stream. For global operator<<
00191 { 00192 os << "Image" << imageDimensionality() << "d"; 00193 if ((pixelDimensionality() > 1) && (pixelType() != COMPLEX_VALUE)) 00194 os << "Vec" << pixelDimensionality(); 00195 switch (pixelType()) { 00196 case INT_VALUE: 00197 os << "Int"; 00198 break; 00199 case REAL_VALUE: 00200 os << "Real"; 00201 break; 00202 case COMPLEX_VALUE: 00203 os << "Complex"; 00204 break; 00205 } 00206 os << pixelPrecision(); 00207 return os; 00208 } |
|
Value as a string.
00212 { 00213 HxString s("Image"); 00214 s += makeString(imageDimensionality()) + "d"; 00215 if ((pixelDimensionality() > 1) && (pixelType() != COMPLEX_VALUE)) 00216 s += "Vec" + makeString(pixelDimensionality()); 00217 switch (pixelType()) { 00218 case INT_VALUE: 00219 s += "Int"; 00220 break; 00221 case REAL_VALUE: 00222 s += "Real"; 00223 break; 00224 case COMPLEX_VALUE: 00225 s += "Complex"; 00226 break; 00227 } 00228 s += makeString(pixelPrecision()); 00229 return s; 00230 } |
|
Make signature from name.
00271 { 00272 static bool init = SignatureMapInit(); 00273 SignatureMap::iterator p = signatureMap.find(name); 00274 return (p != signatureMap.end()) ? 00275 (*p).second : 00276 HxImageSignature(2, 1, INT_VALUE, 8); 00277 } |