Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
vtkMRMLColorNode Class Reference

Abstract MRML node to represent color information. More...

#include <Libs/MRML/Core/vtkMRMLColorNode.h>

Inheritance diagram for vtkMRMLColorNode:
Inheritance graph
[legend]
Collaboration diagram for vtkMRMLColorNode:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { TypeModifiedEvent = 20002 }
 TypeModifiedEvent is generated when the type of the colour look up table changes. More...
typedef vtkMRMLStorableNode Superclass

Public Member Functions

virtual void Copy (vtkMRMLNode *node)
virtual vtkMRMLNodeCreateNodeInstance ()
 MRMLNode methods.
virtual const char * GetClassName ()
virtual bool GetColor (int ind, double *color)
const char * GetColorName (int ind)
std::string GetColorNameAsFileName (int colorIndex, const char *subst="_")
std::string GetColorNameWithoutSpaces (int ind, const char *subst)
virtual char * GetFileName ()
virtual int GetFirstType ()
virtual int GetLastType ()
virtual vtkLookupTable * GetLookupTable ()
virtual bool GetModifiedSinceRead ()
virtual int GetNamesInitialised ()
virtual const char * GetNodeTagName ()
virtual char * GetNoName ()
virtual int GetNumberOfColors ()
virtual vtkScalarsToColors * GetScalarsToColors ()
virtual int GetType ()
virtual const char * GetTypeAsString ()
virtual int IsA (const char *type)
virtual void NamesInitialisedOff ()
virtual void NamesInitialisedOn ()
void PrintSelf (ostream &os, vtkIndent indent)
void ProcessMRMLEvents (vtkObject *caller, unsigned long event, void *callData)
virtual void ReadXMLAttributes (const char **atts)
virtual void Reset ()
int SetColorName (int ind, const char *name)
int SetColorNameWithSpaces (int ind, const char *name, const char *subst)
virtual void SetFileName (const char *)
void SetNamesFromColors ()
virtual void SetNamesInitialised (int)
virtual void SetNoName (const char *)
virtual void SetType (int type)
virtual void UpdateScene (vtkMRMLScene *scene)
virtual void WriteXML (ostream &of, int indent)

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkMRMLColorNodeNew ()
static vtkMRMLColorNodeSafeDownCast (vtkObject *o)

Protected Member Functions

virtual bool HasNameFromColor (int index)
void operator= (const vtkMRMLColorNode &)
virtual bool SetNameFromColor (int index)
 vtkMRMLColorNode ()
 vtkMRMLColorNode (const vtkMRMLColorNode &)
virtual ~vtkMRMLColorNode ()

Protected Attributes

char * FileName
std::vector< std::string > Names
int NamesInitialised
char * NoName
int Type

Detailed Description

Abstract MRML node to represent color information.

Color nodes describe colour look up tables. The tables may be pre-generated by Slicer (the label map colours, some default ramps, a random one) or created by a user. More than one model or label volume or editor can access the prebuilt nodes. This is used as a superclass for table based, procedural based, and implicit function based color nodes. All the color names are initialised to NoName ("(none)") when the table is created, using the max index of the colours expected to fill the table to set the size of the names array. If the node is being read in from a file, not all of the colours might be present from 0-max, so the colour name should remain (none) at those indices. But if the colour node is being built up from colours without names, there is a method to init the names from the colour RGBA values so that something would be there rather than the default NoName which is used to determine that it's a unnamed and probably uninitialised colour.

Subclasses must reimplement GetColor() and GetNumberOfColors().

Definition at line 47 of file vtkMRMLColorNode.h.


Member Typedef Documentation


Member Enumeration Documentation

anonymous enum

TypeModifiedEvent is generated when the type of the colour look up table changes.

Enumerator:
TypeModifiedEvent 

Definition at line 105 of file vtkMRMLColorNode.h.


Constructor & Destructor Documentation

vtkMRMLColorNode::vtkMRMLColorNode ( ) [protected]
virtual vtkMRMLColorNode::~vtkMRMLColorNode ( ) [protected, virtual]
vtkMRMLColorNode::vtkMRMLColorNode ( const vtkMRMLColorNode ) [protected]

