MrSID Decode SDK for Raster Reference Manual  9.0.0.3864
lti_utils.h
Go to the documentation of this file.
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 
00096    static double getMinValue(LTIDataType datatype);
00097    static double getMaxValue(LTIDataType datatype);
00098 
00099    static bool needsSwapping(LTIDataType datatype, LTIEndian byteOrder);
00100 
00105 
00117    static void convertWindowLevelToMinMax(double window, double level,
00118                                           double& drmin, double& drmax);
00119 
00134    static void convertMinMaxToWindowLevel(double drmin, double drmax,
00135                                           double& window, double& level);
00142 
00156    static lt_int32 magToLevel(double mag);
00157 
00168    static double levelToMag(lt_int32 level);
00169 
00178    static double snapToOctave(double mag, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
00179 
00190    static double snapToOctave(double mag, const LTIImageStage &imageStage, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
00191 
00192    static bool isOctave(double mag);
00193 
00194    
00203    static lt_uint8 getNumLevelsForIcon(lt_uint32 width,
00204                                        lt_uint32 height,
00205                                        lt_uint32 iconsize);
00206 
00207 #if 0
00208 
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 #endif
00222 
00236    static LT_STATUS getDimsAtMag(lt_uint32 width, lt_uint32 height,
00237                                  double mag,
00238                                  lt_uint32 &scaledWidth, lt_uint32 &scaledHeight);
00239    
00258    static void getVersionInfo(lt_uint32& major,
00259                               lt_uint32& minor,
00260                               lt_uint32& revision,
00261                               lt_uint32& build,
00262                               const char*& branch);
00263 
00273    static const char* getVersionString();
00274 
00275 private:
00276    // nope
00277    LTIUtils();
00278    LTIUtils(const LTIUtils&);
00279 };
00280 
00281 
00282 LT_END_NAMESPACE(LizardTech)
00283 
00284 #endif // LTI_UTILS_H