Slicer  4.13
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  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
40  //--------------------------------------------------------------------------
42  //--------------------------------------------------------------------------
43  vtkMRMLNode* CreateNodeInstance() override;
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 
87  const char* GetDisplayStringFormat();
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 
141 protected:
142  vtkMRMLUnitNode();
143  ~vtkMRMLUnitNode() override;
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...
virtual void ReadXMLAttributes(const char **atts)
void operator=(const vtkMRMLNode &)
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
virtual void Copy(vtkMRMLNode *node)
Copy node contents from another node of the same type. Does not copy node ID and Scene. Performs deep copy - an independent copy is created from all data, including bulk data.
std::string LastDisplayString
virtual void SetName(const char *)
Name of this node, to be set by the user.
virtual void WriteXML(ostream &of, int indent)
std::string LastValueString
void PrintSelf(ostream &os, vtkIndent indent) override
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
Node that holds the information about a unit.