Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLColorTableNode.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2006 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: 3D Slicer
9  Module: $RCSfile: vtkMRMLColorTableNode.h,v $
10  Date: $Date: 2006/03/19 17:12:28 $
11  Version: $Revision: 1.0 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLColorTableNode_h
16 #define __vtkMRMLColorTableNode_h
17 
18 #include "vtkMRMLColorNode.h"
19 
26 class VTK_MRML_EXPORT vtkMRMLColorTableNode : public vtkMRMLColorNode
27 {
28 public:
29  static vtkMRMLColorTableNode *New();
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
33  //--------------------------------------------------------------------------
35  //--------------------------------------------------------------------------
36 
37  vtkMRMLNode* CreateNodeInstance() override;
38 
41  void ReadXMLAttributes( const char** atts) override;
42 
45  void WriteXML(ostream& of, int indent) override;
46 
49  void Copy(vtkMRMLNode *node) override;
50 
53  const char* GetNodeTagName() override {return "ColorTable";}
54 
57  vtkLookupTable* GetLookupTable() override;
58 
61  virtual void SetAndObserveLookupTable(vtkLookupTable *newLookupTable);
62 
66  virtual void SetLookupTable(vtkLookupTable* newLookupTable)
67  {
68  SetAndObserveLookupTable(newLookupTable);
69  }
70 
73  void SetType(int type) override;
74  //GetType is defined in ColorTableNode class via macro.
75  void SetTypeToFullRainbow();
76  void SetTypeToGrey();
77  void SetTypeToIron();
78  void SetTypeToRainbow();
79  void SetTypeToOcean();
80  void SetTypeToDesert();
81  void SetTypeToInvGrey();
82  void SetTypeToReverseRainbow();
83  void SetTypeToFMRI();
84  void SetTypeToFMRIPA();
85  void SetTypeToLabels();
86  void SetTypeToRandom();
87  void SetTypeToRed();
88  void SetTypeToGreen();
89  void SetTypeToBlue();
90  void SetTypeToCyan();
91  void SetTypeToMagenta();
92  void SetTypeToYellow();
93  void SetTypeToWarm1();
94  void SetTypeToWarm2();
95  void SetTypeToWarm3();
96  void SetTypeToCool1();
97  void SetTypeToCool2();
98  void SetTypeToCool3();
99  void SetTypeToWarmShade1();
100  void SetTypeToWarmShade2();
101  void SetTypeToWarmShade3();
102  void SetTypeToCoolShade1();
103  void SetTypeToCoolShade2();
104  void SetTypeToCoolShade3();
105  void SetTypeToWarmTint1();
106  void SetTypeToWarmTint2();
107  void SetTypeToWarmTint3();
108  void SetTypeToCoolTint1();
109  void SetTypeToCoolTint2();
110  void SetTypeToCoolTint3();
111 
112 
113  void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData ) override;
114 
117 
145  enum
146  {
147  FullRainbow = 0,
148  Grey = 1,
149  Iron = 2,
150  Rainbow = 3,
151  Ocean = 4,
152  Desert = 5,
153  InvGrey = 6,
154  ReverseRainbow = 7,
155  FMRI = 8,
156  FMRIPA = 9,
157  Labels = 10,
158  Obsolete = 11,
159  Random = 12,
160  Red = 15,
161  Green = 16,
162  Blue = 17,
163  Yellow = 18,
164  Cyan = 19,
165  Magenta = 20,
166  Warm1 = 21,
167  Warm2 = 22,
168  Warm3 = 23,
169  Cool1 = 24,
170  Cool2 = 25,
171  Cool3 = 26,
172  WarmShade1 = 27,
173  WarmShade2 = 28,
174  WarmShade3 = 29,
175  CoolShade1 = 30,
176  CoolShade2 = 31,
177  CoolShade3 = 32,
178  WarmTint1 = 33,
179  WarmTint2 = 34,
180  WarmTint3 = 35,
181  CoolTint1 = 36,
182  CoolTint2 = 37,
183  CoolTint3 = 38
184  };
185 
188  int GetFirstType () override { return this->FullRainbow; };
189  int GetLastType () override { return this->CoolTint3; };
190 
193  const char * GetTypeAsString() override;
194 
197  void SetNumberOfColors(int n);
198 
201  int GetNumberOfColors() override;
202 
206 
209  void AddColor(const char* name, double r, double g, double b, double a = 1.0);
210 
213  int SetColor(int entry, const char* name, double r, double g, double b, double a = 1.0);
214 
217  int SetColors(int firstEntry, int lastEntry, const char* name, double r, double g, double b, double a = 1.0);
218 
220  int SetColor(int entry, double r, double g, double b, double a);
221  int SetColor(int entry, double r, double g, double b);
222  int SetOpacity(int entry, double opacity);
223 
226  bool GetColor(int entry, double color[4]) override;
227 
230  void ClearNames();
231 
234  void Reset(vtkMRMLNode* defaultNode) override;
235 
239 
240 protected:
242  ~vtkMRMLColorTableNode() override;
244  void operator=(const vtkMRMLColorTableNode&);
245 
248  vtkLookupTable *LookupTable;
249 
250 };
251 
252 #endif
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual void SetLookupTable(vtkLookupTable *newLookupTable)
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
void operator=(const vtkMRMLColorNode &)
int GetFirstType() override
Return the lowest and highest integers, for use in looping
virtual int GetNumberOfColors()
Get the number of colors in the table
void ReadXMLAttributes(const char **atts) override
Set node attributes
static vtkMRMLColorNode * New()
int LastAddedColor
keep track of where we last added a color
void PrintSelf(ostream &os, vtkIndent indent) override
A superclass for other storage nodes.
Abstract MRML node to represent color information.
void Reset(vtkMRMLNode *defaultNode) override
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
void Copy(vtkMRMLNode *node) override
Copy the node's attributes to this object
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
MRML node to represent discrete color information.
vtkLookupTable * LookupTable
The look up table, constructed according to the Type
virtual void SetType(int type)
Set Type to type, then build colors and set names
virtual vtkLookupTable * GetLookupTable()
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
Propagate events generated in mrml.
virtual bool GetColor(int ind, double color[4])
virtual const char * GetTypeAsString()
return a text string describing the color look up table type