Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkLookupTable.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef mitkLookupTable_h
13 #define mitkLookupTable_h
14 
15 #include <mitkCommon.h>
16 #include <MitkCoreExports.h>
17 
18 #include <itkDataObject.h>
19 #include <itkObjectFactory.h>
20 
21 #include <vtkLookupTable.h>
22 #include <vtkSmartPointer.h>
23 
24 class vtkColorTransferFunction;
25 class vtkPiecewiseFunction;
26 
27 namespace mitk
28 {
44  class MITKCORE_EXPORT LookupTable : public itk::DataObject
45  {
46  public:
50  typedef unsigned char RawLookupTableType;
51 
53 
54  itkFactorylessNewMacro(Self);
55 
56  itkCloneMacro(Self);
57 
63 
69 
75 
80  virtual void ChangeOpacityForAll(float opacity);
81 
87  virtual void ChangeOpacity(int index, float opacity);
88 
97  virtual void GetColor(double value, double rgb[3]);
98 
107 
118  static void GetMultiLabelColor(int index, double rgb[3]);
119 
128  virtual void GetTableValue(int index, double rgba[4]);
129 
138  virtual void SetTableValue(int index, double rgba[4]);
139 
140  itkSetMacro(Window, float);
141  itkSetMacro(Level, float);
142  itkSetMacro(Opacity, float);
143 
149  virtual bool operator==(const mitk::LookupTable &LookupTable) const;
150 
156  virtual bool operator!=(const LookupTable &LookupTable) const;
157 
167 
171  void UpdateOutputInformation() override;
172 
180 
186 
194  bool VerifyRequestedRegion() override;
195 
203  void SetRequestedRegion(const itk::DataObject *data) override;
204 
208  ~LookupTable() override;
209 
215 
221 
227 
249  {
265  TURBO
266  };
267 
269  static std::vector<std::string> typenameList;
270 
279  virtual void SetType(const LookupTableType type);
280 
289  virtual void SetType(const std::string &typeName);
290 
296 
301  virtual std::string GetActiveTypeAsString() const;
302 
303  protected:
304  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
305 
306  LookupTable(const Self &other);
307 
309 
314  virtual void BuildHotIronLookupTable();
315  virtual void BuildPlasmaLookupTable();
316  virtual void BuildInfernoLookupTable();
317  virtual void BuildViridisLookupTable();
318  virtual void BuildMagmaLookupTable();
319  virtual void BuildJetLookupTable(bool transparent = false);
320  virtual void BuildPETColorLookupTable();
321  virtual void BuildPET20LookupTable();
322  virtual void BuildPETBWLookupTable();
324  virtual void BuildTurboLookupTable();
325 
327 
328  float m_Window;
329  float m_Level;
330  float m_Opacity;
331 
333 
334  };
335 } // namespace mitk
336 
337 #endif
#define MITKCORE_EXPORT
MITK wrapper for a vtkLookupTable.
virtual bool operator==(const mitk::LookupTable &LookupTable) const
Compare two LookupTable objects for equality.
virtual void BuildMagmaLookupTable()
LookupTableType m_Type
virtual void BuildGrayScaleLookupTable()
vtkSmartPointer< vtkColorTransferFunction > CreateColorTransferFunction()
Create a vtkColorTransferFunction from this lookup table.
mitkClassMacroItkParent(LookupTable, itk::DataObject)
vtkSmartPointer< vtkPiecewiseFunction > CreateOpacityTransferFunction()
Create a vtkPiecewiseFunction for opacity from this lookup table.
virtual void BuildTurboLookupTable()
LookupTable()
Default constructor. Builds a GRAYSCALE table by default.
virtual void BuildPETBWLookupTable()
virtual void BuildPETColorLookupTable()
virtual std::string GetActiveTypeAsString() const
Get the currently active lookup table type as a string.
virtual void BuildPET20LookupTable()
static void GetMultiLabelColor(int index, double rgb[3])
RGB of the index-th MULTILABEL color, in [0,1].
virtual void BuildInfernoLookupTable()
static int GetMultiLabelColorCount()
Number of curated colors in the MULTILABEL palette.
bool VerifyRequestedRegion() override
Check whether the requested region is valid.
virtual void BuildMultiLabelLookupTable()
void SetRequestedRegion(const itk::DataObject *data) override
Set the requested region from another data object.
virtual void BuildJetLookupTable(bool transparent=false)
LookupTableType
The LookupTableType enum for different predefined lookup tables.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Check whether the requested region is outside the buffered region.
void SetRequestedRegionToLargestPossibleRegion() override
Set the requested region to the largest possible region.
virtual void ChangeOpacityForAll(float opacity)
Set the opacity (alpha) for all entries in the table.
static std::vector< std::string > typenameList
List of all predefined lookup table type names.
LookupTable(const Self &other)
virtual void SetType(const std::string &typeName)
Set the lookup table type by name string.
virtual void BuildInverseGrayScaleLookupTable()
~LookupTable() override
Destructor.
virtual void BuildLegacyBinaryLookupTable()
virtual void BuildHotIronLookupTable()
void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual void SetType(const LookupTableType type)
Set the lookup table type by enum value.
vtkSmartPointer< vtkLookupTable > m_LookupTable
virtual void GetTableValue(int index, double rgba[4])
Get the RGBA tuple at a specific table index.
void UpdateOutputInformation() override
Update output information by querying the source object.
virtual vtkSmartPointer< vtkLookupTable > GetVtkLookupTable() const
Get the internally wrapped vtkLookupTable.
virtual LookupTable & operator=(const LookupTable &LookupTable)
Copy assignment operator.
unsigned char RawLookupTableType
Convenience typedef for the raw lookup table element type.
virtual void BuildPlasmaLookupTable()
vtkSmartPointer< vtkPiecewiseFunction > CreateGradientTransferFunction()
Create a vtkPiecewiseFunction for gradient opacity from this lookup table.
virtual RawLookupTableType * GetRawLookupTable() const
Get the raw lookup table array from the wrapped vtkLookupTable.
virtual LookupTableType GetActiveType() const
Get the currently active lookup table type.
virtual void BuildViridisLookupTable()
virtual void ChangeOpacity(int index, float opacity)
Set the opacity (alpha) for a specific table entry.
virtual void GetColor(double value, double rgb[3])
Map a scalar value to an RGB color via the lookup table.
virtual void SetVtkLookupTable(vtkSmartPointer< vtkLookupTable > lut)
Set the internal vtkLookupTable.
virtual bool operator!=(const LookupTable &LookupTable) const
Compare two LookupTable objects for inequality.
virtual void SetTableValue(int index, double rgba[4])
Set the RGBA tuple at a specific table index.
virtual void BuildLegacyRainbowColorLookupTable()
Find image slices visible on a given plane.