Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLColorLogic.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2005 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 =========================================================================auto=*/
9 
10 #ifndef __vtkMRMLColorLogic_h
11 #define __vtkMRMLColorLogic_h
12 
13 // MRMLLogic includes
14 #include "vtkMRMLAbstractLogic.h"
15 #include "vtkMRMLLogicExport.h"
16 
17 // MRML includes
18 class vtkMRMLColorNode;
24 
25 // STD includes
26 #include <cstdlib>
27 #include <vector>
28 
33 class VTK_MRML_LOGIC_EXPORT vtkMRMLColorLogic : public vtkMRMLAbstractLogic
34 {
35 public:
36 
38  static vtkMRMLColorLogic *New();
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
131  virtual void AddDefaultColorNodes();
132 
136  virtual void RemoveDefaultColorNodes();
137 
139  static const char * GetColorTableNodeID(int type);
140 
142  static const char * GetdGEMRICColorNodeID(int type);
143 
145  static const char * GetPETColorNodeID(int type);
146 
150  static const char * GetProceduralColorNodeID(const char *name);
151 
156  static const char * GetFileColorNodeID(const char *fileName);
157  static std::string GetFileColorNodeSingletonTag(const char * fileName);
158 
160  virtual const char * GetDefaultVolumeColorNodeID();
161 
163  virtual const char * GetDefaultLabelMapColorNodeID();
164 
166  virtual const char * GetDefaultEditorColorNodeID();
167 
169  virtual const char * GetDefaultModelColorNodeID();
170 
172  virtual const char * GetDefaultChartColorNodeID();
173 
175  virtual const char * GetDefaultPlotColorNodeID();
176 
178  void AddColorFile(const char *fileName, std::vector<std::string> *Files);
179 
191  vtkMRMLColorNode* LoadColorFile(const char *fileName, const char *nodeName = nullptr);
192 
194  vtkGetStringMacro(UserColorFilePaths);
195  vtkSetStringMacro(UserColorFilePaths);
196 
200  static vtkMRMLColorTableNode* CopyNode(vtkMRMLColorNode* colorNode, const char* copyName);
201 
207  static vtkMRMLProceduralColorNode* CopyProceduralNode(vtkMRMLColorNode* colorNode, const char* copyName);
208 
209 protected:
211  ~vtkMRMLColorLogic() override;
212  // disable copy constructor and operator
214  void operator=(const vtkMRMLColorLogic&);
215 
217  void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
218 
221  virtual void OnMRMLSceneNewEvent();
222 
223  vtkMRMLColorTableNode* CreateLabelsNode();
224  vtkMRMLColorTableNode* CreateDefaultTableNode(int type);
225  vtkMRMLProceduralColorNode* CreateRandomNode();
226  vtkMRMLProceduralColorNode* CreateRedGreenBlueNode();
227  vtkMRMLPETProceduralColorNode* CreatePETColorNode(int type);
228  vtkMRMLdGEMRICProceduralColorNode* CreatedGEMRICColorNode(int type);
229  vtkMRMLColorTableNode* CreateDefaultFileNode(const std::string& colorname);
230  vtkMRMLColorTableNode* CreateUserFileNode(const std::string& colorname);
231  vtkMRMLColorTableNode* CreateFileNode(const char* fileName);
232  vtkMRMLProceduralColorNode* CreateProceduralFileNode(const char* fileName);
233 
234  void AddLabelsNode();
235  void AddDefaultTableNode(int i);
236  void AddDefaultProceduralNodes();
237  void AddPETNode(int type);
238  void AddDGEMRICNode(int type);
239  void AddDefaultFileNode(int i);
240  void AddUserFileNode(int i);
241 
242  void AddDefaultTableNodes();
243  void AddPETNodes();
244  void AddDGEMRICNodes();
245  void AddDefaultFileNodes();
246  void AddUserFileNodes();
247 
248  virtual std::vector<std::string> FindDefaultColorFiles();
249  virtual std::vector<std::string> FindUserColorFiles();
250 
253  static const char * GetColorNodeID(vtkMRMLColorNode* colorNode);
254 
259  std::vector<std::string> ColorFiles;
260 
263  std::vector<std::string> UserColorFiles;
268 
269  static std::string TempColorNodeID;
270 
271  std::string RemoveLeadAndTrailSpaces(std::string);
272 };
273 
274 #endif
Superclass for MRML logic classes.
void PrintSelf(ostream &os, vtkIndent indent) override
std::vector< std::string > UserColorFiles
std::vector< std::string > ColorFiles
MRML logic class for color manipulation.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
Abstract MRML node to represent color information.
MRML node to represent procedurally defined color information.
MRML node to represent procedurally defined color information.
static std::string TempColorNodeID
MRML node to represent discrete color information.
static vtkMRMLAbstractLogic * New()