Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxImageSignature Class Reference

Class definition image signature. More...

#include <HxImageSignature.h>

Inheritance diagram for HxImageSignature::

HxImageSig2dByte HxImageSig2dComplex HxImageSig2dDouble HxImageSig2dFloat HxImageSig2dInt HxImageSig2dShort HxImageSig2dVec2Byte HxImageSig2dVec2Double HxImageSig2dVec2Float HxImageSig2dVec2Int HxImageSig2dVec2Short HxImageSig2dVec3Byte HxImageSig2dVec3Double HxImageSig2dVec3Float HxImageSig2dVec3Int HxImageSig2dVec3Short HxImageSig3dByte HxImageSig3dDouble HxImageSig3dFloat HxImageSig3dInt HxImageSig3dShort List of all members.

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

Detailed Description

Class definition image signature.

The signature gives a description of the characteristics of an image type (class).


Constructor & Destructor Documentation

HxImageSignature::HxImageSignature   [inline]
 

Default constructor.

00203 {
00204     _imageDimensionality = 2;
00205     _pixelDimensionality = 1;
00206     _pixelType = INT_VALUE;
00207     _pixelPrecision = sizeof(short) << 3;
00208 }

HxImageSignature::HxImageSignature const HxImageSignature &    rhs [inline]
 

Copy constructor.

00222     :   _imageDimensionality(rhs._imageDimensionality),
00223         _pixelDimensionality(rhs._pixelDimensionality),
00224         _pixelType(rhs._pixelType),
00225         _pixelPrecision(rhs._pixelPrecision)
00226 {
00227 }

HxImageSignature::HxImageSignature int    imgDim,
int    pixDim,
HxValueType    pixType,
int    pixPrec
[inline]
 

Construct signature with given description.

00213 {
00214     _imageDimensionality = imgDim;
00215     _pixelDimensionality = pixDim;
00216     _pixelType = pixType;
00217     _pixelPrecision = pixPrec;
00218 }


Member Function Documentation

HxImageSignature & HxImageSignature::operator= const HxImageSignature &    rhs [inline]
 

Assignment operator.

00232 {
00233     _imageDimensionality = rhs._imageDimensionality;
00234     _pixelDimensionality = rhs._pixelDimensionality;
00235     _pixelType = rhs._pixelType;
00236     _pixelPrecision = rhs._pixelPrecision;
00237     return *this;
00238 }

bool HxImageSignature::isEqual const HxImageSignature &    sig2 const
 

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 }

HxImageSignature HxImageSignature::broadest const HxImageSignature &    sig2 const
 

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 }

bool HxImageSignature::operator== const HxImageSignature &    rhs const [inline]
 

Equal.

00290 {
00291     return isEqual(rhs);
00292 }

int HxImageSignature::operator!= const HxImageSignature &    rhs const [inline]
 

Not equal.

00296 {
00297     return !isEqual(rhs);
00298 }

bool HxImageSignature::operator< const HxImageSignature &    sig2 const
 

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 }

int HxImageSignature::imageDimensionality   const [inline]
 

The dimensionality of the image (1, 2, or 3).

00242 {
00243     return _imageDimensionality;
00244 }

int HxImageSignature::pixelDimensionality   const [inline]
 

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 }

HxValueType HxImageSignature::pixelType   const [inline]
 

The type of the pixel values.

00254 {
00255     return _pixelType;
00256 }

int HxImageSignature::pixelPrecision   const [inline]
 

The number of bits used in the representation of a pixel value (8, 16, 32, or 64).

00260 {
00261     return _pixelPrecision;
00262 }

void HxImageSignature::setImageDimensionality int    i [inline]
 

Set the image dimensionality.

00266 {
00267     _imageDimensionality = i;
00268 }

void HxImageSignature::setPixelDimensionality int    i [inline]
 

Set the dimensionality of the pixel values.

00272 {
00273     _pixelDimensionality = i;
00274 }

void HxImageSignature::setPixelType HxValueType    t [inline]
 

Set the type of the pixel values.

00278 {
00279     _pixelType = t;
00280 }

void HxImageSignature::setPixelPrecision int    i [inline]
 

Set the number of bits used in the representation.

00284 {
00285     _pixelPrecision = i;
00286 }

STD_OSTREAM & HxImageSignature::put STD_OSTREAM &    os const [virtual]
 

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 }

HxString HxImageSignature::toString   const [virtual]
 

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 }

HxImageSignature HxImageSignature::NameToSignature HxString    name [static]
 

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 }


The documentation for this class was generated from the following files:
Generated on Mon Jan 27 15:49:01 2003 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001