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
00216 static double getMagForIcon(lt_uint32 width,
00217 lt_uint32 height,
00218 lt_uint32 iconsize);
00219
00220 static double getMaxMag(lt_uint32 width, lt_uint32 height);
00221
00235 static LT_STATUS getDimsAtMag(lt_uint32 width, lt_uint32 height,
00236 double mag,
00237 lt_uint32 &scaledWidth, lt_uint32 &scaledHeight);
00238
00257 static void getVersionInfo(lt_uint32& major,
00258 lt_uint32& minor,
00259 lt_uint32& revision,
00260 lt_uint32& build,
00261 const char*& branch);
00262
00272 static const char* getVersionString();
00273
00274 private:
00275
00276 LTIUtils();
00277 LTIUtils(const LTIUtils&);
00278 };
00279
00280
00281 LT_END_NAMESPACE(LizardTech)
00282
00283 #endif // LTI_UTILS_H