Slicer
4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
Slicer logic for unit manipulation. More...
#include <Modules/Loadable/Units/Logic/vtkSlicerUnitsLogic.h>
Public Types | |
typedef vtkSlicerUnitsLogic | Self |
typedef vtkMRMLAbstractLogic | Superclass |
Public Types inherited from vtkMRMLAbstractLogic | |
typedef vtkObject | Superclass |
typedef void(vtkMRMLAbstractLogic::* | TaskFunctionPointer) (void *clientdata) |
Public Member Functions | |
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 const char * | GetClassName () |
vtkMRMLScene * | GetUnitsScene () const |
Get the scene with preset unit nodes in it. More... | |
virtual int | IsA (const char *type) |
virtual void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
void | SetDefaultUnit (const char *quantity, const char *id) |
Change the default unit for the corresponding quantity. More... | |
Public Member Functions inherited from vtkMRMLAbstractLogic | |
virtual vtkMRMLApplicationLogic * | GetMRMLApplicationLogic () const |
Get access to overall application state. More... | |
vtkMRMLScene * | GetMRMLScene () const |
Return a reference to the current MRML scene. More... | |
void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
virtual void | SetMRMLApplicationLogic (vtkMRMLApplicationLogic *logic) |
void | SetMRMLScene (vtkMRMLScene *newScene) |
Set and observe the MRMLScene. More... | |
Static Public Member Functions | |
static double | GetDisplayCoefficient (const char *displayPrefix, const char *valuePrefix="") |
Get the coefficient to transform a value and display it. More... | |
static double | GetSIPrefixCoefficient (const char *prefix) |
Get the coefficient associated with the given SI prefix name. More... | |
static int | IsTypeOf (const char *type) |
static vtkSlicerUnitsLogic * | New () |
static vtkSlicerUnitsLogic * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkMRMLAbstractLogic | |
static int | IsTypeOf (const char *type) |
static vtkMRMLAbstractLogic * | New () |
static vtkMRMLAbstractLogic * | SafeDownCast (vtkObject *o) |
Protected Member Functions | |
virtual void | AddBuiltInUnits (vtkMRMLScene *scene) |
Add the default units in the application scene. More... | |
virtual void | AddDefaultsUnits () |
Add the built in units in the units logic scene. More... | |
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. More... | |
virtual void | ObserveMRMLScene () VTK_OVERRIDE |
Reimplemented to initialize the scene with unit nodes. More... | |
virtual void | OnMRMLNodeModified (vtkMRMLNode *modifiedNode) VTK_OVERRIDE |
virtual void | OnMRMLSceneStartBatchProcess () VTK_OVERRIDE |
virtual void | RegisterNodes () VTK_OVERRIDE |
virtual void | RegisterNodesInternal (vtkMRMLScene *scene) |
void | RestoreDefaultUnits () |
void | SaveDefaultUnits () |
virtual void | SetMRMLSceneInternal (vtkMRMLScene *newScene) VTK_OVERRIDE |
Overloaded to add the defaults units in the application scene. More... | |
vtkSlicerUnitsLogic () | |
virtual | ~vtkSlicerUnitsLogic () |
Protected Member Functions inherited from vtkMRMLAbstractLogic | |
int | EndModify (bool wasModifying) |
virtual bool | EnterMRMLLogicsCallback () const |
virtual bool | EnterMRMLNodesCallback () const |
virtual bool | EnterMRMLSceneCallback () const |
bool | GetDisableModifiedEvent () const |
int | GetInMRMLLogicsCallbackFlag () const |
int | GetInMRMLNodesCallbackFlag () const |
int | GetInMRMLSceneCallbackFlag () const |
vtkCallbackCommand * | GetMRMLLogicsCallbackCommand () |
vtkObserverManager * | GetMRMLLogicsObserverManager () const |
vtkCallbackCommand * | GetMRMLNodesCallbackCommand () |
vtkObserverManager * | GetMRMLNodesObserverManager () const |
vtkCallbackCommand * | GetMRMLSceneCallbackCommand () |
vtkObserverManager * | GetMRMLSceneObserverManager () const |
int | GetPendingModifiedEventCount () const |
int | GetProcessingMRMLSceneEvent () const |
Return the event id currently processed or 0 if any. More... | |
int | InvokePendingModifiedEvent () |
virtual void | Modified () VTK_OVERRIDE |
virtual void | OnMRMLSceneEndBatchProcess () |
virtual void | OnMRMLSceneEndClose () |
virtual void | OnMRMLSceneEndImport () |
virtual void | OnMRMLSceneEndRestore () |
virtual void | OnMRMLSceneNew () |
virtual void | OnMRMLSceneNodeAdded (vtkMRMLNode *) |
virtual void | OnMRMLSceneNodeRemoved (vtkMRMLNode *) |
virtual void | OnMRMLSceneStartClose () |
virtual void | OnMRMLSceneStartImport () |
virtual void | OnMRMLSceneStartRestore () |
virtual void | ProcessMRMLLogicsEvents (vtkObject *caller, unsigned long event, void *callData) |
virtual void | ProcessMRMLNodesEvents (vtkObject *caller, unsigned long event, void *callData) |
virtual void | ProcessMRMLSceneEvents (vtkObject *caller, unsigned long event, void *callData) |
void | SetAndObserveMRMLSceneEventsInternal (vtkMRMLScene *newScene, vtkIntArray *events, vtkFloatArray *priorities=0) |
void | SetDisableModifiedEvent (bool onOff) |
void | SetInMRMLLogicsCallbackFlag (int flag) |
void | SetInMRMLNodesCallbackFlag (int flag) |
void | SetInMRMLSceneCallbackFlag (int flag) |
void | SetProcessingMRMLSceneEvent (int event) |
bool | StartModify () |
virtual void | UnobserveMRMLScene () |
virtual void | UpdateFromMRMLScene () |
vtkMRMLAbstractLogic () | |
virtual | ~vtkMRMLAbstractLogic () |
Protected Attributes | |
vtkMRMLScene * | UnitsScene |
Additional Inherited Members | |
Static Protected Member Functions inherited from vtkMRMLAbstractLogic | |
static void | MRMLLogicsCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLLogicCallback is a static function to relay modified events from the logics. More... | |
static void | MRMLNodesCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLNodesCallback is a static function to relay modified events from the nodes. More... | |
static void | MRMLSceneCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
Slicer logic for unit manipulation.
This class manages the logic associated with the units. It allows to create a new unit easily. The logic is in charge of calling a modify on the the selection node every time a current unit is modified so the listeners can update themselves.
Definition at line 42 of file vtkSlicerUnitsLogic.h.
Definition at line 47 of file vtkSlicerUnitsLogic.h.
Definition at line 48 of file vtkSlicerUnitsLogic.h.
|
protected |
|
protectedvirtual |
|
protectedvirtual |
Add the default units in the application scene.
|
protectedvirtual |
Add the built in units in the units logic scene.
vtkMRMLUnitNode* vtkSlicerUnitsLogic::AddUnitNode | ( | const char * | name, |
const char * | quantity = "length" , |
||
const char * | prefix = "" , |
||
const char * | suffix = "" , |
||
int | precision = 3 , |
||
double | min = -10000. , |
||
double | max = 10000. |
||
) |
Add unit node to the scene. Returns NULL if the logic has no scene.
|
protected |
Add a unit node to the given scene.
A unit node is defined by the following properties:
length
unit can be Millimeter
, Meter
or Centimeter
. Setting the node's name also sets the node's singleton tag.second
and day
is time
. This property is a Units node attribute so it can be easily observed by the GUI.
|
virtual |
Reimplemented from vtkMRMLAbstractLogic.
|
static |
Get the coefficient to transform a value and display it.
This function is used to conveniently compute the display coefficient expected by AddUnitNodeToScene().
The display coefficient is used to transform quantity values to a given unit.
By default, value for a given quantity are assumed to have no prefix. For example, this means that length
values are in meter
, time
values are in second
. In that case, the coefficient to transform quantity values to a given unit can be computed using GetDisplayCoefficient() specifying only the displayPrefix parameter.
If the quantity values are associated with a specific unit, the valuePrefix parameter should be provided. For example, in Slicer, since length
values are assumed to be in millimeter the display coefficient should be computed specifying milli
as valuePrefix.
prefix and basePrefix can be any value documented in GetSIPrefixCoefficient().
|
static |
Get the coefficient associated with the given SI prefix name.
Returns the coefficient for all prefix names defined in the International System of Units (SI) reported in the table below.
Otherwise, returns 1 if an empty name or an unknown prefix name is given.
Prefix | Coefficient |
---|---|
yotta | 10^24 (1000000000000000000000000) |
zetta | 10^21 (1000000000000000000000) |
exa | 10^18 (1000000000000000000) |
peta | 10^15 (1000000000000000) |
tera | 10^12 (1000000000000) |
giga | 10^9 (1000000000) |
mega | 10^6 (1000000) |
kilo | 10^3 (1000) |
hecto | 10^2 (100) |
deca | 10^1 (10) |
10^0 (1) | |
deci | 10^-1 (0.1) |
centi | 10^-2 (0.01) |
milli | 10^-3 (0.001) |
micro | 10^-6 (0.000001) |
nano | 10^-9 (0.000000001) |
pico | 10^-12 (0.000000000001) |
femto | 10^-15 (0.000000000000001) |
atto | 10^-18 (0.000000000000000001) |
zepto | 10^-21 (0.000000000000000000001) |
yocto | 10^-24 (0.000000000000000000000001) |
Source https://en.wikipedia.org/wiki/Metric_prefix#List_of_SI_prefixes
vtkMRMLScene* vtkSlicerUnitsLogic::GetUnitsScene | ( | ) | const |
Get the scene with preset unit nodes in it.
|
virtual |
Reimplemented from vtkMRMLAbstractLogic.
|
static |
|
static |
|
protectedvirtual |
Reimplemented to initialize the scene with unit nodes.
Reimplemented from vtkMRMLAbstractLogic.
|
protectedvirtual |
Reimplemented to restore the selection node unit nodes.
Reimplemented from vtkMRMLAbstractLogic.
|
protectedvirtual |
Reimplemented to save the selection node unit nodes.
Reimplemented from vtkMRMLAbstractLogic.
|
virtual |
|
protectedvirtual |
Register MRML Node classes to Scene. Gets called automatically when the MRMLScene is attached to this logic class.
Reimplemented from vtkMRMLAbstractLogic.
|
protectedvirtual |
|
protected |
Restore the saved default units referenced in the selection node singleton.
|
static |
|
protected |
Save the default units referenced in the selection node singleton.
void vtkSlicerUnitsLogic::SetDefaultUnit | ( | const char * | quantity, |
const char * | id | ||
) |
Change the default unit for the corresponding quantity.
|
protectedvirtual |
Overloaded to add the defaults units in the application scene.
Reimplemented from vtkMRMLAbstractLogic.
|
protected |
Definition at line 206 of file vtkSlicerUnitsLogic.h.