Member Function Documentation

virtual void vtkMRMLColorNode::Copy ( vtkMRMLNode node) [virtual]
virtual vtkMRMLNode* vtkMRMLColorNode::CreateNodeInstance ( ) [virtual]
virtual const char* vtkMRMLColorNode::GetClassName ( ) [virtual]
virtual bool vtkMRMLColorNode::GetColor ( int  ind,
double *  color 
) [virtual]

Retrieve the color associated to the index Must be reimplemented in the derived classes Return 1 if the color exists, 0 otherwise

Reimplemented in vtkMRMLColorTableNode, vtkMRMLFreeSurferProceduralColorNode, and vtkMRMLProceduralColorNode.

const char* vtkMRMLColorNode::GetColorName ( int  ind)

Get the 0th based nth name of this colour

std::string vtkMRMLColorNode::GetColorNameAsFileName ( int  colorIndex,
const char *  subst = "_" 
)

Get the 0'th based colorIndex'th name of this color, replacing all file name sensitive color name characters with safer character(s). Only alphanumeric characters (A-Z,a-z,0-9) and '-','_','.','(',')','$', '!','~','#',','%','^','{','}' are supported; '/', '&', '?', '<' ... are replaced with '_' (or any other substitution string) While ' '(space) and accents are technically valid file name characters, they are replaced as an extra precaution. The color name is truncated to not be longer than 255 characters. subst can be made of invalid characters and be longer than 1 char

See also:
GetColorNameWithoutSpaces
std::string vtkMRMLColorNode::GetColorNameWithoutSpaces ( int  ind,
const char *  subst 
)

GetColorNameWithoutSpaces Get the 0th based nth name of this colour, replacing the spaces with subst

See also:
GetColorNameAsFileName
virtual char* vtkMRMLColorNode::GetFileName ( ) [virtual]
virtual int vtkMRMLColorNode::GetFirstType ( ) [virtual]

Return the lowest and the highest type integers (defined in enum in subclass), for use in looping

Reimplemented in vtkMRMLColorTableNode, vtkMRMLdGEMRICProceduralColorNode, vtkMRMLFreeSurferProceduralColorNode, and vtkMRMLPETProceduralColorNode.

virtual int vtkMRMLColorNode::GetLastType ( ) [virtual]
virtual vtkLookupTable* vtkMRMLColorNode::GetLookupTable ( ) [virtual]

Most color nodes will implement a look up table, so provide a top level get method

Reimplemented in vtkMRMLColorTableNode, and vtkMRMLFreeSurferProceduralColorNode.

virtual bool vtkMRMLColorNode::GetModifiedSinceRead ( ) [virtual]
virtual int vtkMRMLColorNode::GetNamesInitialised ( ) [virtual]

Get/Set for the flag on names array having been initalised

virtual const char* vtkMRMLColorNode::GetNodeTagName ( ) [inline, virtual]
virtual char* vtkMRMLColorNode::GetNoName ( ) [virtual]

get/set the string used for an unnamed colour "(none)" by default.

See also:
SetColorName
virtual int vtkMRMLColorNode::GetNumberOfColors ( ) [virtual]

Get the number of colours in the table

Reimplemented in vtkMRMLColorTableNode, vtkMRMLFreeSurferProceduralColorNode, and vtkMRMLProceduralColorNode.

virtual vtkScalarsToColors* vtkMRMLColorNode::GetScalarsToColors ( ) [virtual]

Utility function that either returns a vtkLookupTable or a vtkColorTransferFunction whichever makes more sense. Returns vtkMRMLColorNode::GetLookupTable() by default. You should the method if you want it to return something else in subclasses

Reimplemented in vtkMRMLFreeSurferProceduralColorNode, and vtkMRMLProceduralColorNode.

virtual int vtkMRMLColorNode::GetType ( ) [virtual]

Get for Type

Reimplemented in vtkMRMLColorTableNode.

virtual const char* vtkMRMLColorNode::GetTypeAsString ( ) [virtual]
virtual bool vtkMRMLColorNode::HasNameFromColor ( int  index) [protected, virtual]

