MrSID Decode SDK for Raster Reference Manual  9.5.4.4709
LTIUtils Class Reference

utility functions More...

#include <lti_utils.h>

Static Public Member Functions

static lt_uint8 getMinNumSamplesPerPixel (LTIColorSpace colorspace)
 returns number of samples per pixel More...
 
static LTIColorSpace getColorSpaceWithoutAlpha (LTIColorSpace colorspace)
 returns the colorspace without alpha channel flag More...
 
static bool hasAlphaBand (LTIColorSpace colorspace)
 returns true with colorspace has alpha channel flags More...
 
static lt_uint8 getNumBytes (LTIDataType datatype)
 returns number of bytes for a given a datatype More...
 
static bool isSigned (LTIDataType datatype)
 returns true if datatype is signed More...
 
static bool isIntegral (LTIDataType datatype)
 returns true if datatype is integral More...
 
static bool isFloatingPoint (LTIDataType datatype)
 
static double getMinValue (LTIDataType datatype)
 
static double getMaxValue (LTIDataType datatype)
 
static bool needsSwapping (LTIDataType datatype, LTIEndian byteOrder)
 
static void getVersionInfo (lt_uint32 &major, lt_uint32 &minor, lt_uint32 &revision, lt_uint32 &build, const char *&branch)
 get SDK version information More...
 
static const char * getVersionString ()
 get SDK version information as a string More...
 
Dynamic range conversion functions
static void convertWindowLevelToMinMax (double window, double level, double &drmin, double &drmax)
 convert from window/level to min/max More...
 
static void convertMinMaxToWindowLevel (double drmin, double drmax, double &window, double &level)
 convert from min/max to window/level More...
 
Mag/level conversion functions
static lt_int32 magToLevel (double mag)
 convert mag to level More...
 
static double levelToMag (lt_int32 level)
 convert level to mag More...
 
static double snapToOctave (double mag, double threshold=0.41503749927884381)
 snap to octave More...
 
static double snapToOctave (double mag, const LTIImageStage &imageStage, double threshold=0.41503749927884381)
 snap to octave More...
 
static bool isOctave (double mag)
 convert mag to level More...
 
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 More...
 
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 More...
 
static double getMaxMag (lt_uint32 width, lt_uint32 height)
 convert mag to level More...
 
static LT_STATUS getDimsAtMag (lt_uint32 width, lt_uint32 height, double mag, lt_uint32 &scaledWidth, lt_uint32 &scaledHeight)
 get dimensions at an octave More...
 

Detailed Description

The LTIUtils class contains a number of generally useful static functions, e.g. functions which operate on the enums declared in lti_types.h

Note
This is a "static" class; do not instantiate.

Definition at line 31 of file lti_utils.h.

Member Function Documentation

§ convertMinMaxToWindowLevel()

static void LTIUtils::convertMinMaxToWindowLevel ( double  drmin,
double  drmax,
double &  window,
double &  level 
)
static

This function converts a "minimum and maximum" style of dynamic range to a "window and level" style.

The "window" is defined as the width of the range, i.e. maximum - minimum + 1. The "level" is defined as the center of the window, i.e. minimum + 1/2 * window.

Parameters
drminthe dynamic range minimum value
drmaxthe dynamic range maximum value
windowthe window value
levelthe level value

§ convertWindowLevelToMinMax()

static void LTIUtils::convertWindowLevelToMinMax ( double  window,
double  level,
double &  drmin,
double &  drmax 
)
static

This function converts a "window and level" style of dynamic range to a "minimum and maximum" style.

Parameters
windowthe window value
levelthe level value
drminthe dynamic range minimum value
drmaxthe dynamic range maximum value

§ getColorSpaceWithoutAlpha()

static LTIColorSpace LTIUtils::getColorSpaceWithoutAlpha ( LTIColorSpace  colorspace)
static
Parameters
colorspacethe colorspace to query
Returns
colorspace with out the alpha band

§ getDimsAtMag()

static LT_STATUS LTIUtils::getDimsAtMag ( lt_uint32  width,
lt_uint32  height,
double  mag,
lt_uint32 scaledWidth,
lt_uint32 scaledHeight 
)
static

This function returns the dimensions of an image when scaled to the given magnification.

Parameters
widthinput width to be scaled
heightinput height to be scaled
magthe magnification to scale to
scaledWidthoutput width after scaling
scaledHeightoutput height after scaling
Returns
success or failule

§ getMagForIcon()

static double LTIUtils::getMagForIcon ( lt_uint32  width,
lt_uint32  height,
lt_uint32  iconsize 
)
static
Parameters
widthinput image width
heightinput image height
iconsizedesired icon size
Returns
the magnification

§ getMaxMag()

static double LTIUtils::getMaxMag ( lt_uint32  width,
lt_uint32  height 
)
static

This function converts a "magnification" value to a "level" value.

Examples:

  • full resolution: mag of 1.0 equals level of 0
  • down-sampled: mag of 0.5 equals level of 1
  • up-sampled: mag of 2.0 equals level of -1
