Slicer 5.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
26class VTK_MRML_EXPORT vtkMRMLColorTableNode : public vtkMRMLColorNode
27{
28public:
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
33 //--------------------------------------------------------------------------
35 //--------------------------------------------------------------------------
36
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.
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
231
234 void Reset(vtkMRMLNode* defaultNode) override;
235
239
240protected:
245
248 vtkLookupTable *LookupTable;
249
250};
251
252#endif
Abstract MRML node to represent color information.
MRML node to represent discrete color information.
int LastAddedColor
keep track of where we last added a color
~vtkMRMLColorTableNode() override
int SetColor(int entry, double r, double g, double b, double a)
Set a color into the User color table. Return 1 on success, 0 on failure.
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
int GetFirstType() override
Return the lowest and highest integers, for use in looping.
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
Propagate events generated in mrml.
virtual void SetAndObserveLookupTable(vtkLookupTable *newLookupTable)
void Copy(vtkMRMLNode *node) override
Copy the node's attributes to this object.
void SetNumberOfColors(int n)
Set the size of the color table if it's a User table.
vtkLookupTable * GetLookupTable() override
virtual void SetLookupTable(vtkLookupTable *newLookupTable)
vtkMRMLColorTableNode(const vtkMRMLColorTableNode &)
vtkLookupTable * LookupTable
The look up table, constructed according to the Type.
int SetOpacity(int entry, double opacity)
int SetColors(int firstEntry, int lastEntry, const char *name, double r, double g, double b, double a=1.0)
void PrintSelf(ostream &os, vtkIndent indent) override
void ClearNames()
clear out the names list
bool GetColor(int entry, double color[4]) override
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
int SetColor(int entry, const char *name, double r, double g, double b, double a=1.0)
Set a color into the User color table. Return 1 on success, 0 on failure.
vtkMRMLStorageNode * CreateDefaultStorageNode() override
Create default storage node or nullptr if does not have one.
void AddColor(const char *name, double r, double g, double b, double a=1.0)
Add a color to the User color table, at the end.
int GetNumberOfColors() override
Set the size of the color table if it's a User table.
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void Reset(vtkMRMLNode *defaultNode) override
reset when close the scene
int SetColor(int entry, double r, double g, double b)
static vtkMRMLColorTableNode * New()
void ReadXMLAttributes(const char **atts) override
Set node attributes.
void SetType(int type) override
Get/Set for Type.
void operator=(const vtkMRMLColorTableNode &)
const char * GetTypeAsString() override
return a text string describing the color look up table type
Abstract Superclass for all specific types of MRML nodes.
A superclass for other storage nodes.