Medical Imaging Interaction Toolkit  2025.12.02
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 {
42  class MITKCORE_EXPORT LookupTable : public itk::DataObject
43  {
44  public:
48  typedef unsigned char RawLookupTableType;
49 
51 
52  itkFactorylessNewMacro(Self);
53 
54  itkCloneMacro(Self);
55 
60 
65 
71 
76  virtual void ChangeOpacityForAll(float opacity);
77 
83  virtual void ChangeOpacity(int index, float opacity);
84 
92  virtual void GetColor(double value, double rgb[3]);
93 
99  virtual void GetTableValue(int index, double rgba[4]);
100 
106  virtual void SetTableValue(int index, double rgba[4]);
107 
108  itkSetMacro(Window, float);
109  itkSetMacro(Level, float);
110  itkSetMacro(Opacity, float);
111 
115  virtual bool operator==(const mitk::LookupTable &LookupTable) const;
116 
120  virtual bool operator!=(const LookupTable &LookupTable) const;
121 
127 
132  void UpdateOutputInformation() override;
133 
141 
147 
153  bool VerifyRequestedRegion() override;
154 
159  void SetRequestedRegion(const itk::DataObject *data) override;
160 
162  ~LookupTable() override;
166  DEPRECATED(void CreateColorTransferFunction(vtkColorTransferFunction *&colorFunction));
170  DEPRECATED(void CreateOpacityTransferFunction(vtkPiecewiseFunction *&opacityFunction));
174  DEPRECATED(void CreateGradientTransferFunction(vtkPiecewiseFunction *&gradientFunction));
175 
179 
201  {
217  TURBO
218  };
219 
220  static std::vector<std::string> typenameList;
221 
227  virtual void SetType(const LookupTableType type);
228 
234  virtual void SetType(const std::string &typeName);
235 
240 
244  virtual std::string GetActiveTypeAsString() const;
245 
246  protected:
247  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
248 
249  LookupTable(const LookupTable &other);
250 
255  virtual void BuildHotIronLookupTable();
256  virtual void BuildPlasmaLookupTable();
257  virtual void BuildInfernoLookupTable();
258  virtual void BuildViridisLookupTable();
259  virtual void BuildMagmaLookupTable();
260  virtual void BuildJetLookupTable(bool transparent = false);
261  virtual void BuildPETColorLookupTable();
262  virtual void BuildPET20LookupTable();
263  virtual void BuildPETBWLookupTable();
265  virtual void BuildTurboLookupTable();
266 
268 
269  float m_Window;
270  float m_Level;
271  float m_Opacity;
272 
274 
275  private:
276  itk::LightObject::Pointer InternalClone() const override;
277  };
278 } // namespace mitk
279 
280 #endif
#define MITKCORE_EXPORT
The LookupTable class mitk wrapper for a vtkLookupTable.
virtual bool operator==(const mitk::LookupTable &LookupTable) const
equality operator implementation
virtual void BuildMagmaLookupTable()
LookupTableType m_Type
virtual void BuildGrayScaleLookupTable()
void CreateGradientTransferFunction(vtkPiecewiseFunction *&gradientFunction)
vtkSmartPointer< vtkColorTransferFunction > CreateColorTransferFunction()
vtkSmartPointer< vtkPiecewiseFunction > CreateOpacityTransferFunction()
virtual void BuildTurboLookupTable()
virtual void BuildPETBWLookupTable()
virtual void BuildPETColorLookupTable()
virtual std::string GetActiveTypeAsString() const
Return the current look-up table type as a string.
virtual void BuildPET20LookupTable()
virtual void BuildInfernoLookupTable()
bool VerifyRequestedRegion() override
Checks if the requested region is completely contained in the buffered region. Since we always want t...
virtual void BuildMultiLabelLookupTable()
void SetRequestedRegion(const itk::DataObject *data) override
This method has no effect for lookup tables, since we do not support the region-mechanism.
virtual void BuildJetLookupTable(bool transparent=false)
LookupTableType
The LookupTableType enum for different predefined lookup tables.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Checks, if the requested region lies outside of the buffered region by calling verifyRequestedRegion(...
void SetRequestedRegionToLargestPossibleRegion() override
Sets the requested Region to the largest possible region. This method is not implemented,...
virtual void ChangeOpacityForAll(float opacity)
ChangeOpacityForAll Set the opacity for all table values.
static std::vector< std::string > typenameList
LookupTable(const LookupTable &other)
virtual void SetType(const std::string &typeName)
Set the look-up table type by string.
virtual void BuildInverseGrayScaleLookupTable()
void CreateOpacityTransferFunction(vtkPiecewiseFunction *&opacityFunction)
void CreateColorTransferFunction(vtkColorTransferFunction *&colorFunction)
~LookupTable() override
virtual void BuildLegacyBinaryLookupTable()
virtual void BuildHotIronLookupTable()
void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual void SetType(const LookupTableType type)
Set the look-up table type by enum (or integer).
vtkSmartPointer< vtkLookupTable > m_LookupTable
virtual void GetTableValue(int index, double rgba[4])
GetTableValue convenience method wrapping the vtkLookupTable::GetTableValue() method.
void UpdateOutputInformation() override
Updates the output information of the current object by calling updateOutputInformation of the data o...
virtual vtkSmartPointer< vtkLookupTable > GetVtkLookupTable() const
GetVtkLookupTable Getter for the internally wrapped vtkLookupTable.
virtual LookupTable & operator=(const LookupTable &LookupTable)
implementation necessary because operator made private in itk::Object
unsigned char RawLookupTableType
RawLookupTableType raw lookuptable typedef for convenience.
virtual void BuildPlasmaLookupTable()
vtkSmartPointer< vtkPiecewiseFunction > CreateGradientTransferFunction()
virtual RawLookupTableType * GetRawLookupTable() const
GetRawLookupTable Getter for the raw lookuptable array.
virtual LookupTableType GetActiveType() const
Return the current look-up table type.
virtual void BuildViridisLookupTable()
virtual void ChangeOpacity(int index, float opacity)
ChangeOpacity Set the opacity for a specific table index.
virtual void GetColor(double value, double rgb[3])
GetColor convenience method wrapping the vtkLookupTable::GetColor() method.
virtual void SetVtkLookupTable(vtkSmartPointer< vtkLookupTable > lut)
SetVtkLookupTable Setter for the internal lookuptable.
virtual bool operator!=(const LookupTable &LookupTable) const
non equality operator implementation
virtual void SetTableValue(int index, double rgba[4])
SetTableValue convenience method wrapping the vtkLookupTable::SetTableValue() method.
virtual void BuildLegacyRainbowColorLookupTable()
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
#define DEPRECATED(func)
Definition: mitkCommon.h:175
Find image slices visible on a given plane.