utility functions
More...
#include <lti_utils.h>
|
| 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 LTIImage &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...
|
| |
| 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...
|
| |
| static LTIColorSpace | mergeAlpha (LTIColorSpace base, LTIColorSpace alpha) |
| | convert mag to level More...
|
| |
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 26 of file lti_utils.h.
◆ 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
-
| drmin | the dynamic range minimum value |
| drmax | the dynamic range maximum value |
| window | the window value |
| level | the 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
-
| window | the window value |
| level | the level value |
| drmin | the dynamic range minimum value |
| drmax | the dynamic range maximum value |
◆ getColorSpaceWithoutAlpha()
- Parameters
-
| colorspace | the colorspace to query |
- Returns
- colorspace with out the alpha band
◆ getDimsAtMag()
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
◆ getMagForIcon()
- Parameters
-
| width | input image width |
| height | input image height |
| iconsize | desired icon size |
- Returns
- the magnification
◆ getMaxMag()
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
◆ getMaxValue()
| static double LTIUtils::getMaxValue |
( |
LTIDataType |
datatype | ) |
|
|
static |
◆ getMinNumSamplesPerPixel()
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
◆ getMinValue()
| static double LTIUtils::getMinValue |
( |
LTIDataType |
datatype | ) |
|
|
static |
◆ getNumBytes()
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.
◆ getNumLevelsForIcon()
- Parameters
-
| width | input image width |
| height | input image height |
| iconsize | desired icon size |
- Returns
- the number of levels
◆ getVersionInfo()
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 |
◆ 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()
- Parameters
-
| colorspace | the 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
-
| datatype | the 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
-
| mag | the magnification value to convert |
- Returns
- the magnification expressed as a level
◆ isSigned()
This function returns true if and only if the datatype can represent signed values.
- Parameters
-
| datatype | the 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
-
| level | the 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
-
| mag | the magnification value to convert |
- Returns
- the magnification expressed as a level
- Examples
- ImageInfo.cpp.
◆ mergeAlpha()
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
◆ needsSwapping()
◆ snapToOctave() [1/2]
| static double LTIUtils::snapToOctave |
( |
double |
mag, |
|
|
const LTIImage & |
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
◆ snapToOctave() [2/2]
| 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: