LTIUtils Class Reference

utility functions More...

#include <lti_utils.h>

List of all members.

Static Public Member Functions

static lt_uint8 getMinNumSamplesPerPixel (LTIColorSpace colorspace)
 returns number of samples per pixel
static LTIColorSpace getColorSpaceWithoutAlpha (LTIColorSpace colorspace)
 returns the colorspace without alpha channel flag
static bool hasAlphaBand (LTIColorSpace colorspace)
 returns true with colorspace has alpha channel flags
static lt_uint8 getNumBytes (LTIDataType datatype)
 returns number of bytes for a given a datatype
static bool isSigned (LTIDataType datatype)
 returns true if datatype is signed
static bool isIntegral (LTIDataType datatype)
 returns true if datatype is integral
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
static const char * getVersionString ()
 get SDK version information as a string
Dynamic range conversion functions



static void convertWindowLevelToMinMax (double window, double level, double &drmin, double &drmax)
 convert from window/level to min/max
static void convertMinMaxToWindowLevel (double drmin, double drmax, double &window, double &level)
 convert from min/max to window/level
Mag/level conversion functions



static lt_int32 magToLevel (double mag)
 convert mag to level
static double levelToMag (lt_int32 level)
 convert level to mag
static double snapToOctave (double mag, double threshold=0.41503749927884381)
 snap to octave
static double snapToOctave (double mag, const LTIImageStage &imageStage, double threshold=0.41503749927884381)
 snap to octave
static bool isOctave (double mag)
 convert mag to 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
static LT_STATUS getDimsAtMag (lt_uint32 width, lt_uint32 height, double mag, lt_uint32 &scaledWidth, lt_uint32 &scaledHeight)
 get dimensions at an octave

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

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:
drmin the dynamic range minimum value
drmax the dynamic range maximum value
window the window value
level the level value
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:
window the window value
level the level value
drmin the dynamic range minimum value
drmax the dynamic range maximum value
static LTIColorSpace LTIUtils::getColorSpaceWithoutAlpha ( LTIColorSpace  colorspace  )  [static]
Parameters:
colorspace the colorspace to query
Returns:
colorspace with out the alpha band
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:
width input width to be scaled
height input height to be scaled
mag the magnification to scale to
scaledWidth output width after scaling
scaledHeight output height after scaling
Returns:
success or failule
static double LTIUtils::getMaxValue ( LTIDataType  datatype  )  [static]
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:
colorspace the colorspace to query
Returns:
the number of bands
static double LTIUtils::getMinValue ( LTIDataType  datatype  )  [static]
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:
datatype the datatype to query
Returns:
the number of bytes
Examples:
DecodeJP2ToMemory.cpp, and DecodeMrSIDToMemory.cpp.
static lt_uint8 LTIUtils::getNumLevelsForIcon ( lt_uint32  width,
lt_uint32  height,
lt_uint32  iconsize 
) [static]
Parameters:
width input image width
height input image height
iconsize desired icon size
Returns:
the number of levels
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:
major the major version number
minor the minor version number
revision the revision number
build the build number
branch the branch name
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
static bool LTIUtils::hasAlphaBand ( LTIColorSpace  colorspace  )  [static]
Parameters:
colorspace the colorspace to query
Returns:
true for colorspaces with alpha channel flags
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:
datatype the datatype to query
Returns:
true, if an integer datatype
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:
mag the magnification value to convert
Returns:
the magnification expressed as a level
static bool LTIUtils::isSigned ( LTIDataType  datatype  )  [static]

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

Parameters:
datatype the datatype to query
Returns:
true, if signed
static double LTIUtils::levelToMag ( lt_int32  level  )  [static]

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

See magToLevel() for examples.

Parameters:
level the level value to convert
Returns:
the level expressed as a magnification
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:
mag the magnification value to convert
Returns:
the magnification expressed as a level
Examples:
ImageInfo.cpp.
static bool LTIUtils::needsSwapping ( LTIDataType  datatype,
LTIEndian  byteOrder 
) [static]
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:
mag the current magnification
imageStage used to provide min/max magnification bounds
Returns:
the magnification rounded to an octave
static double LTIUtils::snapToOctave ( double  mag,
double  threshold = 0.41503749927884381 
) [static]

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

Parameters:
mag the current magnification
Returns:
the magnification rounded to an octave

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

LizardTech