21#ifndef __vtkSlicerUnitsLogic_h
22#define __vtkSlicerUnitsLogic_h
30#include "vtkSlicerUnitsModuleLogicExport.h"
47 void PrintSelf(ostream& os, vtkIndent indent)
override;
52 AddUnitNode(
const char* name,
const char* quantity =
"length",
const char* prefix =
"",
const char* suffix =
"",
int precision = 3,
double min = -10000.,
double max = 10000.);
183 const char* quantity =
"length",
184 const char* prefix =
"",
185 const char* suffix =
"",
187 double min = -10000.,
189 double displayCoeff = 1.0,
190 double displayOffset = 0.0);
211 std::map<std::string, std::string> CachedDefaultUnits;
215 bool RestoringDefaultUnits;
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
Node that holds the information about a unit.
static double GetSIPrefixCoefficient(const char *prefix)
Get the coefficient associated with the given SI prefix name.
void OnMRMLSceneStartBatchProcess() override
static double GetDisplayCoefficient(const char *displayPrefix, const char *valuePrefix="", double power=1)
Get the coefficient to transform a value and display it.
static vtkSlicerUnitsLogic * New()
virtual void AddBuiltInUnits(vtkMRMLScene *scene)
Add the default units in the application scene.
void SetMRMLSceneInternal(vtkMRMLScene *newScene) override
Overloaded to add the defaults units in the application scene.
vtkMRMLScene * GetUnitsScene() const
Get the scene with preset unit nodes in it.
vtkMRMLUnitNode * AddUnitNodeToScene(vtkMRMLScene *scene, const char *name, const char *quantity="length", const char *prefix="", const char *suffix="", int precision=3, double min=-10000., double max=10000., double displayCoeff=1.0, double displayOffset=0.0)
Add a unit node to the given scene.
void UpdateFromMRMLScene() override
void SetDefaultUnit(const char *quantity, const char *id)
Change the default unit for the corresponding quantity.
virtual void RegisterNodesInternal(vtkMRMLScene *scene)
void OnMRMLNodeModified(vtkMRMLNode *modifiedNode) override
vtkMRMLUnitNode * AddUnitNode(const char *name, const char *quantity="length", const char *prefix="", const char *suffix="", int precision=3, double min=-10000., double max=10000.)
virtual void AddDefaultsUnits()
Add the built in units in the units logic scene.
void RestoreDefaultUnits()
void RegisterNodes() override
void PrintSelf(ostream &os, vtkIndent indent) override
void ObserveMRMLScene() override
Reimplemented to initialize the scene with unit nodes.
~vtkSlicerUnitsLogic() override
vtkMRMLScene * UnitsScene