ImFusion SDK 4.3
ImFusion::GlUtils Namespace Reference

Utility functions for working with OpenGL and/or GlImages. More...

Detailed Description

Utility functions for working with OpenGL and/or GlImages.

Functions

std::pair< double, double > shiftScaleStorageToNormalized (const ImageDescriptor &desc)
 Returns the storage vs.
 
std::pair< double, double > shiftScaleOrignalToNormalized (const ImageDescriptor &desc)
 Returns the original vs.
 
double storageToNormalized (const ImageDescriptor &desc, double intensity)
 Transforms the given image intensity as stored on the CPU to the normalized intensity range as it is retrieved in GLSL shaders.
 
double storageToNormalized (const Image *image, double intensity)
 
double normalizedToStorage (const ImageDescriptor &desc, double intensity)
 Transforms the given image intensity from the normalized intensity range as it is retrieved in GLSL shaders to its actual value as stored on the CPU side.
 
double normalizedToStorage (const Image *image, double intensity)
 
vec2 windowLevelOriginalToNormalized (const ImageDescriptor &desc, double window, double level)
 Transforms window/level from original value domain to normalized value domain.
 
vec2 windowLevelOriginalToNormalized (const Image *image, double window, double level)
 
vec2 windowLevelNormalizedToOriginal (const ImageDescriptor &desc, double window, double level)
 Transforms window/level from normalized value domain to original value domain.
 
vec2 windowLevelNormalizedToOriginal (const Image *image, double window, double level)
 
bool checkOpenGlStateDefaults ()
 Checks that the current OpenGL state is according to the defined default values.
 
void resetOpenGlStateDefaults ()
 Resets the OpenGL state to the following results:
 

Function Documentation

◆ shiftScaleStorageToNormalized()

std::pair< double, double > shiftScaleStorageToNormalized ( const ImageDescriptor & desc)

Returns the storage vs.

normalized (in GL) constants {normShift, normScale} such that

storage = (normalized * normScale) + normShift
normalized = (storage - normShift) / normScale;
See also
PixelValueDomains

◆ shiftScaleOrignalToNormalized()

std::pair< double, double > shiftScaleOrignalToNormalized ( const ImageDescriptor & desc)

Returns the original vs.

normalized (in GL) constants {totalShift, totalScale} such that

original = (normalized * totalScale) + totalShift
normalized = (original - totalShift) / totalScale
See also
PixelValueDomains

◆ storageToNormalized()

double storageToNormalized ( const ImageDescriptor & desc,
double intensity )

Transforms the given image intensity as stored on the CPU to the normalized intensity range as it is retrieved in GLSL shaders.

Integral image types (both signed and unsigned) are mapped to [0, 1] range. Float image types keep their domain.

See also
PixelValueDomains

◆ normalizedToStorage()

double normalizedToStorage ( const ImageDescriptor & desc,
double intensity )

Transforms the given image intensity from the normalized intensity range as it is retrieved in GLSL shaders to its actual value as stored on the CPU side.

Integral image types (both signed and unsigned) are mapped from [0, 1] range. Float image types keep their domain.

See also
PixelValueDomains

◆ windowLevelOriginalToNormalized()

vec2 windowLevelOriginalToNormalized ( const ImageDescriptor & desc,
double window,
double level )

Transforms window/level from original value domain to normalized value domain.

The return value encodes (window, level) as vec2.

See also
PixelValueDomains

◆ windowLevelNormalizedToOriginal()

vec2 windowLevelNormalizedToOriginal ( const ImageDescriptor & desc,
double window,
double level )

Transforms window/level from normalized value domain to original value domain.

The return value encodes (window, level) as vec2.

See also
PixelValueDomains

◆ checkOpenGlStateDefaults()

bool checkOpenGlStateDefaults ( )

Checks that the current OpenGL state is according to the defined default values.

All algorithms/renderers should reset the state to these settings when finished:

  • GL_DEPTH_DEST: disabled
  • glDepthFunc: GL_LESS
  • glClearDepth: 1.0
  • GL_BLEND: disabled
  • glBlendFunc: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
  • GL_SCISSOR_TEST: disabled

◆ resetOpenGlStateDefaults()

void resetOpenGlStateDefaults ( )

Resets the OpenGL state to the following results:

  • GL_DEPTH_DEST: disabled
  • glDepthFunc: GL_LESS
  • glClearDepth: 1.0
  • GL_BLEND: disabled
  • glBlendFunc: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
  • GL_SCISSOR_TEST: disabled
Search Tab / S to search, Esc to close