Parameters
magthe magnification value to convert
Returns
the magnification expressed as a level

§ getMaxValue()

static double LTIUtils::getMaxValue ( LTIDataType  datatype)
static

§ getMinNumSamplesPerPixel()

static lt_uint8 LTIUtils::getMinNumSamplesPerPixel ( LTIColorSpace  colorspace)
static

This function returns the number of samples (bands) per pixel for the given colorspace, e.g. 3 for RGB. If the number of bands is not known for a given colorspace, 0 will be returned.

Parameters
colorspacethe colorspace to query
Returns
the number of bands

§ getMinValue()

static double LTIUtils::getMinValue ( LTIDataType  datatype)
static

§ getNumBytes()

static lt_uint8 LTIUtils::getNumBytes ( LTIDataType  datatype)
static

This function returns the number of bytes for a given datatype, e.g. 1 for LTI_DATATYPE_UINT8 or 4 for LTI_DATATYPE_FLOAT32.

Parameters
datatypethe datatype to query
Returns
the number of bytes
Examples:
DecodeJP2ToMemory.cpp, and DecodeMrSIDToMemory.cpp.

§ getNumLevelsForIcon()

static lt_uint8 LTIUtils::getNumLevelsForIcon ( lt_uint32  width,
lt_uint32  height,
lt_uint32  iconsize 
)
static
Parameters
widthinput image width
heightinput image height
iconsizedesired icon size
Returns
the number of levels

§ getVersionInfo()

static void LTIUtils::getVersionInfo ( lt_uint32 major,
lt_uint32 minor,
lt_uint32 revision,
lt_uint32 build,
const char *&  branch 
)
static

This function returns SDK version and build information. The major, minor, and revision numbers correspond to the public SDK version number. For this SDK series, major will be 4. The revision number is used to indicate the intermediate release point, e.g. "Technology Preview 8". The build number and branch name are for internal use by LizardTech.

Parameters
majorthe major version number
minorthe minor version number
revisionthe revision number
buildthe build number
branchthe branch name

§ getVersionString()

static const char* LTIUtils::getVersionString ( )
static

This function returns SDK version and build information as a formatted string. The string will be of the form "SDK Version MAJOR.MINOR.REVISION.BUILD.BRANCH", using the values returned from LTIUtils::getVersionInfo().

Returns
the version string

§ hasAlphaBand()

static bool LTIUtils::hasAlphaBand ( LTIColorSpace  colorspace)
static
Parameters
colorspacethe colorspace to query
Returns
true for colorspaces with alpha channel flags

§ isFloatingPoint()

static bool LTIUtils::isFloatingPoint ( LTIDataType  datatype)
static

§ isIntegral()

static bool LTIUtils::isIntegral ( LTIDataType  datatype)
static

This function returns true if and only if the datatype is integral, i.e. not floating point.

Parameters
datatypethe datatype to query
Returns
true, if an integer datatype

§ isOctave()

static bool LTIUtils::isOctave ( double  mag)
static

This function converts a "magnification" value to a "level" value.

Examples:

  • full resolution: mag of 1.0 equals level of 0
  • down-sampled: mag of 0.5 equals level of 1
  • up-sampled: mag of 2.0 equals level of -1
Parameters
magthe magnification value to convert
Returns
the magnification expressed as a level

§ isSigned()

static bool LTIUtils::isSigned ( LTIDataType  datatype)
static

This function returns true if and only if the datatype can represent signed values.

Parameters
datatypethe datatype to query
Returns
true, if signed

§ levelToMag()

static double LTIUtils::levelToMag ( lt_int32  level)
static

This function converts a "level" value to a "magnification" value.

See magToLevel() for examples.

Parameters
levelthe level value to convert
Returns
the level expressed as a magnification

§ magToLevel()

static lt_int32 LTIUtils::magToLevel ( double  mag)
static

This function converts a "magnification" value to a "level" value.

Examples:

  • full resolution: mag of 1.0 equals level of 0
  • down-sampled: mag of 0.5 equals level of 1
  • up-sampled: mag of 2.0 equals level of -1
Parameters
magthe magnification value to convert
Returns
the magnification expressed as a level
Examples:
ImageInfo.cpp.

§ needsSwapping()

static bool LTIUtils::needsSwapping ( LTIDataType  datatype,
LTIEndian  byteOrder 
)
static

§ snapToOctave() [1/2]

static double LTIUtils::snapToOctave ( double  mag,
double  threshold = 0.41503749927884381 
)
static

This function rounds a magnification to the nearest larger "octave"

Parameters
magthe current magnification
Returns
the magnification rounded to an octave

§ snapToOctave() [2/2]

static double LTIUtils::snapToOctave ( double  mag,
const LTIImageStage imageStage,
double  threshold = 0.41503749927884381 
)
static

This function rounds a magnification to the nearest larger "octave", with respect to a given image stage.

Parameters
magthe current magnification
imageStageused to provide min/max magnification bounds
Returns
the magnification rounded to an octave

The documentation for this class was generated from the following file:

LizardTech