VTK  9.6.1
vtkWindowLevelLookupTable.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
23
24#ifndef vtkWindowLevelLookupTable_h
25#define vtkWindowLevelLookupTable_h
26
27#include "vtkLookupTable.h"
28#include "vtkRenderingCoreModule.h" // For export macro
29
30#include <algorithm> // For std::max
31
32VTK_ABI_NAMESPACE_BEGIN
33class VTKRENDERINGCORE_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
34{
35public:
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
44 void ForceBuild() override;
45
47
51 void SetWindow(double window)
52 {
53 window = std::max(window, 1e-5);
54 this->Window = window;
55 this->SetTableRange(this->Level - this->Window / 2.0, this->Level + this->Window / 2.0);
56 }
57 vtkGetMacro(Window, double);
59
61
65 void SetLevel(double level)
66 {
67 this->Level = level;
68 this->SetTableRange(this->Level - this->Window / 2.0, this->Level + this->Window / 2.0);
69 }
70 vtkGetMacro(Level, double);
72
74
80 vtkBooleanMacro(InverseVideo, vtkTypeBool);
82
84
89 vtkSetVector4Macro(MinimumTableValue, double);
90 vtkGetVector4Macro(MinimumTableValue, double);
92
94
99 vtkSetVector4Macro(MaximumTableValue, double);
100 vtkGetVector4Macro(MaximumTableValue, double);
102
103protected:
104 vtkWindowLevelLookupTable(int sze = 256, int ext = 256);
105 ~vtkWindowLevelLookupTable() override = default;
106
107 double Window;
108 double Level;
112
113private:
115 void operator=(const vtkWindowLevelLookupTable&) = delete;
116};
117
118VTK_ABI_NAMESPACE_END
119#endif
a simple class to control print indentation
Definition vtkIndent.h:29
vtkLookupTable(int sze=256, int ext=256)
virtual void SetTableRange(const double r[2])
Set/Get the minimum/maximum scalar values for scalar mapping.
~vtkWindowLevelLookupTable() override=default
void SetInverseVideo(vtkTypeBool iv)
Set inverse video on or off.
vtkWindowLevelLookupTable(int sze=256, int ext=256)
void SetLevel(double level)
Set the Level for the lookup table.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkWindowLevelLookupTable * New()
void SetWindow(double window)
Set the window for the lookup table.
void ForceBuild() override
Generate lookup table as a linear ramp between MinimumTableValue and MaximumTableValue.
int vtkTypeBool
Definition vtkABI.h:64