VTK  9.5.20250918
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
63#ifndef vtkWindowLevelLookupTable_h
64#define vtkWindowLevelLookupTable_h
65
66#include "vtkLookupTable.h"
67#include "vtkRenderingCoreModule.h" // For export macro
68
69#include <algorithm> // For std::max
70
71VTK_ABI_NAMESPACE_BEGIN
72class VTKRENDERINGCORE_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
73{
74public:
77 void PrintSelf(ostream& os, vtkIndent indent) override;
78
83 void ForceBuild() override;
84
86
90 void SetWindow(double window)
91 {
92 window = std::max(window, 1e-5);
93 this->Window = window;
94 this->SetTableRange(this->Level - this->Window / 2.0, this->Level + this->Window / 2.0);
95 }
96 vtkGetMacro(Window, double);
98
100
104 void SetLevel(double level)
105 {
106 this->Level = level;
107 this->SetTableRange(this->Level - this->Window / 2.0, this->Level + this->Window / 2.0);
108 }
109 vtkGetMacro(Level, double);
111
113
118 vtkGetMacro(InverseVideo, vtkTypeBool);
119 vtkBooleanMacro(InverseVideo, vtkTypeBool);
121
123
128 vtkSetVector4Macro(MinimumTableValue, double);
129 vtkGetVector4Macro(MinimumTableValue, double);
131
133
138 vtkSetVector4Macro(MaximumTableValue, double);
139 vtkGetVector4Macro(MaximumTableValue, double);
141
142protected:
143 vtkWindowLevelLookupTable(int sze = 256, int ext = 256);
144 ~vtkWindowLevelLookupTable() override = default;
145
146 double Window;
147 double Level;
149 double MaximumTableValue[4];
150 double MinimumTableValue[4];
151
152private:
154 void operator=(const vtkWindowLevelLookupTable&) = delete;
155};
156
157VTK_ABI_NAMESPACE_END
158#endif
a simple class to control print indentation
Definition vtkIndent.h:108
map scalar values into colors via a lookup table
virtual void SetTableRange(const double r[2])
Set/Get the minimum/maximum scalar values for scalar mapping.
map scalar values into colors or colors to scalars; generate color table
~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