00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013 #ifndef LTI_UTILS_H
00014 #define LTI_UTILS_H
00015
00016
00017 #include "lti_types.h"
00018
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
00096 static bool needsSwapping(LTIDataType datatype, LTIEndian byteOrder);
00097
00102
00114 static void convertWindowLevelToMinMax(double window, double level,
00115 double& drmin, double& drmax);
00116
00131 static void convertMinMaxToWindowLevel(double drmin, double drmax,
00132 double& window, double& level);
00139
00153 static lt_int32 magToLevel(double mag);
00154
00165 static double levelToMag(lt_int32 level);
00166
00175 static double snapToOctave(double mag, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
00176
00187 static double snapToOctave(double mag, const LTIImageStage &imageStage, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
00188
00189 static bool isOctave(double mag);
00190
00191
00200 static lt_uint8 getNumLevelsForIcon(lt_uint32 width,
00201 lt_uint32 height,
00202 lt_uint32 iconsize);
00203
00217 static LT_STATUS getDimsAtMag(lt_uint32 width, lt_uint32 height,
00218 double mag,
00219 lt_uint32 &scaledWidth, lt_uint32 &scaledHeight);
00220
00239 static void getVersionInfo(lt_uint32& major,
00240 lt_uint32& minor,
00241 lt_uint32& revision,
00242 lt_uint32& build,
00243 const char*& branch);
00244
00254 static const char* getVersionString();
00255
00256 private:
00257
00258 LTIUtils();
00259 LTIUtils(const LTIUtils&);
00260 };
00261
00262
00263 LT_END_NAMESPACE(LizardTech)
00264
00265 #endif // LTI_UTILS_H