MrSID Decode SDK for Raster Reference Manual  9.5.5.5244
lti_utils.h
Go to the documentation of this file.
1 //
2 // This code is property of Celartem, Inc dba Extensis.
3 // Copyright (c) 1995-2023. All rights reserved.
4 // Use permitted only under license from Extensis.
5 //
6 /* PUBLIC */
7 
8 #ifndef LTI_UTILS_H
9 #define LTI_UTILS_H
10 
11 
12 // lt_lib_mrsid_core
13 #include "lti_types.h"
14 
15 LT_BEGIN_LIZARDTECH_NAMESPACE
16 #define LTI_DEFAULT_MAG_SNAP_THRESHOLD 0.41503749927884381
17 
26 class LTIUtils
27 {
28 public:
40 
41 #if 1 //JAH deprecate
48  static LTIColorSpace getColorSpaceWithoutAlpha(LTIColorSpace colorspace);
49 
56  static bool hasAlphaBand(LTIColorSpace colorspace);
57 #endif
67  static lt_uint8 getNumBytes(LTIDataType datatype);
68 
78  static bool isSigned(LTIDataType datatype);
79 
89  static bool isIntegral(LTIDataType datatype);
90  static bool isFloatingPoint(LTIDataType datatype);
91 
92  static double getMinValue(LTIDataType datatype);
93  static double getMaxValue(LTIDataType datatype);
94 
95  static bool needsSwapping(LTIDataType datatype, LTIEndian byteOrder);
96 
101 
113  static void convertWindowLevelToMinMax(double window, double level,
114  double& drmin, double& drmax);
115 
130  static void convertMinMaxToWindowLevel(double drmin, double drmax,
131  double& window, double& level);
138 
152  static lt_int32 magToLevel(double mag);
153 
164  static double levelToMag(lt_int32 level);
165 
174  static double snapToOctave(double mag, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
175 
186  static double snapToOctave(double mag, const LTIImage &imageStage, double threshold = LTI_DEFAULT_MAG_SNAP_THRESHOLD);
187 
188  static bool isOctave(double mag);
189 
190 
200  lt_uint32 height,
201  lt_uint32 iconsize);
202 
211  static double getMagForIcon(lt_uint32 width,
212  lt_uint32 height,
213  lt_uint32 iconsize);
214 
215  static double getMaxMag(lt_uint32 width, lt_uint32 height);
216 
231  double mag,
232  lt_uint32 &scaledWidth, lt_uint32 &scaledHeight);
233 
252  static void getVersionInfo(lt_uint32& major,
253  lt_uint32& minor,
254  lt_uint32& revision,
255  lt_uint32& build,
256  const char*& branch);
257 
267  static const char* getVersionString();
268 
269 
271 
272 
273 
274 private:
275  // nope
276  LTIUtils();
277  LTIUtils(const LTIUtils&);
278 };
279 
280 
281 LT_END_LIZARDTECH_NAMESPACE
282 
283 #endif // LTI_UTILS_H
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:30
unsigned char lt_uint8
unsigned 8-bit integer
Definition: lt_types.h:36
unsigned int lt_uint32
unsigned 32-bit integer
Definition: lt_types.h:44
signed int lt_int32
signed 32-bit integer
Definition: lt_types.h:42
This file contains a number of enums, typedefs, etc, that are used throughout the MrSID SDK.
LTIDataType
datatypes
Definition: lti_types.h:101
LTIColorSpace
colorspaces
Definition: lti_types.h:34
LTIEndian
constants representing endianness (byte order)
Definition: lti_types.h:160
#define LTI_DEFAULT_MAG_SNAP_THRESHOLD
Definition: lti_utils.h:16
abstract class representing an image
Definition: lti_image.h:28
utility functions
Definition: lti_utils.h:27
static double getMinValue(LTIDataType datatype)
static double getMagForIcon(lt_uint32 width, lt_uint32 height, lt_uint32 iconsize)
get the magnification needed to scale an image to a given icon size
static bool isOctave(double mag)
convert mag to level
static bool needsSwapping(LTIDataType datatype, LTIEndian byteOrder)
static bool isIntegral(LTIDataType datatype)
returns true if datatype is integral
static const char * getVersionString()
get SDK version information as a string
static bool isFloatingPoint(LTIDataType datatype)
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 lt_uint8 getNumBytes(LTIDataType datatype)
returns number of bytes for a given a datatype
static LTIColorSpace mergeAlpha(LTIColorSpace base, LTIColorSpace alpha)
convert mag to level
static void convertMinMaxToWindowLevel(double drmin, double drmax, double &window, double &level)
convert from min/max to window/level
static bool hasAlphaBand(LTIColorSpace colorspace)
returns true with colorspace has alpha channel flags
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
static LT_STATUS getDimsAtMag(lt_uint32 width, lt_uint32 height, double mag, lt_uint32 &scaledWidth, lt_uint32 &scaledHeight)
get dimensions at an octave
static double getMaxValue(LTIDataType datatype)
static double snapToOctave(double mag, const LTIImage &imageStage, double threshold=0.41503749927884381)
snap to octave
static double snapToOctave(double mag, double threshold=0.41503749927884381)
snap to octave
static void getVersionInfo(lt_uint32 &major, lt_uint32 &minor, lt_uint32 &revision, lt_uint32 &build, const char *&branch)
get SDK version information
static bool isSigned(LTIDataType datatype)
returns true if datatype is signed
static double getMaxMag(lt_uint32 width, lt_uint32 height)
convert mag to level
static lt_uint8 getMinNumSamplesPerPixel(LTIColorSpace colorspace)
returns number of samples per pixel
static lt_int32 magToLevel(double mag)
convert mag to level

Extensis