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
vtkMRMLUnitNode.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 This file was originally developed by Johan Andruejol, Kitware Inc.
17 and was partially funded by NIH grant 3P41RR013218-12S1
18
19==============================================================================*/
20
21#ifndef __vtkMRMLUnitNode_h
22#define __vtkMRMLUnitNode_h
23
24// MRML includes
25#include "vtkMRMLNode.h"
26
33class VTK_MRML_EXPORT vtkMRMLUnitNode : public vtkMRMLNode
34{
35public:
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
40 //--------------------------------------------------------------------------
42 //--------------------------------------------------------------------------
44
47 void ReadXMLAttributes( const char** atts) override;
48
51 void WriteXML(ostream& of, int indent) override;
52
55 void Copy(vtkMRMLNode *node) override;
56
59 const char* GetNodeTagName() override {return "Unit";}
60
62 void Reset(vtkMRMLNode* defaultNode) override;
63
67 const char* GetQuantity();
68 void SetQuantity(const char* quantity);
69
74 virtual double GetDisplayValueFromValue(double value);
78 virtual double GetValueFromDisplayValue(double value);
81 const char* GetDisplayStringFromValue(double value);
82
88
92 void SetName(const char* name) override;
93
98 vtkGetStringMacro(Prefix);
99 vtkSetStringMacro(Prefix);
100
106 vtkGetStringMacro(Suffix);
107 vtkSetStringMacro(Suffix);
108
112 vtkGetMacro(Precision, int);
113 vtkSetClampMacro(Precision, int, 0, VTK_INT_MAX);
114
119 vtkGetMacro(MinimumValue, double);
120 vtkSetMacro(MinimumValue, double);
121
126 vtkGetMacro(MaximumValue, double);
127 vtkSetMacro(MaximumValue, double);
128
132 vtkGetMacro(DisplayCoefficient, double);
133 vtkSetMacro(DisplayCoefficient, double);
134
138 vtkGetMacro(DisplayOffset, double);
139 vtkSetMacro(DisplayOffset, double);
140
141protected:
146
147 virtual const char* GetDisplayValueStringFromDisplayValue(double displayValue);
148 virtual const char* GetDisplayStringFromDisplayValueString(const char* displayValue);
153 std::string WrapValueWithPrefix(const std::string& value) const;
154 std::string WrapValueWithSuffix(const std::string& value) const;
155 std::string WrapValueWithPrefixAndSuffix(const std::string& value) const;
156
157 char* Prefix;
158 char* Suffix;
162
165
166 std::string LastValueString;
167 std::string LastDisplayString;
168};
169
170#endif
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void Copy(vtkMRMLNode *node) override
Copy the node's attributes to this object.
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
void PrintSelf(ostream &os, vtkIndent indent) override
void SetQuantity(const char *quantity)
void operator=(const vtkMRMLUnitNode &)
std::string WrapValueWithPrefix(const std::string &value) const
std::string LastValueString
static vtkMRMLUnitNode * New()
std::string LastDisplayString
void SetName(const char *name) override
virtual const char * GetDisplayValueStringFromDisplayValue(double displayValue)
virtual double GetValueFromDisplayValue(double value)
const char * GetDisplayStringFromValue(double value)
const char * GetDisplayStringFormat()
std::string WrapValueWithPrefixAndSuffix(const std::string &value) const
vtkMRMLUnitNode(const vtkMRMLUnitNode &)
void Reset(vtkMRMLNode *defaultNode) override
Reimplemented to prevent reset if unit node is a singleton.
void ReadXMLAttributes(const char **atts) override
Set node attributes.
~vtkMRMLUnitNode() override
const char * GetQuantity()
virtual double GetDisplayValueFromValue(double value)
virtual const char * GetDisplayStringFromDisplayValueString(const char *displayValue)
std::string WrapValueWithSuffix(const std::string &value) const