Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 
59  virtual vtkSmartPointer<vtkLookupTable> GetVtkLookupTable() const;
60 
64  virtual RawLookupTableType *GetRawLookupTable() const;
65 
70  virtual void SetVtkLookupTable(vtkSmartPointer<vtkLookupTable> lut);
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 
126  virtual LookupTable &operator=(const LookupTable &LookupTable);
127 
132  void UpdateOutputInformation() override;
133 
140  void SetRequestedRegionToLargestPossibleRegion() override;
141 
146  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
147 
153  bool VerifyRequestedRegion() override;
154 
159  void SetRequestedRegion(const itk::DataObject *data) override;
160 
161  LookupTable();
162  ~LookupTable() override;
166  DEPRECATED(void CreateColorTransferFunction(vtkColorTransferFunction *&colorFunction));
170  DEPRECATED(void CreateOpacityTransferFunction(vtkPiecewiseFunction *&opacityFunction));
174  DEPRECATED(void CreateGradientTransferFunction(vtkPiecewiseFunction *&gradientFunction));
175 
176  vtkSmartPointer<vtkColorTransferFunction> CreateColorTransferFunction();
177  vtkSmartPointer<vtkPiecewiseFunction> CreateOpacityTransferFunction();
178  vtkSmartPointer<vtkPiecewiseFunction> CreateGradientTransferFunction();
179 
200  {
215  TURBO
216  };
217 
218  static std::vector<std::string> typenameList;
219 
225  virtual void SetType(const LookupTableType type);
226 
232  virtual void SetType(const std::string &typeName);
233 
237  virtual LookupTableType GetActiveType() const;
238 
242  virtual std::string GetActiveTypeAsString() const;
243 
244  protected:
245  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
246 
247  LookupTable(const LookupTable &other);
248 
249  virtual void BuildGrayScaleLookupTable();
250  virtual void BuildLegacyBinaryLookupTable();
251  virtual void BuildLegacyRainbowColorLookupTable();
252  virtual void BuildInverseGrayScaleLookupTable();
253  virtual void BuildHotIronLookupTable();
254  virtual void BuildPlasmaLookupTable();
255  virtual void BuildInfernoLookupTable();
256  virtual void BuildViridisLookupTable();
257  virtual void BuildMagmaLookupTable();
258  virtual void BuildJetLookupTable(bool transparent = false);
259  virtual void BuildPETColorLookupTable();
260  virtual void BuildPET20LookupTable();
261  virtual void BuildMultiLabelLookupTable();
262  virtual void BuildTurboLookupTable();
263 
265 
266  float m_Window;
267  float m_Level;
268  float m_Opacity;
269 
271 
272  private:
273  itk::LightObject::Pointer InternalClone() const override;
274  };
275 } // namespace mitk
276 
277 #endif
mitk::LookupTable::JET_TRANSPARENT
@ JET_TRANSPARENT
Definition: mitkLookupTable.h:205
mitk::LookupTable::MULTILABEL
@ MULTILABEL
Definition: mitkLookupTable.h:212
mitk::LookupTable::INVERSE_GRAYSCALE
@ INVERSE_GRAYSCALE
Definition: mitkLookupTable.h:202
mitk::LookupTable::m_Opacity
float m_Opacity
Definition: mitkLookupTable.h:268
mitk::LookupTable::INFERNO
@ INFERNO
Definition: mitkLookupTable.h:207
vtkSmartPointer< vtkLookupTable >
mitk::LookupTable::m_Type
LookupTableType m_Type
Definition: mitkLookupTable.h:270
DEPRECATED
#define DEPRECATED(func)
Definition: mitkCommon.h:175
mitk::LookupTable
The LookupTable class mitk wrapper for a vtkLookupTable.
Definition: mitkLookupTable.h:42
mitk::LookupTable::m_LookupTable
vtkSmartPointer< vtkLookupTable > m_LookupTable
Definition: mitkLookupTable.h:264
mitk::LookupTable::typenameList
static std::vector< std::string > typenameList
Definition: mitkLookupTable.h:218
mitk::LookupTable::PET_20
@ PET_20
Definition: mitkLookupTable.h:214
mitk::LookupTable::PET_COLOR
@ PET_COLOR
Definition: mitkLookupTable.h:213
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk::LookupTable::LEGACY_BINARY
@ LEGACY_BINARY
Definition: mitkLookupTable.h:210
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::operator!=
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
mitk::LookupTable::JET
@ JET
Definition: mitkLookupTable.h:204
mitk::LookupTable::GRAYSCALE
@ GRAYSCALE
Definition: mitkLookupTable.h:201
mitk::LookupTable::LookupTableType
LookupTableType
The LookupTableType enum for different predefined lookup tables.
Definition: mitkLookupTable.h:199
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
MitkCoreExports.h
mitkCommon.h
mitk::LookupTable::HOT_IRON
@ HOT_IRON
Definition: mitkLookupTable.h:203
mitk::LookupTable::MAGMA
@ MAGMA
Definition: mitkLookupTable.h:209
mitk::LookupTable::RawLookupTableType
unsigned char RawLookupTableType
RawLookupTableType raw lookuptable typedef for convenience.
Definition: mitkLookupTable.h:48
mitk::LookupTable::LEGACY_RAINBOW_COLOR
@ LEGACY_RAINBOW_COLOR
Definition: mitkLookupTable.h:211
mitk::LookupTable::m_Level
float m_Level
Definition: mitkLookupTable.h:267
mitk::LookupTable::PLASMA
@ PLASMA
Definition: mitkLookupTable.h:206
mitk::LookupTable::VIRIDIS
@ VIRIDIS
Definition: mitkLookupTable.h:208
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::LookupTable::m_Window
float m_Window
Definition: mitkLookupTable.h:266