Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkLevelWindow.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef mitkLevelWindow_h
13 #define mitkLevelWindow_h
14 
15 #include "mitkNumericTypes.h"
16 #include <MitkCoreExports.h>
17 #include <nlohmann/json_fwd.hpp>
18 
19 namespace mitk
20 {
21  class Image;
22 
46  {
47  public:
48  LevelWindow(ScalarType level = 127.5, ScalarType window = 255.0);
50  virtual ~LevelWindow();
51 
57 
62 
67 
72 
77 
82 
87 
91  void SetLevelWindow(ScalarType level, ScalarType window, bool expandRangesIfNecessary = true);
92 
96  void SetWindowBounds(ScalarType lowerBound, ScalarType upperBound, bool expandRangesIfNecessary = true);
97 
102 
107 
112 
117 
122 
127 
132 
137 
142 
147 
151  void SetAuto(const Image *image,
152  bool tryPicTags = true,
153  bool guessByCentralSlice = true,
154  unsigned selectedComponent = 0);
155 
159  void SetToImageRange(const Image *image);
160 
166  void SetFixed(bool fixed);
167 
171  bool GetFixed() const;
172 
176  bool IsFixed() const;
177 
181  virtual bool operator==(const LevelWindow &levWin) const;
182 
186  virtual bool operator!=(const LevelWindow &levWin) const;
187 
192  virtual LevelWindow &operator=(const LevelWindow &levWin);
193 
197  bool IsFloatingValues() const;
198 
202  void SetFloatingValues(bool value);
203 
204  protected:
209 
214 
219 
224 
229 
234 
239 
244  bool m_Fixed;
245 
261  inline void EnsureConsistency();
262  };
263 
266 
267 } // namespace mitk
268 #endif
#define MITKCORE_EXPORT
Image class for storing images.
Definition: mitkImage.h:70
The LevelWindow class Class to store level/window values.
ScalarType GetRangeMax() const
void SetToImageRange(const Image *image)
sets level/window to the min/max greyvalues of the given Image
bool IsFixed() const
ScalarType GetRange() const
returns the size of the grey value range
void ResetDefaultLevelWindow()
Resets the level and the window value to the default values.
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
LevelWindow(ScalarType level=127.5, ScalarType window=255.0)
LevelWindow(const mitk::LevelWindow &levWin)
bool IsFloatingValues() const
Shows if floating values are accepted.
ScalarType GetRangeMin() const
void SetFloatingValues(bool value)
Sets the floating image value.
bool GetFixed() const
void SetDefaultLevelWindow(ScalarType level, ScalarType window)
void SetFixed(bool fixed)
ScalarType GetDefaultUpperBound() const
ScalarType GetDefaultWindow() const
returns the default window size for the image
ScalarType m_DefaultLowerBound
ScalarType m_DefaultUpperBound
ScalarType GetDefaultLevel() const
method returns the default level value for the image
ScalarType GetLowerWindowBound() const
ScalarType GetDefaultLowerBound() const
virtual ~LevelWindow()
void SetDefaultBoundaries(ScalarType low, ScalarType up)
virtual bool operator!=(const LevelWindow &levWin) const
non equality operator implementation that allows to compare two level windows
void SetLevelWindow(ScalarType level, ScalarType window, bool expandRangesIfNecessary=true)
ScalarType GetUpperWindowBound() const
ScalarType GetLevel() const
method that returns the level value, i.e. the center of the current grey value interval
void ResetDefaultRangeMinMax()
the default min and max range for image will be reset
void SetWindowBounds(ScalarType lowerBound, ScalarType upperBound, bool expandRangesIfNecessary=true)
ScalarType GetWindow() const
returns the current window size, i.e the range size of the current grey value interval
void SetRangeMinMax(ScalarType min, ScalarType max)
void SetToMaxWindowSize()
void EnsureConsistency()
virtual bool operator==(const LevelWindow &levWin) const
equality operator implementation that allows to compare two level windows
ScalarType m_UpperWindowBound
virtual LevelWindow & operator=(const LevelWindow &levWin)
implementation necessary because operator made private in itk::Object
ScalarType m_LowerWindowBound
nlohmann::json json
class ITK_EXPORT Image
Find image slices visible on a given plane.
void to_json(nlohmann::json &j, const GenericLookupTable< T > &t)
double ScalarType
void from_json(const nlohmann::json &, GenericLookupTable< T > &)