MCPcopy Create free account
hub / github.com/MITK/MITK / SetWindowBounds

Method SetWindowBounds

Modules/Core/src/DataManagement/mitkLevelWindow.cpp:131–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void mitk::LevelWindow::SetWindowBounds(mitk::ScalarType lowerBound,
132 mitk::ScalarType upperBound,
133 bool expandRangesIfNecessary)
134{
135 if (IsFixed())
136 return;
137
138 upperBound = std::clamp(upperBound, -1e300, 1e300);
139 lowerBound = std::clamp(lowerBound, -1e300, 1e300);
140
141 m_LowerWindowBound = lowerBound;
142 m_UpperWindowBound = upperBound;
143
144 if (expandRangesIfNecessary)
145 {
146 /* if caller is sure he wants exactly that level/window, we make sure the limits match */
147 if (m_LowerWindowBound > m_UpperWindowBound)
148 std::swap(m_LowerWindowBound, m_UpperWindowBound);
149 if (m_LowerWindowBound < m_RangeMin)
150 {
151 m_RangeMin = m_LowerWindowBound;
152 }
153
154 if (m_UpperWindowBound > m_RangeMax)
155 {
156 m_RangeMax = m_UpperWindowBound;
157 }
158 }
159
160 EnsureConsistency();
161}
162
163void mitk::LevelWindow::SetRangeMinMax(mitk::ScalarType min, mitk::ScalarType max)
164{

Callers 4

SetDefaultPropertiesMethod · 0.80
mitkLevelWindowTestFunction · 0.80
SetDefaultPropertiesMethod · 0.80

Calls 1

swapFunction · 0.50

Tested by 1

mitkLevelWindowTestFunction · 0.64