MrSID Decode SDK for Raster Reference Manual  9.0.0.3864
lti_utils.h
Go to the documentation of this file.
1 /* $Id$ */
2 /* //////////////////////////////////////////////////////////////////////////
3 // //
4 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
5 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
6 // prohibited. Access to and use of this code is permitted only under //
7 // license from LizardTech, Inc. Portions of the code are protected by //
8 // US and foreign patents and other filings. All Rights Reserved. //
9 // //
11 /* PUBLIC */
12 
13 #ifndef LTI_UTILS_H
14 #define LTI_UTILS_H
15 
16 
17 // lt_lib_mrsid_core
18 #include "lti_types.h"
19 
20 LT_BEGIN_NAMESPACE(LizardTech)
21 #define LTI_DEFAULT_MAG_SNAP_THRESHOLD 0.41503749927884381
22 
31 class LTIUtils
32 {
33 public:
45 
46 #if 1 //JAH deprecate
47 
54 
61  static bool hasAlphaBand(LTIColorSpace colorspace);
62 #endif
63 
72  static lt_uint8 getNumBytes(LTIDataType datatype);
73 
83  static bool isSigned(LTIDataType datatype);
84 
94  static bool isIntegral(LTIDataType datatype);
95 
96  static double getMinValue(LTIDataType datatype);
97  static double getMaxValue(LTIDataType datatype);
98 
99  static bool needsSwapping(LTIDataType datatype, LTIEndian byteOrder);
100 
105 
117  static void convertWindowLevelToMinMax(double window, double level,
118  double& drmin, double& drmax);
119 
134  static void convertMinMaxToWindowLevel(double drmin, double drmax,
135  double& window, double& level);
142 
156  static lt_int32 magToLevel(double mag);
157 
168  static double levelToMag(lt_int32 level);
169 
178  static double snapToOctave(double mag, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
179 
190  static double snapToOctave(double mag, const LTIImageStage &imageStage, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
191 
192  static bool isOctave(double mag);
193 
194 
204  lt_uint32 height,
205  lt_uint32 iconsize);
206 
207 #if 0
208 
216  static double getMagForIcon(lt_uint32 width,
217  lt_uint32 height,
218  lt_uint32 iconsize);
219 
220  static double getMaxMag(lt_uint32 width, lt_uint32 height);
221 #endif
222 
236  static LT_STATUS getDimsAtMag(lt_uint32 width, lt_uint32 height,
237  double mag,
238  lt_uint32 &scaledWidth, lt_uint32 &scaledHeight);
239 
258  static void getVersionInfo(lt_uint32& major,
259  lt_uint32& minor,
260  lt_uint32& revision,
261  lt_uint32& build,
262  const char*& branch);
263 
273  static const char* getVersionString();
274 
275 private:
276  // nope
277  LTIUtils();
278  LTIUtils(const LTIUtils&);
279 };
280 
281 
282 LT_END_NAMESPACE(LizardTech)
283 
284 #endif // LTI_UTILS_H
static bool hasAlphaBand(LTIColorSpace colorspace)
returns true with colorspace has alpha channel flags
static void getVersionInfo(lt_uint32 &major, lt_uint32 &minor, lt_uint32 &revision, lt_uint32 &build, const char *&branch)
get SDK version information
static lt_uint8 getNumBytes(LTIDataType datatype)
returns number of bytes for a given a datatype
utility functions
Definition: lti_utils.h:31
LTIEndian
constants representing endianness (byte order)
Definition: lti_types.h:164
static bool isSigned(LTIDataType datatype)
returns true if datatype is signed
static lt_uint8 getMinNumSamplesPerPixel(LTIColorSpace colorspace)
returns number of samples per pixel
LTIDataType
datatypes
Definition: lti_types.h:105
static double getMinValue(LTIDataType datatype)
#define LT_END_NAMESPACE(theNameSpace)
compiler does not support namespaces
Definition: lt_define.h:85
static LT_STATUS getDimsAtMag(lt_uint32 width, lt_uint32 height, double mag, lt_uint32 &scaledWidth, lt_uint32 &scaledHeight)
get dimensions at an octave
static bool isIntegral(LTIDataType datatype)
returns true if datatype is integral
static double getMaxValue(LTIDataType datatype)
static LTIColorSpace getColorSpaceWithoutAlpha(LTIColorSpace colorspace)
returns the colorspace without alpha channel flag
signed int lt_int32
signed 32-bit integer
Definition: lt_types.h:52
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:39
static const char * getVersionString()
get SDK version information as a string
static lt_int32 magToLevel(double mag)
convert mag to level
static bool needsSwapping(LTIDataType datatype, LTIEndian byteOrder)
static double snapToOctave(double mag, double threshold=0.41503749927884381)
snap to octave
#define LTI_DEFAULT_MAG_SNAP_THRESHOLD
Definition: lti_utils.h:21
static double levelToMag(lt_int32 level)
convert level to mag
static void convertWindowLevelToMinMax(double window, double level, double &drmin, double &drmax)
convert from window/level to min/max
static bool isOctave(double mag)
convert mag to level
static void convertMinMaxToWindowLevel(double drmin, double drmax, double &window, double &level)
convert from min/max to window/level
static lt_uint8 getNumLevelsForIcon(lt_uint32 width, lt_uint32 height, lt_uint32 iconsize)
get the number of levels needed to scale an image to a given icon size
LTIColorSpace
colorspaces
Definition: lti_types.h:38
This file contains a number of enums, typedefs, etc, that are used throughout the MrSID SDK...
abstract class for decoding from an image
#define LT_BEGIN_NAMESPACE(theNameSpace)
compiler does not support namespaces
Definition: lt_define.h:84
unsigned int lt_uint32
unsigned 32-bit integer
Definition: lt_types.h:54
unsigned char lt_uint8
unsigned 8-bit integer
Definition: lt_types.h:46

LizardTech