MrSID Decode SDK for Raster Reference Manual
9.5.1.4427
|
00001 /* $Id$ */ 00002 /* ////////////////////////////////////////////////////////////////////////// 00003 // // 00004 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, // 00005 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution // 00006 // prohibited. Access to and use of this code is permitted only under // 00007 // license from LizardTech, Inc. Portions of the code are protected by // 00008 // US and foreign patents and other filings. All Rights Reserved. // 00009 // // 00011 /* PUBLIC */ 00012 00013 #ifndef LTI_UTILS_H 00014 #define LTI_UTILS_H 00015 00016 00017 // lt_lib_mrsid_core 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 // nope 00278 LTIUtils(); 00279 LTIUtils(const LTIUtils&); 00280 }; 00281 00282 00283 LT_END_NAMESPACE(LizardTech) 00284 00285 #endif // LTI_UTILS_H