127 SetWindowBounds((level - (window / 2.0)), (level + (window / 2.0)), expandRangesIfNecessary);
132 bool expandRangesIfNecessary)
140 if (expandRangesIfNecessary)
258 bool guessByCentralSlice,
259 unsigned selectedComponent)
283 if (guessByCentralSlice)
285 sliceSelector->SetInput(image);
288 sliceSelector->SetChannelNr(image->
GetDimension(4) / 2);
289 sliceSelector->Update();
290 image = sliceSelector->GetOutput();
298 if (minValue == maxValue)
315 for (
unsigned int i = 1; i < image->
GetDimension(3); ++i)
318 if (minValue > minValueTemp)
319 minValue = minValueTemp;
321 if (maxValue < maxValueTemp)
322 maxValue = maxValueTemp;
324 if (min2ndValue > min2ndValueTemp)
325 min2ndValue = min2ndValueTemp;
327 if (max2ndValue > max2ndValueTemp)
328 max2ndValue = max2ndValueTemp;
337 if (minValue == -(pow((
double)2.0, static_cast<int>(image->
GetPixelType().
GetBpe() / 2))))
339 minValue = min2ndValue;
345 if (minValue == maxValue)
347 minValue = maxValue - 1;
355 double additionalRange = 0.15 * (maxValue - minValue);
356 minValue -= additionalRange;
357 maxValue += additionalRange;
360 if (!std::isfinite(minValue))
364 if (!std::isfinite(maxValue))
381 if (min2ndValue == maxValue)
387 else if (min2ndValue == max2ndValue)
390 minValue = min2ndValue - minDelta;
391 maxValue = min2ndValue + minDelta;
397 ScalarType innerRange = max2ndValue - min2ndValue;
399 if (minCountFraction > 0.2)
401 ScalarType halfInnerRangeGapMinValue = min2ndValue - innerRange / 2.0;
402 minValue =
std::max(minValue, halfInnerRangeGapMinValue);
406 minValue = min2ndValue;
409 if (maxCountFraction > 0.2)
411 ScalarType halfInnerRangeGapMaxValue = max2ndValue + innerRange / 2.0;
412 maxValue =
std::min(maxValue, halfInnerRangeGapMaxValue);
416 maxValue = max2ndValue;
432 if (!std::isfinite(minValue))
437 if (!std::isfinite(maxValue))
486 return !((*this) == levWin);
void SetWindowBounds(ScalarType lowerBound, ScalarType upperBound, bool expandRangesIfNecessary=true)
ScalarType m_DefaultLowerBound
virtual bool operator!=(const LevelWindow &levWin) const
non equality operator implementation that allows to compare two level windows
LevelWindow(ScalarType level=127.5, ScalarType window=255.0)
ScalarType GetLevel() const
method that returns the level value, i.e. the center of the current grey value interval ...
void ResetDefaultLevelWindow()
Resets the level and the window value to the default values.
void SetFixed(bool fixed)
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
ScalarType m_DefaultUpperBound
void SetToImageRange(const Image *image)
sets level/window to the min/max greyvalues of the given Image
unsigned int * GetDimensions() const
Get the sizes of all dimensions as an integer-array.
virtual mitk::ScalarType GetScalarValue2ndMaxNoRecompute(unsigned int t=0)
Get the second largest value for scalar images, but do not recompute it first.
static void Update(vtkPolyData *)
ScalarType GetDefaultUpperBound() const
StatisticsHolderPointer GetStatistics() const
Returns a pointer to the ImageStatisticsHolder object that holds all statistics information for the i...
virtual mitk::ScalarType GetScalarValueMaxNoRecompute(unsigned int t=0)
Get the largest value for scalar images, but do not recompute it first.
virtual unsigned int GetCountOfMaxValuedVoxelsNoRecompute(unsigned int t=0)
Get the count of voxels with the largest scalar value in the dataset.
vcl_size_t GetBpe() const
Get the number of bits per element (of an element)
ScalarType GetDefaultLowerBound() const
void SetRangeMinMax(ScalarType min, ScalarType max)
The LevelWindow class Class to store level/window values.
virtual ScalarType GetScalarValueMin(int t=0, unsigned int component=0)
Get the minimum for scalar images. Recomputation performed only when necessary.
int GetComponentType() const
Get the component type (the scalar (!) type). Each element may contain m_NumberOfComponents (more tha...
virtual LevelWindow & operator=(const LevelWindow &levWin)
implementation necessary because operator made private in itk::Object
void SetFloatingValues(bool value)
Sets the floating image value.
void SetDefaultLevelWindow(ScalarType level, ScalarType window)
void ResetDefaultRangeMinMax()
the default min and max range for image will be reset
unsigned int GetDimension() const
Get dimension of the image.
ScalarType GetUpperWindowBound() const
ScalarType GetRange() const
returns the size of the grey value range
Image class for storing images.
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
ScalarType m_UpperWindowBound
ScalarType GetDefaultWindow() const
returns the default window size for the image
itk::ImageIOBase::IOPixelType GetPixelType() const
mitk::Image::Pointer image
ScalarType GetRangeMax() const
ScalarType GetWindow() const
returns the current window size, i.e the range size of the current grey value interval ...
MITKCORE_EXPORT const ScalarType sqrteps
void SetDefaultBoundaries(ScalarType low, ScalarType up)
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
virtual unsigned int GetCountOfMinValuedVoxelsNoRecompute(unsigned int t=0) const
Get the count of voxels with the smallest scalar value in the dataset.
ScalarType m_LowerWindowBound
virtual bool IsInitialized() const
Check whether the data has been initialized, i.e., at least the Geometry and other header data has be...
static void swap(T &x, T &y)
ScalarType GetDefaultLevel() const
method returns the default level value for the image
ScalarType GetRangeMin() const
void SetToMaxWindowSize()
virtual bool operator==(const LevelWindow &levWin) const
equality operator implementation that allows to compare two level windows
void SetLevelWindow(ScalarType level, ScalarType window, bool expandRangesIfNecessary=true)
ScalarType GetLowerWindowBound() const
virtual mitk::ScalarType GetScalarValue2ndMinNoRecompute(unsigned int t=0) const
Get the second smallest value for scalar images, but do not recompute it first.
bool IsFloatingValues() const
Shows if floating values are accepted.