Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
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 
199  {
213  PET_20
214  };
215 
216  static std::vector<std::string> typenameList;
217 
223  virtual void SetType(const LookupTableType type);
224 
230  virtual void SetType(const std::string &typeName);
231 
235  virtual LookupTableType GetActiveType() const;
236 
240  virtual std::string GetActiveTypeAsString() const;
241 
242  protected:
243  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
244 
245  LookupTable(const LookupTable &other);
246 
247  virtual void BuildGrayScaleLookupTable();
248  virtual void BuildLegacyBinaryLookupTable();
249  virtual void BuildLegacyRainbowColorLookupTable();
250  virtual void BuildInverseGrayScaleLookupTable();
251  virtual void BuildHotIronLookupTable();
252  virtual void BuildPlasmaLookupTable();
253  virtual void BuildInfernoLookupTable();
254  virtual void BuildViridisLookupTable();
255  virtual void BuildMagmaLookupTable();
256  virtual void BuildJetLookupTable(bool transparent = false);
257  virtual void BuildPETColorLookupTable();
258  virtual void BuildPET20LookupTable();
259  virtual void BuildMultiLabelLookupTable();
260 
261  vtkSmartPointer<vtkLookupTable> m_LookupTable;
262 
263  float m_Window;
264  float m_Level;
265  float m_Opacity;
266 
268 
269  private:
270  itk::LightObject::Pointer InternalClone() const override;
271  };
272 } // namespace mitk
273 
274 #endif /* mitkLookupTable_h */
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
#define MITKCORE_EXPORT
LookupTableType
The LookupTableType enum for different predefined lookup tables.
static std::vector< std::string > typenameList
DataCollection - Class to facilitate loading/accessing structured data.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
#define DEPRECATED(func)
Definition: mitkCommon.h:179
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
LookupTableType m_Type
vtkSmartPointer< vtkLookupTable > m_LookupTable
unsigned char RawLookupTableType
RawLookupTableType raw lookuptable typedef for convenience.
The LookupTable class mitk wrapper for a vtkLookupTableThis class can be used to color images with a ...