Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitk::LevelWindow Class Reference

The LevelWindow class Class to store level/window values. More...

#include <mitkLevelWindow.h>

Public Member Functions

 LevelWindow (ScalarType level=127.5, ScalarType window=255.0)
 
 LevelWindow (const mitk::LevelWindow &levWin)
 
virtual ~LevelWindow ()
 
ScalarType GetLevel () const
 method that returns the level value, i.e. the center of the current grey value interval More...
 
ScalarType GetWindow () const
 returns the current window size, i.e the range size of the current grey value interval More...
 
ScalarType GetDefaultLevel () const
 method returns the default level value for the image More...
 
ScalarType GetDefaultWindow () const
 returns the default window size for the image More...
 
void ResetDefaultLevelWindow ()
 Resets the level and the window value to the default values. More...
 
ScalarType GetLowerWindowBound () const
 
ScalarType GetUpperWindowBound () const
 
void SetLevelWindow (ScalarType level, ScalarType window, bool expandRangesIfNecessary=true)
 
void SetWindowBounds (ScalarType lowerBound, ScalarType upperBound, bool expandRangesIfNecessary=true)
 
void SetToMaxWindowSize ()
 
void SetRangeMinMax (ScalarType min, ScalarType max)
 
ScalarType GetRangeMin () const
 
ScalarType GetRangeMax () const
 
ScalarType GetDefaultLowerBound () const
 
ScalarType GetDefaultUpperBound () const
 
void ResetDefaultRangeMinMax ()
 the default min and max range for image will be reset More...
 
ScalarType GetRange () const
 returns the size of the grey value range More...
 
void SetDefaultLevelWindow (ScalarType level, ScalarType window)
 
void SetDefaultBoundaries (ScalarType low, ScalarType up)
 
void SetAuto (const Image *image, bool tryPicTags=true, bool guessByCentralSlice=true, unsigned selectedComponent=0)
 sets level/window to optimize the contrast of the given Image More...
 
void SetToImageRange (const Image *image)
 sets level/window to the min/max greyvalues of the given Image More...
 
void SetFixed (bool fixed)
 
bool GetFixed () const
 
bool IsFixed () const
 
virtual bool operator== (const LevelWindow &levWin) const
 equality operator implementation that allows to compare two level windows More...
 
virtual bool operator!= (const LevelWindow &levWin) const
 non equality operator implementation that allows to compare two level windows More...
 
virtual LevelWindowoperator= (const LevelWindow &levWin)
 implementation necessary because operator made private in itk::Object More...
 
bool IsFloatingValues () const
 Shows if floating values are accepted. More...
 
void SetFloatingValues (bool value)
 Sets the floating image value. More...
 

Protected Member Functions

void EnsureConsistency ()
 

Protected Attributes

ScalarType m_LowerWindowBound
 
ScalarType m_UpperWindowBound
 
ScalarType m_RangeMin
 
ScalarType m_RangeMax
 
ScalarType m_DefaultLowerBound
 
ScalarType m_DefaultUpperBound
 
bool m_IsFloatingImage
 
bool m_Fixed
 

Detailed Description

The LevelWindow class Class to store level/window values.

Current min and max value are stored in m_LowerWindowBound and m_UpperWindowBound. m_DefaultLevel amd m_DefaultWindow store the initial Level/Window values for the image. m_DefaultRangeMin and m_DefaultRangeMax store the initial minrange and maxrange for the image.

The finite maximum and minimum of valid value range is stored in m_RangeMin and m_RangeMax. If deduced from an image by default the minimum or maximum of it statistics is used. If one of these values are infinite the 2nd extrimum (which is guaranteed to be finite), will be used.

See documentation of SetAuto for information on how the level window is initialized from an image.

Note
If you want to apply the mitk::LevelWindow to an mitk::Image, make sure to use the mitk::LevelWindowProperty and set the mitk::RenderingModeProperty to a mode which supports level window (e.g. LEVELWINDOW_COLOR). Make sure to check the documentation of the mitk::RenderingModeProperty. For a code example how to use the mitk::LevelWindowProperty check the mitkImageVtkMapper2DLevelWindowTest.cpp in Core/Code/Testing.

