Slicer 5.9
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
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 {
148 Grey = 1,
149 Iron = 2,
151 Ocean = 4,
155 FMRI = 8,
157 Labels = 10,
159 Random = 12,
160 Red = 15,
161 Green = 16,
162 Blue = 17,
163 Yellow = 18,
164 Cyan = 19,
166 Warm1 = 21,
167 Warm2 = 22,
168 Warm3 = 23,
169 Cool1 = 24,
170 Cool2 = 25,
171 Cool3 = 26,
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
205 void AddColor(const char* name, double r, double g, double b, double a = 1.0);
206
209 int SetColor(int entry, const char* name, double r, double g, double b, double a = 1.0);
210
213 bool RemoveColor(int entry);
214
219 int SetColors(int firstEntry, int lastEntry, const char* name, double r, double g, double b, double a = 1.0);
220
223 bool RemoveColors(int firstEntry, int lastEntry);
224
228 int SetColor(int entry, double r, double g, double b, double a);
229 int SetColor(int entry, double r, double g, double b);
230 int SetOpacity(int entry, double opacity);
231
234 bool GetColor(int entry, double color[4]) override;
235
239
242 void Reset(vtkMRMLNode* defaultNode) override;
243
247
248protected:
253
256 vtkLookupTable *LookupTable;
257
261};
262
263#endif
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)
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.
bool RemoveColors(int firstEntry, int lastEntry)
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.
bool RemoveColor(int entry)
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
A superclass for other storage nodes.