Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 
33 class VTK_MRML_EXPORT vtkMRMLUnitNode : public vtkMRMLNode
34 {
35 public:
36  static vtkMRMLUnitNode *New();
38  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
39 
40  //--------------------------------------------------------------------------
42  //--------------------------------------------------------------------------
43  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
44 
47  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
48 
51  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
52 
55  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
56 
59  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "Unit";}
60 
62  virtual void Reset(vtkMRMLNode* defaultNode) VTK_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 
87  const char* GetDisplayStringFormat();
88 
92  virtual void SetName(const char* name) VTK_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 
141 protected:
142  vtkMRMLUnitNode();
143  virtual ~vtkMRMLUnitNode();
145  void operator=(const vtkMRMLUnitNode&);
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;
160  double MinimumValue;
161  double MaximumValue;
162 
165 
166  std::string LastValueString;
167  std::string LastDisplayString;
168 };
169 
170 #endif
virtual void Reset(vtkMRMLNode *defaultNode)
Reset node attributes to the initial state as defined in the constructor or the passed default node...
void operator=(const vtkMRMLNode &)
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
std::string LastDisplayString
virtual void SetName(const char *)
Name of this node, to be set by the user.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
std::string LastValueString
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
Node that holds the information about a unit.