Definition at line 45 of file mitkLevelWindow.h.

Constructor & Destructor Documentation

◆ LevelWindow() [1/2]

mitk::LevelWindow::LevelWindow ( ScalarType  level = 127.5,
ScalarType  window = 255.0 
)

◆ LevelWindow() [2/2]

mitk::LevelWindow::LevelWindow ( const mitk::LevelWindow levWin)

◆ ~LevelWindow()

virtual mitk::LevelWindow::~LevelWindow ( )
virtual

Member Function Documentation

◆ EnsureConsistency()

void mitk::LevelWindow::EnsureConsistency ( )
inlineprotected

confidence tests

if m_LowerWindowBound > m_UpperWindowBound, then the values for m_LowerWindowBound and m_UpperWindowBound will be exchanged

if m_LowerWindowBound < m_RangeMin, m_LowerWindowBound will be set to m_RangeMin. m_UpperWindowBound will be decreased the same as m_LowerWindowBound will be increased, but minimum value for m_UpperWindowBound is also m_RangeMin.

if m_UpperWindowBound > m_RangeMax, m_UpperWindowBound will be set to m_RangeMax. m_LowerWindowBound will be increased the same as m_UpperWindowBound will be decreased, but maximum value for m_LowerWindowBound is also m_RangeMax.

◆ GetDefaultLevel()

ScalarType mitk::LevelWindow::GetDefaultLevel ( ) const

method returns the default level value for the image

◆ GetDefaultLowerBound()

ScalarType mitk::LevelWindow::GetDefaultLowerBound ( ) const

Get the default range minimum value

◆ GetDefaultUpperBound()

ScalarType mitk::LevelWindow::GetDefaultUpperBound ( ) const

Get the default range maximum value

◆ GetDefaultWindow()

ScalarType mitk::LevelWindow::GetDefaultWindow ( ) const

returns the default window size for the image

◆ GetFixed()

bool mitk::LevelWindow::GetFixed ( ) const

Returns whether the level window settings are fixed (

See also
SetFixed(bool)) or not

◆ GetLevel()

ScalarType mitk::LevelWindow::GetLevel ( ) const

method that returns the level value, i.e. the center of the current grey value interval

◆ GetLowerWindowBound()

ScalarType mitk::LevelWindow::GetLowerWindowBound ( ) const

Returns the minimum Value of the window

◆ GetRange()

ScalarType mitk::LevelWindow::GetRange ( ) const

returns the size of the grey value range

!

◆ GetRangeMax()

ScalarType mitk::LevelWindow::GetRangeMax ( ) const

Get the range maximum value

◆ GetRangeMin()

ScalarType mitk::LevelWindow::GetRangeMin ( ) const

Get the range minimum value

◆ GetUpperWindowBound()

ScalarType mitk::LevelWindow::GetUpperWindowBound ( ) const

Returns the upper window bound value of the window

◆ GetWindow()

ScalarType mitk::LevelWindow::GetWindow ( ) const

returns the current window size, i.e the range size of the current grey value interval

◆ IsFixed()

bool mitk::LevelWindow::IsFixed ( ) const

Returns whether the level window settings are fixed (

See also
SetFixed(bool)) or not

◆ IsFloatingValues()

bool mitk::LevelWindow::IsFloatingValues ( ) const

Shows if floating values are accepted.

◆ operator!=()

virtual bool mitk::LevelWindow::operator!= ( const LevelWindow levWin) const
virtual

non equality operator implementation that allows to compare two level windows

◆ operator=()

virtual LevelWindow& mitk::LevelWindow::operator= ( const LevelWindow levWin)
virtual

implementation necessary because operator made private in itk::Object

◆ operator==()

