Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLPlotSeriesNode.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Copyright (c) Kapteyn Astronomical Institute
4 University of Groningen, Groningen, Netherlands. All Rights Reserved.
5
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15 This file was originally developed by Davide Punzo, Kapteyn Astronomical Institute,
16 and was supported through the European Research Council grant nr. 291531.
17
18==============================================================================*/
19
20#ifndef __vtkMRMLPlotSeriesNode_h
21#define __vtkMRMLPlotSeriesNode_h
22
23#include <string>
24#include <vector>
25
26// MRML Includes
27#include "vtkMRMLNode.h"
28
31
32// VTK Includes
33class vtkColor4ub;
34class vtkPlot;
35class vtkTable;
36
42class VTK_MRML_EXPORT vtkMRMLPlotSeriesNode : public vtkMRMLNode
43{
44public:
47
49 enum
50 {
55 PlotType_Last // must be last
56 };
57
59 enum
60 {
67 MarkerStyle_Last // must be last
68 };
69
71 enum
72 {
79 LineStyle_Last // must be last
80 };
81
82 void PrintSelf(ostream& os, vtkIndent indent) override;
83
84 //----------------------------------------------------------------
86 //----------------------------------------------------------------
87
89
92 void ReadXMLAttributes(const char** atts) override;
93
96 void WriteXML(ostream& of, int indent) override;
97
100 const char* GetNodeTagName() override { return "PlotSeries"; };
101
105 virtual void SetAndObserveTableNodeID(const char* tableNodeID);
106
111 virtual void SetAndObserveTableNodeID(const std::string& tableNodeID);
112
116
119 void ProcessMRMLEvents(vtkObject* caller, unsigned long event, void* callData) override;
120
123 enum
124 {
126 };
127
130 const char* GetTableNodeID();
131
132 //----------------------------------------------------------------
134 //----------------------------------------------------------------
135
141 vtkSetMacro(PlotType, int);
142 vtkGetMacro(PlotType, int);
143
147 virtual void SetPlotType(const char* type);
148
150 vtkGetMacro(XColumnName, std::string);
151 vtkSetMacro(XColumnName, std::string);
152
155 vtkGetMacro(YColumnName, std::string);
156 vtkSetMacro(YColumnName, std::string);
157
160 vtkGetMacro(LabelColumnName, std::string);
161 vtkSetMacro(LabelColumnName, std::string);
162
165 static const char* GetPlotTypeAsString(int id);
166 static int GetPlotTypeFromString(const char* name);
167
173 vtkSetMacro(MarkerStyle, int);
174 vtkGetMacro(MarkerStyle, int);
175
178 static const char* GetMarkerStyleAsString(int id);
179 static int GetMarkerStyleFromString(const char* name);
180
184 vtkGetMacro(MarkerSize, float);
185 vtkSetMacro(MarkerSize, float);
186
191 vtkSetMacro(LineStyle, int);
192 vtkGetMacro(LineStyle, int);
193
196 const char* GetLineStyleAsString(int id);
197 int GetLineStyleFromString(const char* name);
198
202 vtkGetMacro(LineWidth, float);
203 vtkSetMacro(LineWidth, float);
204
207 vtkGetVector3Macro(Color, double);
208 vtkSetVector3Macro(Color, double);
209
213 void SetUniqueColor(const char* colorTableNodeID = nullptr);
214
217 vtkGetMacro(Opacity, double);
218 vtkSetMacro(Opacity, double);
219
223
224 //----------------------------------------------------------------
226 //----------------------------------------------------------------
227protected:
232
233 static const char* TableNodeReferenceRole;
235
236 virtual const char* GetTableNodeReferenceRole();
238
242 {
244 if (std::string(reference->GetReferenceRole()) == this->TableNodeReferenceRole)
245 {
247 }
248 }
249
253 {
255 if (std::string(reference->GetReferenceRole()) == this->TableNodeReferenceRole)
256 {
258 }
259 }
260
264 {
266 if (std::string(reference->GetReferenceRole()) == this->TableNodeReferenceRole)
267 {
269 }
270 }
271
275
276 //----------------------------------------------------------------
278 //----------------------------------------------------------------
279protected:
283
284 std::string XColumnName;
285 std::string YColumnName;
286 std::string LabelColumnName;
287
288 float LineWidth{ 2 };
290
291 float MarkerSize{ 7 };
293
294 double Color[3];
295 double Opacity{ 1.0 };
296};
297
298#endif
Class to hold information about a node reference.
vtkMRMLNode * GetReferencedNode() const
virtual void OnNodeReferenceRemoved(vtkMRMLNodeReference *reference)
Called when a referenced node pointer is removed (set to nullptr).
virtual void OnNodeReferenceModified(vtkMRMLNodeReference *reference)
Called when a referenced node pointer is modified.
virtual void OnNodeReferenceAdded(vtkMRMLNodeReference *reference)
virtual void InvokeCustomModifiedEvent(int eventId, void *callData=nullptr)
This method allows the node to compress events.
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Called when a node reference ID is modified.
static const char * TableNodeReferenceRole
static vtkMRMLPlotSeriesNode * New()
const char * GetTableNodeID()
Get referenced transform node id.
static int GetPlotTypeFromString(const char *name)
void PrintSelf(ostream &os, vtkIndent indent) override
void SetUniqueColor(const char *colorTableNodeID=nullptr)
vtkMRMLPlotSeriesNode(const vtkMRMLPlotSeriesNode &)
void ReadXMLAttributes(const char **atts) override
Set node attributes.
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override
Called when a node reference ID is added (list size increased).
virtual vtkMRMLTableNode * GetTableNode()
Get associated Table MRML node.
const char * GetLineStyleAsString(int id)
Convert between line style ID and name.
vtkMRMLCopyContentMacro(vtkMRMLPlotSeriesNode)
void operator=(const vtkMRMLPlotSeriesNode &)
~vtkMRMLPlotSeriesNode() override
virtual const char * GetTableNodeReferenceRole()
vtkMRMLPlotSeriesNode()
Constructor and destructor.
virtual void SetAndObserveTableNodeID(const std::string &tableNodeID)
virtual void SetAndObserveTableNodeID(const char *tableNodeID)
vtkMRMLNode * CreateNodeInstance() override
Standard methods for MRML nodes.
static const char * GetMarkerStyleAsString(int id)
Convert between plot markers style ID and name.
bool IsXColumnRequired()
Returns true if X column is required (true for scatter plots)
static int GetMarkerStyleFromString(const char *name)
static const char * GetPlotTypeAsString(int id)
Convert between plot type ID and name.
void OnNodeReferenceRemoved(vtkMRMLNodeReference *reference) override
Called after a node reference ID is removed (list size decreased).
virtual const char * GetTableNodeReferenceMRMLAttributeName()
static const char * TableNodeReferenceMRMLAttributeName
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
Method to propagate events generated in Plot nodes.
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model).
virtual void SetPlotType(const char *type)
int GetLineStyleFromString(const char *name)
A superclass for other storage nodes.
MRML node to represent a table object.