VTK  9.7.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
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 
32 VTK_ABI_NAMESPACE_BEGIN
33 class VTKRENDERINGCORE_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
34 {
35 public:
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 
78  void SetInverseVideo(vtkTypeBool iv);
79  vtkGetMacro(InverseVideo, vtkTypeBool);
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 
103 protected:
104  vtkWindowLevelLookupTable(int sze = 256, int ext = 256);
105  ~vtkWindowLevelLookupTable() override = default;
106 
107  double Window;
108  double Level;
110  double MaximumTableValue[4];
111  double MinimumTableValue[4];
112 
113 private:
115  void operator=(const vtkWindowLevelLookupTable&) = delete;
116 };
117 
118 VTK_ABI_NAMESPACE_END
119 #endif
void SetWindow(double window)
Set the window for the lookup table.
virtual void SetTableRange(const double r[2])
Set/Get the minimum/maximum scalar values for scalar mapping.
map scalar values into colors via a lookup table
int vtkTypeBool
Definition: vtkABI.h:64
virtual void ForceBuild()
Force the lookup table to regenerate from hue, saturation, value, and alpha min/max values...
a simple class to control print indentation
Definition: vtkIndent.h:28
static vtkLookupTable * New()
Construct with range=[0,1]; and hsv ranges set up for rainbow color table (from red to blue)...
void SetLevel(double level)
Set the Level for the lookup table.
map scalar values into colors or colors to scalars; generate color table
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define max(a, b)