virtual bool mitk::LevelWindow::operator== ( const LevelWindow levWin) const
virtual

equality operator implementation that allows to compare two level windows

◆ ResetDefaultLevelWindow()

void mitk::LevelWindow::ResetDefaultLevelWindow ( )

Resets the level and the window value to the default values.

◆ ResetDefaultRangeMinMax()

void mitk::LevelWindow::ResetDefaultRangeMinMax ( )

the default min and max range for image will be reset

◆ SetAuto()

void mitk::LevelWindow::SetAuto ( const Image image,
bool  tryPicTags = true,
bool  guessByCentralSlice = true,
unsigned  selectedComponent = 0 
)

sets level/window to optimize the contrast of the given Image

!

◆ SetDefaultBoundaries()

void mitk::LevelWindow::SetDefaultBoundaries ( ScalarType  low,
ScalarType  up 
)

set the default Boundaries

◆ SetDefaultLevelWindow()

void mitk::LevelWindow::SetDefaultLevelWindow ( ScalarType  level,
ScalarType  window 
)

set the default level and window value

◆ SetFixed()

void mitk::LevelWindow::SetFixed ( bool  fixed)

If a level window is set to fixed, the set and get methods won't accept modifications to the level window settings anymore. This behaviour can be turned of by setting fixed to false;

◆ SetFloatingValues()

void mitk::LevelWindow::SetFloatingValues ( bool  value)

Sets the floating image value.

◆ SetLevelWindow()

void mitk::LevelWindow::SetLevelWindow ( ScalarType  level,
ScalarType  window,
bool  expandRangesIfNecessary = true 
)

To set the level and the window value

◆ SetRangeMinMax()

void mitk::LevelWindow::SetRangeMinMax ( ScalarType  min,
ScalarType  max 
)

Set the range minimum and maximum value

◆ SetToImageRange()

void mitk::LevelWindow::SetToImageRange ( const Image image)

sets level/window to the min/max greyvalues of the given Image

!

◆ SetToMaxWindowSize()

void mitk::LevelWindow::SetToMaxWindowSize ( )

sets the window to its maximum Size in scaleRange

◆ SetWindowBounds()

void mitk::LevelWindow::SetWindowBounds ( ScalarType  lowerBound,
ScalarType  upperBound,
bool  expandRangesIfNecessary = true 
)

Set the lower and upper bound of the window, restricted to the range from -10^300 to 10^300. Higher/lower values are clamped to these boundaries.

Member Data Documentation

◆ m_DefaultLowerBound

ScalarType mitk::LevelWindow::m_DefaultLowerBound
protected

default minimum gray value of the window

Definition at line 228 of file mitkLevelWindow.h.

◆ m_DefaultUpperBound

ScalarType mitk::LevelWindow::m_DefaultUpperBound
protected

default maximum gray value of the window

Definition at line 233 of file mitkLevelWindow.h.

◆ m_Fixed

bool mitk::LevelWindow::m_Fixed
protected

Defines whether the level window settings may be changed after initialization or not.

Definition at line 244 of file mitkLevelWindow.h.

◆ m_IsFloatingImage

bool mitk::LevelWindow::m_IsFloatingImage
protected

Image with floating values

Definition at line 238 of file mitkLevelWindow.h.

◆ m_LowerWindowBound

ScalarType mitk::LevelWindow::m_LowerWindowBound
protected

lower bound of current window

Definition at line 208 of file mitkLevelWindow.h.

◆ m_RangeMax

ScalarType mitk::LevelWindow::m_RangeMax
protected

maximum gray value of the window

Definition at line 223 of file mitkLevelWindow.h.

◆ m_RangeMin

ScalarType mitk::LevelWindow::m_RangeMin
protected

minimum gray value of the window

Definition at line 218 of file mitkLevelWindow.h.

◆ m_UpperWindowBound

ScalarType mitk::LevelWindow::m_UpperWindowBound
protected

upper bound of current window

Definition at line 213 of file mitkLevelWindow.h.


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