Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
vtkMRMLApplicationLogic Class Reference

#include <Libs/MRML/Logic/vtkMRMLApplicationLogic.h>

Inheritance diagram for vtkMRMLApplicationLogic:
Inheritance graph
[legend]
Collaboration diagram for vtkMRMLApplicationLogic:
Collaboration graph
[legend]

Classes

struct  InvokeRequest
 Structure passed as calldata pointer in the RequestEvent invoked event. More...
 

Public Types

enum  Events { RequestInvokeEvent = vtkCommand::UserEvent + 1, PauseRenderEvent = vtkCommand::UserEvent + 101, ResumeRenderEvent }
 List of custom events fired by the class. More...
 
enum  Layers { LabelLayer = 0x1, ForegroundLayer = 0x2, BackgroundLayer = 0x4, AllLayers = LabelLayer | ForegroundLayer | BackgroundLayer }
 
typedef vtkMRMLAbstractLogic Superclass
 
- Public Types inherited from vtkMRMLAbstractLogic
typedef vtkObject Superclass
 
typedef void(vtkMRMLAbstractLogic::* TaskFunctionPointer) (void *clientdata)
 

Public Member Functions

void FitSliceToAll (bool onlyIfPropagateVolumeSelectionAllowed=false)
 
virtual const char * GetClassName ()
 
vtkMRMLColorLogicGetColorLogic () const
 
vtkMRMLInteractionNodeGetInteractionNode () const
 Get default Interaction node. More...
 
vtkMRMLSelectionNodeGetSelectionNode () const
 Get default Selection node. More...
 
vtkMRMLSliceLogicGetSliceLogic (vtkMRMLSliceNode *sliceNode) const
 
vtkMRMLSliceLogicGetSliceLogicByLayoutName (const char *layoutName) const
 
vtkMRMLSliceLogicGetSliceLogicByModelDisplayNode (vtkMRMLModelDisplayNode *displayNode) const
 Get slice logic from slice model display node. More...
 
vtkCollection * GetSliceLogics () const
 
const char * GetTemporaryPath ()
 Return the temporary path that was set by the application. More...
 
vtkMRMLViewLogicGetViewLogic (vtkMRMLViewNode *viewNode) const
 
vtkMRMLViewLogicGetViewLogicByLayoutName (const char *layoutName) const
 
vtkCollection * GetViewLogics () const
 
void InvokeEventWithDelay (unsigned int delayInMs, vtkObject *caller, unsigned long eventID=vtkCommand::ModifiedEvent, void *callData=nullptr)
 Conveniently calls an InvokeEvent on an object with a delay. More...
 
virtual int IsA (const char *type)
 
bool OpenSlicerDataBundle (const char *sdbFilePath, const char *temporaryDirectory)
 
virtual void PauseRender ()
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
void PropagateBackgroundVolumeSelection (int fit=1)
 
void PropagateForegroundVolumeSelection (int fit=1)
 
void PropagateLabelVolumeSelection (int fit=1)
 
void PropagatePlotChartSelection ()
 Propagate selected PlotChart in the SelectionNode to Plot view nodes. More...
 
void PropagateTableSelection ()
 Propagate selected table in the SelectionNode to table view nodes. More...
 
void PropagateVolumeSelection (int fit=1)
 
void PropagateVolumeSelection (int layer, int fit)
 
virtual void ResumeRender ()
 
void SaveSceneScreenshot (vtkImageData *screenshot)
 
bool SaveSceneToSlicerDataBundleDirectory (const char *sdbDir, vtkImageData *screenShot=nullptr)
 
void SetColorLogic (vtkMRMLColorLogic *newColorLogic)
 
void SetSliceLogics (vtkCollection *sliceLogics)
 All the slice logics in the application. More...
 
void SetTemporaryPath (const char *path)
 Set the temporary path the logics can use. The path should be set by the application. More...
 
void SetViewLogics (vtkCollection *viewLogics)
 All the view logics in the application. More...
 
std::string UnpackSlicerDataBundle (const char *sdbFilePath, const char *temporaryDirectory)
 
bool Unzip (const char *zipFileName, const char *destinationDirectory)
 
bool Zip (const char *zipFileName, const char *directoryToZip)
 
- Public Member Functions inherited from vtkMRMLAbstractLogic
virtual vtkMRMLApplicationLogicGetMRMLApplicationLogic () const
 Get access to overall application state. More...
 
vtkMRMLSceneGetMRMLScene () const
 Return a reference to the current MRML scene. More...
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
virtual void SetMRMLApplicationLogic (vtkMRMLApplicationLogic *logic)
 
void SetMRMLScene (vtkMRMLScene *newScene)
 Set and observe the MRMLScene. More...
 

Static Public Member Functions

static std::string CreateUniqueFileName (const std::string &filename, const std::string &knownExtension="")
 
static int IsTypeOf (const char *type)
 
static int LoadDefaultParameterSets (vtkMRMLScene *scene, const std::vector< std::string > &directories)
 
static vtkMRMLApplicationLogicNew ()
 
static std::string PercentEncode (std::string s)
 
static vtkMRMLApplicationLogicSafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkMRMLAbstractLogic
static int IsTypeOf (const char *type)
 
static vtkMRMLAbstractLogicNew ()
 
static vtkMRMLAbstractLogicSafeDownCast (vtkObject *o)
 

Protected Member Functions

void SaveStorableNodeToSlicerDataBundleDirectory (vtkMRMLStorableNode *storableNode, std::string &dataDir)
 
void SetInteractionNode (vtkMRMLInteractionNode *)
 
void SetMRMLSceneInternal (vtkMRMLScene *newScene) override
 
void SetSelectionNode (vtkMRMLSelectionNode *)
 
 vtkMRMLApplicationLogic ()
 
 ~vtkMRMLApplicationLogic () override
 
- 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 ()
 
vtkObserverManagerGetMRMLLogicsObserverManager () const
 
vtkCallbackCommand * GetMRMLNodesCallbackCommand ()
 
vtkObserverManagerGetMRMLNodesObserverManager () const
 
vtkCallbackCommand * GetMRMLSceneCallbackCommand ()
 
vtkObserverManagerGetMRMLSceneObserverManager () const
 
int GetPendingModifiedEventCount () const
 
int GetProcessingMRMLSceneEvent () const
 Return the event id currently processed or 0 if any. More...
 
int InvokePendingModifiedEvent ()
 
void Modified () override
 
virtual void ObserveMRMLScene ()
 
virtual void OnMRMLNodeModified (vtkMRMLNode *)
 
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 OnMRMLSceneStartBatchProcess ()
 
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)
 
virtual void RegisterNodes ()
 
void SetAndObserveMRMLSceneEventsInternal (vtkMRMLScene *newScene, vtkIntArray *events, vtkFloatArray *priorities=nullptr)
 
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 ()
 
 ~vtkMRMLAbstractLogic () override
 

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)
 

Detailed Description

Definition at line 47 of file vtkMRMLApplicationLogic.h.

Member Typedef Documentation

◆ Superclass

Definition at line 54 of file vtkMRMLApplicationLogic.h.

Member Enumeration Documentation

◆ Events

List of custom events fired by the class.

Enumerator
RequestInvokeEvent 
PauseRenderEvent 
ResumeRenderEvent 

Definition at line 187 of file vtkMRMLApplicationLogic.h.

◆ Layers

Enumerator
LabelLayer 
ForegroundLayer 
BackgroundLayer 
AllLayers 

Definition at line 114 of file vtkMRMLApplicationLogic.h.

Constructor & Destructor Documentation

◆ vtkMRMLApplicationLogic()

vtkMRMLApplicationLogic::vtkMRMLApplicationLogic ( )
protected

◆ ~vtkMRMLApplicationLogic()

vtkMRMLApplicationLogic::~vtkMRMLApplicationLogic ( )
overrideprotected

Member Function Documentation

◆ CreateUniqueFileName()

static std::string vtkMRMLApplicationLogic::CreateUniqueFileName ( const std::string &  filename,
const std::string &  knownExtension = "" 
)
static

Creates a unique (non-existent) file name by adding an index after base file name. knownExtension specifies the extension the index should be inserted before. It is necessary to provide extension, because there is no reliable way of correctly determining extension automatically (for example, file extension of some.file.nii.gz could be gz, nii.gz, or file.nii.gz and only one of them is correct).

◆ FitSliceToAll()

void vtkMRMLApplicationLogic::FitSliceToAll ( bool  onlyIfPropagateVolumeSelectionAllowed = false)

Fit all the volumes into their views If onlyIfPropagateVolumeSelectionAllowed is true then field of view will be reset on only those slices where propagate volume selection is allowed

◆ GetClassName()

virtual const char* vtkMRMLApplicationLogic::GetClassName ( )
virtual

Reimplemented from vtkMRMLAbstractLogic.

Reimplemented in vtkSlicerApplicationLogic.

◆ GetColorLogic()

vtkMRMLColorLogic* vtkMRMLApplicationLogic::GetColorLogic ( ) const

◆ GetInteractionNode()

vtkMRMLInteractionNode* vtkMRMLApplicationLogic::GetInteractionNode ( ) const

Get default Interaction node.

◆ GetSelectionNode()

vtkMRMLSelectionNode* vtkMRMLApplicationLogic::GetSelectionNode ( ) const

Get default Selection node.

◆ GetSliceLogic()

vtkMRMLSliceLogic* vtkMRMLApplicationLogic::GetSliceLogic ( vtkMRMLSliceNode sliceNode) const

◆ GetSliceLogicByLayoutName()

vtkMRMLSliceLogic* vtkMRMLApplicationLogic::GetSliceLogicByLayoutName ( const char *  layoutName) const

◆ GetSliceLogicByModelDisplayNode()

vtkMRMLSliceLogic* vtkMRMLApplicationLogic::GetSliceLogicByModelDisplayNode ( vtkMRMLModelDisplayNode displayNode) const

Get slice logic from slice model display node.

◆ GetSliceLogics()

vtkCollection* vtkMRMLApplicationLogic::GetSliceLogics ( ) const

◆ GetTemporaryPath()

const char* vtkMRMLApplicationLogic::GetTemporaryPath ( )

Return the temporary path that was set by the application.

◆ GetViewLogic()

vtkMRMLViewLogic* vtkMRMLApplicationLogic::GetViewLogic ( vtkMRMLViewNode viewNode) const

◆ GetViewLogicByLayoutName()

vtkMRMLViewLogic* vtkMRMLApplicationLogic::GetViewLogicByLayoutName ( const char *  layoutName) const

◆ GetViewLogics()

vtkCollection* vtkMRMLApplicationLogic::GetViewLogics ( ) const

◆ InvokeEventWithDelay()

void vtkMRMLApplicationLogic::InvokeEventWithDelay ( unsigned int  delayInMs,
vtkObject *  caller,
unsigned long  eventID = vtkCommand::ModifiedEvent,
void *  callData = nullptr 
)

Conveniently calls an InvokeEvent on an object with a delay.

◆ IsA()

virtual int vtkMRMLApplicationLogic::IsA ( const char *  type)
virtual

Reimplemented from vtkMRMLAbstractLogic.

Reimplemented in vtkSlicerApplicationLogic.

◆ IsTypeOf()

static int vtkMRMLApplicationLogic::IsTypeOf ( const char *  type)
static

◆ LoadDefaultParameterSets()

static int vtkMRMLApplicationLogic::LoadDefaultParameterSets ( vtkMRMLScene scene,
const std::vector< std::string > &  directories 
)
static

Load any default parameter sets into the specified scene Returns the total number of loaded parameter sets

◆ New()

static vtkMRMLApplicationLogic* vtkMRMLApplicationLogic::New ( )
static

◆ OpenSlicerDataBundle()

bool vtkMRMLApplicationLogic::OpenSlicerDataBundle ( const char *  sdbFilePath,
const char *  temporaryDirectory 
)

Open the file into a temp directory and load the scene file inside. Note that the first mrml file found in the extracted directory will be used.

◆ PauseRender()

virtual void vtkMRMLApplicationLogic::PauseRender ( )
virtual

Pauses rendering for all views in the current layout. It should be used in situations where multiple nodes are modified, and it is undesirable to display an intermediate state. The caller is responsible for making sure that each PauseRender() is paired with ResumeRender().

See also
vtkMRMLApplicationLogic::ResumeRender()
qSlicerApplication::setRenderPaused()

◆ PercentEncode()

static std::string vtkMRMLApplicationLogic::PercentEncode ( std::string  s)
static

Convert reserved characters into percent notation to avoid issues with filenames containing things that might be mistaken, for example, for windows drive letters. Used internally by SaveSceneToSlicerDataBundleDirectory. This is not a general purpose implementation; it preseves commonly used characters for filenames but avoids known issue like slashes or colons. Ideally a version from vtksys or similar should be used, but nothing seems to be available. http://en.wikipedia.org/wiki/Percent-encoding See http://na-mic.org/Bug/view.php?id=2605

◆ PrintSelf()

void vtkMRMLApplicationLogic::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
override

◆ PropagateBackgroundVolumeSelection()

void vtkMRMLApplicationLogic::PropagateBackgroundVolumeSelection ( int  fit = 1)

Propagate only active background volume in the SelectionNode to slice composite nodes

See also
FitSliceToAll()
vtkMRMLSelectionNode::SetActiveVolumeID()
Layers::BackgroundLayer

◆ PropagateForegroundVolumeSelection()

void vtkMRMLApplicationLogic::PropagateForegroundVolumeSelection ( int  fit = 1)

Propagate only active foreground volume in the SelectionNode to slice composite nodes

See also
FitSliceToAll()
vtkMRMLSelectionNode::SetSecondaryVolumeID()
Layers::ForegroundLayer

◆ PropagateLabelVolumeSelection()

void vtkMRMLApplicationLogic::PropagateLabelVolumeSelection ( int  fit = 1)

Propagate only active label volume in the SelectionNode to slice composite nodes

See also
FitSliceToAll()
vtkMRMLSelectionNode::SetActiveLabelVolumeID()
Layers::LabelLayer

◆ PropagatePlotChartSelection()

void vtkMRMLApplicationLogic::PropagatePlotChartSelection ( )

Propagate selected PlotChart in the SelectionNode to Plot view nodes.

◆ PropagateTableSelection()

void vtkMRMLApplicationLogic::PropagateTableSelection ( )

Propagate selected table in the SelectionNode to table view nodes.

◆ PropagateVolumeSelection() [1/2]

void vtkMRMLApplicationLogic::PropagateVolumeSelection ( int  fit = 1)

Apply the active volumes in the SelectionNode to the slice composite nodes Perform the default behavior related to selecting a volume (in this case, making it the background for all SliceCompositeNodes)

See also
vtkInternal::PropagateVolumeSelection()
FitSliceToAll()
vtkMRMLSelectionNode::SetActiveVolumeID()
vtkMRMLSelectionNode::SetSecondaryVolumeID()
vtkMRMLSelectionNode::SetActiveLabelVolumeID()

◆ PropagateVolumeSelection() [2/2]

void vtkMRMLApplicationLogic::PropagateVolumeSelection ( int  layer,
int  fit 
)

Propagate selected volume layer in the SelectionNode to the slice composite nodes.

See also
Layers

◆ ResumeRender()

virtual void vtkMRMLApplicationLogic::ResumeRender ( )
virtual

Resumes rendering for all views in the current layout.

See also
vtkMRMLApplicationLogic::PauseRender()
qSlicerApplication::setRenderPaused()

◆ SafeDownCast()

static vtkMRMLApplicationLogic* vtkMRMLApplicationLogic::SafeDownCast ( vtkObject *  o)
static

◆ SaveSceneScreenshot()

void vtkMRMLApplicationLogic::SaveSceneScreenshot ( vtkImageData *  screenshot)

Saves the provided image as screenshot of the scene (same filepath as the scene URL but extension is .png instead of .mrml). Uses current scene's URL property, so the URL must be up-to-date when calling this method.

◆ SaveSceneToSlicerDataBundleDirectory()

bool vtkMRMLApplicationLogic::SaveSceneToSlicerDataBundleDirectory ( const char *  sdbDir,
vtkImageData *  screenShot = nullptr 
)

Save the scene into a self contained directory, sdbDir Called by the qSlicerSceneWriter, which can be accessed via

See also
qSlicerCoreIOManager::saveScene If screenShot is not null, use it as the screen shot for a scene view Returns false if the save failed

◆ SaveStorableNodeToSlicerDataBundleDirectory()

void vtkMRMLApplicationLogic::SaveStorableNodeToSlicerDataBundleDirectory ( vtkMRMLStorableNode storableNode,
std::string &  dataDir 
)
protected

◆ SetColorLogic()

void vtkMRMLApplicationLogic::SetColorLogic ( vtkMRMLColorLogic newColorLogic)

Set/Get color logic. The application typically sets a custom color logic (i.e. vtkSlicerColorLogic) that contains default color nodes. By default, a vtkMRMLColorLogic is instantiated.

◆ SetInteractionNode()

void vtkMRMLApplicationLogic::SetInteractionNode ( vtkMRMLInteractionNode )
protected

◆ SetMRMLSceneInternal()

void vtkMRMLApplicationLogic::SetMRMLSceneInternal ( vtkMRMLScene newScene)
overrideprotectedvirtual

Called each time a new scene is set. Can be reimplemented in derivated classes. Doesn't observe the scene by default, that means that UpdateFromMRMLScene() won't be called by default when a scene is imported, closed or restored, only when a new scene is set.

See also
SetAndObserveMRMLSceneInternal() SetAndObserveMRMLSceneEventsInternal()
UpdateFromMRMLScene()

Reimplemented from vtkMRMLAbstractLogic.

◆ SetSelectionNode()

void vtkMRMLApplicationLogic::SetSelectionNode ( vtkMRMLSelectionNode )
protected

◆ SetSliceLogics()

void vtkMRMLApplicationLogic::SetSliceLogics ( vtkCollection *  sliceLogics)

All the slice logics in the application.

◆ SetTemporaryPath()

void vtkMRMLApplicationLogic::SetTemporaryPath ( const char *  path)

Set the temporary path the logics can use. The path should be set by the application.

◆ SetViewLogics()

void vtkMRMLApplicationLogic::SetViewLogics ( vtkCollection *  viewLogics)

All the view logics in the application.

◆ UnpackSlicerDataBundle()

std::string vtkMRMLApplicationLogic::UnpackSlicerDataBundle ( const char *  sdbFilePath,
const char *  temporaryDirectory 
)

Unpack the file into a temp directory and return the scene file inside. Note that the first mrml file found in the extracted directory will be used.

◆ Unzip()

bool vtkMRMLApplicationLogic::Unzip ( const char *  zipFileName,
const char *  destinationDirectory 
)

unzip the zip file to the current working directory Returns success or failure.

◆ Zip()

bool vtkMRMLApplicationLogic::Zip ( const char *  zipFileName,
const char *  directoryToZip 
)

zip the directory into a zip file Returns success or failure.


The documentation for this class was generated from the following file: