|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
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) | |
| Construct a LevelWindow with given level (center) and window (range) values. More... | |
| LevelWindow (const mitk::LevelWindow &levWin) | |
| Copy constructor. More... | |
| virtual | ~LevelWindow () |
| Virtual destructor. More... | |
| ScalarType | GetLevel () const |
| Get the level value, i.e. the center of the current grey value interval. More... | |
| ScalarType | GetWindow () const |
| Get the current window size, i.e. the width of the current grey value interval. More... | |
| ScalarType | GetDefaultLevel () const |
| Get the default level value for the image. More... | |
| ScalarType | GetDefaultWindow () const |
| Get the default window size for the image. More... | |
| void | ResetDefaultLevelWindow () |
| Reset the level and window to their default values. More... | |
| ScalarType | GetLowerWindowBound () const |
| Get the lower bound of the current window. More... | |
| ScalarType | GetUpperWindowBound () const |
| Get the upper bound of the current window. More... | |
| void | SetLevelWindow (ScalarType level, ScalarType window, bool expandRangesIfNecessary=true) |
| Set the level and window values. More... | |
| void | SetWindowBounds (ScalarType lowerBound, ScalarType upperBound, bool expandRangesIfNecessary=true) |
| Set the lower and upper window bounds directly. More... | |
| void | SetToMaxWindowSize () |
| Set the window to cover the entire valid range. More... | |
| void | SetRangeMinMax (ScalarType min, ScalarType max) |
| Set the minimum and maximum of the valid value range. More... | |
| ScalarType | GetRangeMin () const |
| Get the minimum of the valid value range. More... | |
| ScalarType | GetRangeMax () const |
| Get the maximum of the valid value range. More... | |
| ScalarType | GetDefaultLowerBound () const |
| Get the default lower bound (default range minimum). More... | |
| ScalarType | GetDefaultUpperBound () const |
| Get the default upper bound (default range maximum). More... | |
| void | ResetDefaultRangeMinMax () |
| Reset the range min/max to the default boundaries. More... | |
| ScalarType | GetRange () const |
| Get the total size of the grey value range (max - min). More... | |
| void | SetDefaultLevelWindow (ScalarType level, ScalarType window) |
| Set the default level and window values. More... | |
| void | SetDefaultBoundaries (ScalarType low, ScalarType up) |
| Set the default lower and upper boundaries. More... | |
| void | SetAuto (const Image *image, bool tryPicTags=true, bool guessByCentralSlice=true, unsigned selectedComponent=0) |
| Automatically set level/window to optimize image contrast. More... | |
| void | SetToImageRange (const Image *image) |
| Set level/window to the full min/max grey value range of the given image. More... | |
| void | SetFixed (bool fixed) |
| Lock or unlock the level window settings. More... | |
| bool | GetFixed () const |
| Return whether the level window settings are fixed. More... | |
| bool | IsFixed () const |
| Return whether the level window settings are fixed. More... | |
| virtual bool | operator== (const LevelWindow &levWin) const |
| Compare two LevelWindow objects for equality. More... | |
| virtual bool | operator!= (const LevelWindow &levWin) const |
| Compare two LevelWindow objects for inequality. More... | |
| virtual LevelWindow & | operator= (const LevelWindow &levWin) |
| Assignment operator. More... | |
| bool | IsFloatingValues () const |
| Check whether the image uses floating-point values. More... | |
| void | SetFloatingValues (bool value) |
| Set whether the image uses floating-point values. More... | |
Protected Member Functions | |
| void | EnsureConsistency () |
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.
Definition at line 43 of file mitkLevelWindow.h.
| mitk::LevelWindow::LevelWindow | ( | ScalarType | level = 127.5, |
| ScalarType | window = 255.0 |
||
| ) |
Construct a LevelWindow with given level (center) and window (range) values.
| [in] | level | The center of the grey value interval (default: 127.5). |
| [in] | window | The width of the grey value interval (default: 255.0). |
| mitk::LevelWindow::LevelWindow | ( | const mitk::LevelWindow & | levWin | ) |
Copy constructor.
| [in] | levWin | The LevelWindow to copy. |
|
virtual |
Virtual destructor.
|
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.
| ScalarType mitk::LevelWindow::GetDefaultLevel | ( | ) | const |
Get the default level value for the image.
| ScalarType mitk::LevelWindow::GetDefaultLowerBound | ( | ) | const |
Get the default lower bound (default range minimum).
| ScalarType mitk::LevelWindow::GetDefaultUpperBound | ( | ) | const |
Get the default upper bound (default range maximum).
| ScalarType mitk::LevelWindow::GetDefaultWindow | ( | ) | const |
Get the default window size for the image.
| bool mitk::LevelWindow::GetFixed | ( | ) | const |
Return whether the level window settings are fixed.
| ScalarType mitk::LevelWindow::GetLevel | ( | ) | const |
Get the level value, i.e. the center of the current grey value interval.
| ScalarType mitk::LevelWindow::GetLowerWindowBound | ( | ) | const |
Get the lower bound of the current window.
| ScalarType mitk::LevelWindow::GetRange | ( | ) | const |
Get the total size of the grey value range (max - min).
| ScalarType mitk::LevelWindow::GetRangeMax | ( | ) | const |
Get the maximum of the valid value range.
| ScalarType mitk::LevelWindow::GetRangeMin | ( | ) | const |
Get the minimum of the valid value range.
| ScalarType mitk::LevelWindow::GetUpperWindowBound | ( | ) | const |
Get the upper bound of the current window.
| ScalarType mitk::LevelWindow::GetWindow | ( | ) | const |
Get the current window size, i.e. the width of the current grey value interval.
| bool mitk::LevelWindow::IsFixed | ( | ) | const |
Return whether the level window settings are fixed.
| bool mitk::LevelWindow::IsFloatingValues | ( | ) | const |
Check whether the image uses floating-point values.
|
virtual |
Compare two LevelWindow objects for inequality.
| [in] | levWin | The LevelWindow to compare with. |
|
virtual |
Assignment operator.
| [in] | levWin | The LevelWindow to copy from. |
|
virtual |
Compare two LevelWindow objects for equality.
| [in] | levWin | The LevelWindow to compare with. |
| void mitk::LevelWindow::ResetDefaultLevelWindow | ( | ) |
Reset the level and window to their default values.
| void mitk::LevelWindow::ResetDefaultRangeMinMax | ( | ) |
Reset the range min/max to the default boundaries.
| void mitk::LevelWindow::SetAuto | ( | const Image * | image, |
| bool | tryPicTags = true, |
||
| bool | guessByCentralSlice = true, |
||
| unsigned | selectedComponent = 0 |
||
| ) |
Automatically set level/window to optimize image contrast.
Analyzes the image statistics (optionally from the central slice) to determine appropriate level/window settings that maximize contrast. Handles special cases like binary images, uniform images, and images with outlier values.
| [in] | image | The image to analyze. |
| [in] | tryPicTags | Currently unused, reserved for backward compatibility. |
| [in] | guessByCentralSlice | If true, analyze only the central slice first for performance. |
| [in] | selectedComponent | The image component to analyze (for multi-component images). |
| void mitk::LevelWindow::SetDefaultBoundaries | ( | ScalarType | low, |
| ScalarType | up | ||
| ) |
Set the default lower and upper boundaries.
| [in] | low | The default lower bound. |
| [in] | up | The default upper bound. |
| void mitk::LevelWindow::SetDefaultLevelWindow | ( | ScalarType | level, |
| ScalarType | window | ||
| ) |
Set the default level and window values.
| [in] | level | The default level (center) value. |
| [in] | window | The default window (range) size. |
| void mitk::LevelWindow::SetFixed | ( | bool | fixed | ) |
Lock or unlock the level window settings.
When fixed, all Set methods will be no-ops.
| [in] | fixed | True to lock settings, false to allow modifications. |
| void mitk::LevelWindow::SetFloatingValues | ( | bool | value | ) |
Set whether the image uses floating-point values.
| [in] | value | True for floating-point images, false otherwise. |
| void mitk::LevelWindow::SetLevelWindow | ( | ScalarType | level, |
| ScalarType | window, | ||
| bool | expandRangesIfNecessary = true |
||
| ) |
Set the level and window values.
| [in] | level | The center of the grey value interval. |
| [in] | window | The width of the grey value interval. |
| [in] | expandRangesIfNecessary | If true, the range is expanded to fit the new window. |
| void mitk::LevelWindow::SetRangeMinMax | ( | ScalarType | min, |
| ScalarType | max | ||
| ) |
Set the minimum and maximum of the valid value range.
| [in] | min | The range minimum. |
| [in] | max | The range maximum. |
| void mitk::LevelWindow::SetToImageRange | ( | const Image * | image | ) |
Set level/window to the full min/max grey value range of the given image.
| [in] | image | The image whose value range determines the level/window. |
| void mitk::LevelWindow::SetToMaxWindowSize | ( | ) |
Set the window to cover the entire valid range.
| void mitk::LevelWindow::SetWindowBounds | ( | ScalarType | lowerBound, |
| ScalarType | upperBound, | ||
| bool | expandRangesIfNecessary = true |
||
| ) |
Set the lower and upper window bounds directly.
Values are clamped to the range [-10^300, 10^300].
| [in] | lowerBound | The lower window bound. |
| [in] | upperBound | The upper window bound. |
| [in] | expandRangesIfNecessary | If true, the range is expanded to fit the new bounds. |
|
protected |
default minimum gray value of the window
Definition at line 287 of file mitkLevelWindow.h.
|
protected |
default maximum gray value of the window
Definition at line 292 of file mitkLevelWindow.h.
|
protected |
Defines whether the level window settings may be changed after initialization or not.
Definition at line 303 of file mitkLevelWindow.h.
|
protected |
Image with floating values
Definition at line 297 of file mitkLevelWindow.h.
|
protected |
lower bound of current window
Definition at line 267 of file mitkLevelWindow.h.
|
protected |
maximum gray value of the window
Definition at line 282 of file mitkLevelWindow.h.
|
protected |
minimum gray value of the window
Definition at line 277 of file mitkLevelWindow.h.
|
protected |
upper bound of current window
Definition at line 272 of file mitkLevelWindow.h.