Class vtkSlicerLayerDMLogic

Inheritance Relationships

Base Type

  • public vtkSlicerModuleLogic

Class Documentation

class vtkSlicerLayerDMLogic : public vtkSlicerModuleLogic

Inheritance diagram for vtkSlicerLayerDMLogic:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="vtkSlicerLayerDMLogic" tooltip="vtkSlicerLayerDMLogic" fillcolor="#BFBFBF"] "2" [label="vtkSlicerModuleLogic" tooltip="vtkSlicerModuleLogic"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for vtkSlicerLayerDMLogic:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="vtkSlicerLayerDMLogic" tooltip="vtkSlicerLayerDMLogic" fillcolor="#BFBFBF"] "2" [label="vtkSlicerModuleLogic" tooltip="vtkSlicerModuleLogic"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Logic class for the LayerDM module. Provides helper templates to simplify registering and accessing custom display nodes.

Unnamed Group

template<typename T>
static T *AddReferenceNode(vtkMRMLNode *node, T *nodeRef, const char *role)

Utility method change the node references of the input node using nodeRef and given role. If either the node or nodeRef is nullptr, does nothing. Will invoke a Modified event on the nodeRef after modification.

template<typename T>
static T *SetReferenceNode(vtkMRMLNode *node, T *nodeRef, const char *role)
template<typename T>
static T *SetNthReferenceNode(vtkMRMLNode *node, T *nodeRef, const char *role, int nthRef)

Public Functions

vtkTypeMacro(vtkSlicerLayerDMLogic, vtkSlicerModuleLogic)
vtkSlicerLayerDMLogic(const vtkSlicerLayerDMLogic&) = delete
void operator=(const vtkSlicerLayerDMLogic&) = delete
void RegisterNodes() override

Registers the LayerDM MRML nodes in the scene.

Public Static Functions

static vtkSlicerLayerDMLogic *New()
static int GetVersionMajor()
static int GetVersionMinor()
static int GetVersionPatch()
static std::string GetVersion()
static void SetWidgetEventTranslationNode(vtkMRMLNode *node, vtkMRMLLayerDMWidgetEventTranslationNode *translationNode)

Attach a translation node ref to the input node.

static vtkMRMLLayerDMWidgetEventTranslationNode *GetWidgetEventTranslationNode(vtkMRMLNode *node)
Returns:

the widget event translation node attached to the input node.

static vtkMRMLLayerDMWidgetEventTranslationNode *GetWidgetEventTranslationSingleton(vtkMRMLScene *scene, const std::string &singletonId)

Get the singleton translation node with given ID if it exists in the scene.

static vtkMRMLLayerDMWidgetEventTranslationNode *GetWidgetEventTranslationSingleton(vtkMRMLScene *scene, const std::string &singletonId, const std::function<void(vtkMRMLLayerDMWidgetEventTranslationNode*)> &configureF)

Get the singleton translation node with given ID if it exists in the scene. If it doesn’t exist in the scene, creates the singleton and configures the singleton given the input configure function.

static vtkMRMLLayerDMWidgetEventTranslationNode *CreateWidgetEventTranslationSingleton(vtkMRMLScene *scene, const std::string &singletonId)

Create a singleton translation node with given ID.

By default, the created singleton is set to not be saved with the scene to avoid changing interaction events when loading scenes coming from other users.

static void CreateDefaultEventTranslation(vtkMRMLNode *node, const std::string &singletonId, const std::function<void(vtkMRMLLayerDMWidgetEventTranslationNode*)> &configureF)

If the input node doesn’t have any translation node, sets the singleton TL node as TL node. If the singleton doesn’t yet exist in the scene, creates and initializes the TL node singleton given the input configure method.

If the node already has a TL node, does nothing. If the node doesn’t have a TL node and isn’t set in the Scene, does nothing.

static std::string GetEventTranslationRole()
Returns:

the role associated with widget event translation

static std::string GetDisplayRole()
Returns:

the role associated with display nodes (equivalent to vtkMRMLDisplayableNode::GetDisplayRole but non-virtual and static)

template<typename T>
static void RegisterNodeIfNeeded(vtkMRMLScene *scene)

Register node if the node isn’t already registered in the scene. Otherwise, registering multiple time the same node will overwrite the previous node and generate a warning.

template<typename T>
static T *GetDisplayNode(vtkMRMLNode *node)
Returns:

the first display node attached to the input displayable node with given type

template<typename T>
static T *GetReferenceNode(vtkMRMLNode *node, const char *role)
Returns:

the first reference node of given type attached to the input node with given role.

template<typename T>
static T *GetReferenceNode(vtkMRMLNode *node)
Returns:

the first reference node of given type attached to the input node with given role. Expects T to have a static T::GetReferenceRole method returning its reference role.

template<typename T>
static std::vector<T*> GetReferenceNodes(vtkMRMLNode *node, const char *role)
Returns:

all the reference nodes of given type attached to the input node with given role.

template<typename T>
static std::vector<T*> GetReferenceNodes(vtkMRMLNode *node)
Returns:

all the reference nodes of given type attached to the input node with given role. Expects T to have a static T::GetReferenceRole method returning its reference role.

template<typename T>
static T *CreateDisplayNode(vtkMRMLNode *node, bool allowMultiple = false)

Creates a display node of given type and attach it to the input node

Parameters:
  • node – instance of node for which the display node will be created. If the node is nullptr or not attached to a scene, will not create any node.

  • allowMultiple – when false, will return the existing display node if a display node of given type / role is already attached to the input node.

template<typename T>
static T *CreateReferenceNode(vtkMRMLNode *node, const char *role, bool allowMultiple = false)

Creates a reference node of given type and role and attach it to the input node.

Parameters:
  • node – instance of node for which the display node will be created. If the node is nullptr or not attached to a scene, will not create any node.

  • role – name of the role for the created and attached reference node. Role can be any arbitrary string.

  • allowMultiple – when false, will return the existing ref node if a ref node of given type / role is already attached to the input node.

template<typename T>
static T *CreateReferenceNode(vtkMRMLNode *node, bool allowMultiple = false)

Creates a reference node of given type and role and attach it to the input node.

Expects T to have a static T::GetReferenceRole method returning its reference role.

Parameters:
  • node – instance of node for which the display node will be created. If the node is nullptr or not attached to a scene, will not create any node.

  • allowMultiple – when false, will return the existing ref node if a ref node of given type / role is already attached to the input node.

Protected Functions

vtkSlicerLayerDMLogic() = default
~vtkSlicerLayerDMLogic() override = default