Return true if the color index has a "real" name, otherwise return false if the name is NoName (i.e. "(none)") or automatically generated (i.e. "R=...G=...B=...").

See also:
GetNoName()
virtual int vtkMRMLColorNode::IsA ( const char *  type) [virtual]
static int vtkMRMLColorNode::IsTypeOf ( const char *  type) [static]
virtual void vtkMRMLColorNode::NamesInitialisedOff ( ) [virtual]
virtual void vtkMRMLColorNode::NamesInitialisedOn ( ) [virtual]
static vtkMRMLColorNode* vtkMRMLColorNode::New ( ) [static]
void vtkMRMLColorNode::operator= ( const vtkMRMLColorNode ) [protected]
void vtkMRMLColorNode::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
void vtkMRMLColorNode::ProcessMRMLEvents ( vtkObject *  ,
unsigned long  long,
void *   
) [virtual]

alternative method to propagate events generated in Storage nodes

Reimplemented from vtkMRMLStorableNode.

Reimplemented in vtkMRMLColorTableNode, vtkMRMLdGEMRICProceduralColorNode, vtkMRMLFreeSurferProceduralColorNode, vtkMRMLPETProceduralColorNode, and vtkMRMLProceduralColorNode.

virtual void vtkMRMLColorNode::ReadXMLAttributes ( const char **  atts) [virtual]
virtual void vtkMRMLColorNode::Reset ( ) [virtual]

Reset node attributes to the initilal state as defined in the constructor. NOTE: it preserves values several dynamic attributes that may be set by an application: type, name

Reimplemented from vtkMRMLNode.

Reimplemented in vtkMRMLColorTableNode.

static vtkMRMLColorNode* vtkMRMLColorNode::SafeDownCast ( vtkObject *  o) [static]
int vtkMRMLColorNode::SetColorName ( int  ind,
const char *  name 
)

Set the 0th based nth name of this colour. Returns 1 on success, 0 on failure.

int vtkMRMLColorNode::SetColorNameWithSpaces ( int  ind,
const char *  name,
const char *  subst 
)

Set the 0th based nth name of this colour, replacing the subst character with spaces. Returns 1 on success, 0 on failure

virtual void vtkMRMLColorNode::SetFileName ( const char *  ) [virtual]

Name of the file name from which to read color information

virtual bool vtkMRMLColorNode::SetNameFromColor ( int  index) [protected, virtual]

Set values in the names vector from the colours in the node

Reimplemented in vtkMRMLFreeSurferProceduralColorNode, and vtkMRMLProceduralColorNode.

void vtkMRMLColorNode::SetNamesFromColors ( )

Set values in the names vector from the colours in the node

virtual void vtkMRMLColorNode::SetNamesInitialised ( int  ) [virtual]
virtual void vtkMRMLColorNode::SetNoName ( const char *  ) [virtual]
virtual void vtkMRMLColorNode::SetType ( int  type) [virtual]

Set Type to type, then build colours and set names

Reimplemented in vtkMRMLColorTableNode, vtkMRMLdGEMRICProceduralColorNode, vtkMRMLFreeSurferProceduralColorNode, and vtkMRMLPETProceduralColorNode.

virtual void vtkMRMLColorNode::UpdateScene ( vtkMRMLScene scene) [virtual]
virtual void vtkMRMLColorNode::WriteXML ( ostream &  of,
int  indent 
) [virtual]

Member Data Documentation

char* vtkMRMLColorNode::FileName [protected]

A file name to read text attributes from

Definition at line 209 of file vtkMRMLColorNode.h.

std::vector<std::string> vtkMRMLColorNode::Names [protected]

A vector of names for the color table elements

Definition at line 205 of file vtkMRMLColorNode.h.

Have the colour names been set? Used to do lazy copy of the Names array.

Definition at line 217 of file vtkMRMLColorNode.h.

char* vtkMRMLColorNode::NoName [protected]

the string used for an unnamed colour

Definition at line 213 of file vtkMRMLColorNode.h.

int vtkMRMLColorNode::Type [protected]

Which type of look up table does this node hold? Valid values are in the enumerated list

Definition at line 201 of file vtkMRMLColorNode.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines