00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013 #ifndef LTI_UTILS_H
00014 #define LTI_UTILS_H
00015
00016
00017
00018 #include "lti_types.h"
00019
00020 LT_BEGIN_NAMESPACE(LizardTech)
00021 #define LTI_DEFAULT_MAG_SNAP_THRESHOLD 0.41503749927884381
00022
00031 class LTIUtils
00032 {
00033 public:
00044 static lt_uint8 getMinNumSamplesPerPixel(LTIColorSpace colorspace);
00045
00046 #if 1 //JAH deprecate
00047
00053 static LTIColorSpace getColorSpaceWithoutAlpha(LTIColorSpace colorspace);
00054
00061 static bool hasAlphaBand(LTIColorSpace colorspace);
00062 #endif
00063
00072 static lt_uint8 getNumBytes(LTIDataType datatype);
00073
00083 static bool isSigned(LTIDataType datatype);
00084
00094 static bool isIntegral(LTIDataType datatype);
00095 static bool isFloatingPoint(LTIDataType datatype);
00096
00097 static double getMinValue(LTIDataType datatype);
00098 static double getMaxValue(LTIDataType datatype);
00099
00100 static bool needsSwapping(LTIDataType datatype, LTIEndian byteOrder);
00101
00106
00118 static void convertWindowLevelToMinMax(double window, double level,
00119 double& drmin, double& drmax);
00120
00135 static void convertMinMaxToWindowLevel(double drmin, double drmax,
00136 double& window, double& level);
00143
00157 static lt_int32 magToLevel(double mag);
00158
00169 static double levelToMag(lt_int32 level);
00170
00179 static double snapToOctave(double mag, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
00180
00191 static double snapToOctave(double mag, const LTIImageStage &imageStage, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
00192
00193 static bool isOctave(double mag);
00194
00195
00204 static lt_uint8 getNumLevelsForIcon(lt_uint32 width,
00205 lt_uint32 height,
00206 lt_uint32 iconsize);
00207
00208 #if 0
00209
00217 static double getMagForIcon(lt_uint32 width,
00218 lt_uint32 height,
00219 lt_uint32 iconsize);
00220
00221 static double getMaxMag(lt_uint32 width, lt_uint32 height);
00222 #endif
00223
00237 static LT_STATUS getDimsAtMag(lt_uint32 width, lt_uint32 height,
00238 double mag,
00239 lt_uint32 &scaledWidth, lt_uint32 &scaledHeight);
00240
00259 static void getVersionInfo(lt_uint32& major,
00260 lt_uint32& minor,
00261 lt_uint32& revision,
00262 lt_uint32& build,
00263 const char*& branch);
00264
00274 static const char* getVersionString();
00275
00276 private:
00277
00278 LTIUtils();
00279 LTIUtils(const LTIUtils&);
00280 };
00281
00282
00283 LT_END_NAMESPACE(LizardTech)
00284
00285 #endif // LTI_UTILS_H