00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef HxImageSignature_h
00011 #define HxImageSignature_h
00012
00013 #include "HxValueType.h"
00014 #include "HxString.h"
00015 #include "HxClassName.h"
00016
00017 class L_HXIMAGEREP HxImageSignature;
00018
00019 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DBYTE;
00020 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DSHORT;
00021 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DINT;
00022 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DFLOAT;
00023 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DDOUBLE;
00024 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC2BYTE;
00025 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC2SHORT;
00026 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC2INT;
00027 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC2FLOAT;
00028 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC2DOUBLE;
00029 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC3BYTE;
00030 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC3SHORT;
00031 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC3INT;
00032 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC3FLOAT;
00033 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DVEC3DOUBLE;
00034 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG1DCOMPLEX;
00035
00036 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DBYTE;
00037 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DSHORT;
00038 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DINT;
00039 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DFLOAT;
00040 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DDOUBLE;
00041 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC2BYTE;
00042 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC2SHORT;
00043 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC2INT;
00044 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC2FLOAT;
00045 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC2DOUBLE;
00046 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC3BYTE;
00047 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC3SHORT;
00048 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC3INT;
00049 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC3FLOAT;
00050 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DVEC3DOUBLE;
00051 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG2DCOMPLEX;
00052
00053 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DBYTE;
00054 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DSHORT;
00055 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DINT;
00056 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DFLOAT;
00057 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DDOUBLE;
00058 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC2BYTE;
00059 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC2SHORT;
00060 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC2INT;
00061 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC2FLOAT;
00062 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC2DOUBLE;
00063 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC3BYTE;
00064 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC3SHORT;
00065 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC3INT;
00066 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC3FLOAT;
00067 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DVEC3DOUBLE;
00068 extern L_HXIMAGEREP const HxImageSignature HXIMAGESIG3DCOMPLEX;
00069
00070 #define SIG_ID(id, pd, pt, pp) \
00071 (((id-1) << 10) + (((pd)-1) << 8) + ((pt) << 7) + (pp))
00072
00073
00079 class L_HXIMAGEREP HxImageSignature {
00080 public:
00081
00083
00085 HxImageSignature();
00086
00088 HxImageSignature(const HxImageSignature&);
00089
00091 HxImageSignature(int imageDimensionality,
00092 int pixelDimensionality, HxValueType pixelType,
00093 int pixelPrecision);
00094
00096
00098
00100 HxImageSignature& operator=(const HxImageSignature&);
00101
00103 bool isEqual(const HxImageSignature&) const;
00104
00114 HxImageSignature broadest(const HxImageSignature&) const;
00115
00117 bool operator==(const HxImageSignature&) const;
00118
00120 int operator!=(const HxImageSignature&) const;
00121
00123 bool operator<(const HxImageSignature&) const;
00125
00126 int ident() const;
00127
00129
00131 int imageDimensionality() const;
00132
00137 int pixelDimensionality() const;
00138
00140 HxValueType pixelType() const;
00141
00145 int pixelPrecision() const;
00147
00149
00151 void setImageDimensionality(int);
00152
00154 void setPixelDimensionality(int);
00155
00157 void setPixelType(HxValueType);
00158
00160 void setPixelPrecision(int);
00162
00164
00166 virtual STD_OSTREAM& put(STD_OSTREAM&) const;
00167
00169 virtual HxString toString() const;
00170
00172 static HxImageSignature NameToSignature(HxString name);
00174 protected:
00175
00176 int _imageDimensionality;
00177 int _pixelDimensionality;
00178 HxValueType _pixelType;
00179 int _pixelPrecision;
00180 };
00181
00182 inline STD_OSTREAM&
00183 operator<<(STD_OSTREAM& os, const HxImageSignature& sig)
00184 {
00185 return sig.put(os);
00186 }
00187
00188 inline HxString makeString(const HxImageSignature& s)
00189 {
00190 return s.toString();
00191 }
00192
00193 template<>
00194 struct HxClassName<HxImageSignature> {
00195 operator HxString() {
00196 static HxImageSignature sig;
00197 return sig.toString();
00198 }
00199 };
00200
00201 inline
00202 HxImageSignature::HxImageSignature()
00203 {
00204 _imageDimensionality = 2;
00205 _pixelDimensionality = 1;
00206 _pixelType = INT_VALUE;
00207 _pixelPrecision = sizeof(short) << 3;
00208 }
00209
00210 inline
00211 HxImageSignature::HxImageSignature(
00212 int imgDim, int pixDim, HxValueType pixType, int pixPrec)
00213 {
00214 _imageDimensionality = imgDim;
00215 _pixelDimensionality = pixDim;
00216 _pixelType = pixType;
00217 _pixelPrecision = pixPrec;
00218 }
00219
00220 inline
00221 HxImageSignature::HxImageSignature(const HxImageSignature& rhs)
00222 : _imageDimensionality(rhs._imageDimensionality),
00223 _pixelDimensionality(rhs._pixelDimensionality),
00224 _pixelType(rhs._pixelType),
00225 _pixelPrecision(rhs._pixelPrecision)
00226 {
00227 }
00228
00229
00230 inline HxImageSignature&
00231 HxImageSignature::operator=(const HxImageSignature& rhs)
00232 {
00233 _imageDimensionality = rhs._imageDimensionality;
00234 _pixelDimensionality = rhs._pixelDimensionality;
00235 _pixelType = rhs._pixelType;
00236 _pixelPrecision = rhs._pixelPrecision;
00237 return *this;
00238 }
00239
00240 inline int
00241 HxImageSignature::imageDimensionality() const
00242 {
00243 return _imageDimensionality;
00244 }
00245
00246 inline int
00247 HxImageSignature::pixelDimensionality() const
00248 {
00249 return _pixelDimensionality;
00250 }
00251
00252 inline HxValueType
00253 HxImageSignature::pixelType() const
00254 {
00255 return _pixelType;
00256 }
00257
00258 inline int
00259 HxImageSignature::pixelPrecision() const
00260 {
00261 return _pixelPrecision;
00262 }
00263
00264 inline void
00265 HxImageSignature::setImageDimensionality(int i)
00266 {
00267 _imageDimensionality = i;
00268 }
00269
00270 inline void
00271 HxImageSignature::setPixelDimensionality(int i)
00272 {
00273 _pixelDimensionality = i;
00274 }
00275
00276 inline void
00277 HxImageSignature::setPixelType(HxValueType t)
00278 {
00279 _pixelType = t;
00280 }
00281
00282 inline void
00283 HxImageSignature::setPixelPrecision(int i)
00284 {
00285 _pixelPrecision = i;
00286 }
00287
00288 inline bool
00289 HxImageSignature::operator==(const HxImageSignature& rhs) const
00290 {
00291 return isEqual(rhs);
00292 }
00293
00294 inline int
00295 HxImageSignature::operator!=(const HxImageSignature& rhs) const
00296 {
00297 return !isEqual(rhs);
00298 }
00299
00300 #endif