Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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) VTK_OVERRIDE;
32 
33  //--------------------------------------------------------------------------
35  //--------------------------------------------------------------------------
36 
37  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
38 
41  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
42 
45  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
46 
49  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
50 
53  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "ColorTable";}
54 
57  vtkGetObjectMacro(LookupTable, vtkLookupTable);
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) VTK_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 ) VTK_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 () VTK_OVERRIDE { return this->FullRainbow; };
189  int GetLastType () VTK_OVERRIDE { return this->CoolTint3; };
190 
193  virtual const char * GetTypeAsString() VTK_OVERRIDE;
194 
197  void SetNumberOfColors(int n);
198 
201  virtual int GetNumberOfColors() VTK_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 
216  int SetColor(int entry, double r, double g, double b, double a);
217  int SetColor(int entry, double r, double g, double b);
218  int SetOpacity(int entry, double opacity);
219 
222  virtual bool GetColor(int entry, double color[4]) VTK_OVERRIDE;
223 
226  void ClearNames();
227 
230  virtual void Reset(vtkMRMLNode* defaultNode) VTK_OVERRIDE;
231 
234  virtual vtkMRMLStorageNode* CreateDefaultStorageNode() VTK_OVERRIDE;
235 
236 protected:
238  virtual ~vtkMRMLColorTableNode();
239  vtkMRMLColorTableNode(const vtkMRMLColorTableNode&);
240  void operator=(const vtkMRMLColorTableNode&);
241 
244  vtkLookupTable *LookupTable;
245 
246 };
247 
248 #endif
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE
MRMLNode methods.
virtual void Reset(vtkMRMLNode *defaultNode) VTK_OVERRIDE
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual void SetLookupTable(vtkLookupTable *newLookupTable)
int GetFirstType() VTK_OVERRIDE
Return the lowest and highest integers, for use in looping.
virtual int GetNumberOfColors()
Get the number of colours in the table.
static vtkMRMLColorNode * New()
int LastAddedColor
keep track of where we last added a colour
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) VTK_OVERRIDE
alternative method to propagate events generated in Storage nodes
A supercalss for other storage nodes.
Abstract MRML node to represent color information.
int GetLastType() VTK_OVERRIDE
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
MRML node to represent discrete color information.
virtual void SetType(int type)
Set Type to type, then build colours and set names.
virtual bool GetColor(int ind, double color[4])
virtual const char * GetTypeAsString()
return a text string describing the colour look up table type