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

#include <Base/Logic/vtkSlicerApplicationLogic.h>

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

Public Types

enum  RequestEvents { RequestModifiedEvent = vtkMRMLApplicationLogic::RequestInvokeEvent + 1, RequestReadDataEvent, RequestWriteDataEvent, RequestProcessedEvent }
 List of events potentially fired by the application logic. More...
 
typedef vtkMRMLApplicationLogic Superclass
 
- Public Types inherited from vtkMRMLApplicationLogic
enum  Events { RequestInvokeEvent = vtkCommand::UserEvent + 1 }
 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 CreateProcessingThread ()
 Create a thread for processing. More...
 
virtual const char * GetClassName ()
 
unsigned int GetReadDataQueueSize ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE
 
void ProcessModified ()
 
void ProcessReadData ()
 
void ProcessWriteData ()
 Process a request to write data from a referenced node. More...
 
void PropagateFiducialListSelection ()
 
vtkMTimeType RequestModified (vtkObject *)
 
vtkMTimeType RequestReadFile (const char *refNode, const char *filename, int displayData=false, int deleteFile=false)
 
vtkMTimeType RequestReadScene (const std::string &filename, std::vector< std::string > &targetIDs, std::vector< std::string > &sourceIDs, int displayData=false, int deleteFile=false)
 
vtkMTimeType RequestUpdateParentTransform (const std::string &updatedNode, const std::string &parentTransformNode)
 
vtkMTimeType RequestUpdateSubjectHierarchyLocation (const std::string &updatedNode, const std::string &siblingNode)
 
vtkMTimeType RequestWriteData (const char *refNode, const char *filename)
 
int ScheduleTask (vtkSlicerTask *)
 
void SetMRMLSceneDataIO (vtkMRMLScene *scene, vtkMRMLRemoteIOLogic *remoteIOLogic, vtkDataIOManagerLogic *dataIOManagerLogic)
 
void SetTracingOff ()
 
void SetTracingOn ()
 
void TerminateProcessingThread ()
 Shutdown the processing thread. More...
 
- Public Member Functions inherited from vtkMRMLApplicationLogic
void FitSliceToAll (bool onlyIfPropagateVolumeSelectionAllowed=false)
 
vtkMRMLColorLogicGetColorLogic () const
 
vtkMRMLInteractionNodeGetInteractionNode () const
 Get current Interaction node. More...
 
vtkMRMLModelHierarchyLogicGetModelHierarchyLogic () const
 Get ModelHierarchyLogic. More...
 
vtkMRMLSelectionNodeGetSelectionNode () const
 Get current 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...
 
void InvokeEventWithDelay (unsigned int delayInMs, vtkObject *caller, unsigned long eventID=vtkCommand::ModifiedEvent, void *callData=0)
 Conveniently calls an InvokeEvent on an object with a delay. More...
 
bool OpenSlicerDataBundle (const char *sdbFilePath, const char *temporaryDirectory)
 
std::string PercentEncode (std::string s)
 
void PrintSelf (ostream &os, vtkIndent indent) VTK_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)
 
bool SaveSceneToSlicerDataBundleDirectory (const char *sdbDir, vtkImageData *screenShot=NULL)
 
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...
 
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) VTK_OVERRIDE
 
virtual void SetMRMLApplicationLogic (vtkMRMLApplicationLogic *logic)
 
void SetMRMLScene (vtkMRMLScene *newScene)
 Set and observe the MRMLScene. More...
 

Static Public Member Functions

static std::string GetModuleShareDirectory (const std::string &moduleName, const std::string &filePath)
 Get share directory associated with moduleName located in filePath. More...
 
static std::string GetModuleSlicerXYLibDirectory (const std::string &filePath)
 Get Slicer-X.Y lib directory associated with module located in filePath. More...
 
static std::string GetModuleSlicerXYShareDirectory (const std::string &filePath)
 Get Slicer-X.Y share directory associated with module located in filePath. More...
 
static bool IsEmbeddedModule (const std::string &filePath, const std::string &applicationHomeDir, const std::string &slicerRevision)
 
static bool IsPluginBuiltIn (const std::string &filePath, const std::string &applicationHomeDir)
 Return true if the plugin identified with its filePath is a built-in Slicer module. More...
 
static bool IsPluginInstalled (const std::string &filePath, const std::string &applicationHomeDir)
 
static int IsTypeOf (const char *type)
 
static vtkSlicerApplicationLogicNew ()
 The Usual vtk class functions. More...
 
static vtkSlicerApplicationLogicSafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkMRMLApplicationLogic
static std::string CreateUniqueFileName (std::string &filename)
 Creates a unique non-existant file name by adding an index after base file name. More...
 
static int IsTypeOf (const char *type)
 
static int LoadDefaultParameterSets (vtkMRMLScene *scene, const std::vector< std::string > &directories)
 
static vtkMRMLApplicationLogicNew ()
 
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 ProcessNetworkingTasks ()
 Networking Task processing loop that is run in a networking thread. More...
 
void ProcessProcessingTasks ()
 Task processing loop that is run in the processing thread. More...
 
void ProcessReadSceneData (ReadDataRequest &req)
 
void ProcessWriteSceneData (WriteDataRequest &req)
 
 vtkSlicerApplicationLogic ()
 
 ~vtkSlicerApplicationLogic ()
 
- Protected Member Functions inherited from vtkMRMLApplicationLogic
void SaveStorableNodeToSlicerDataBundleDirectory (vtkMRMLStorableNode *storableNode, std::string &dataDir)
 
void SetInteractionNode (vtkMRMLInteractionNode *)
 
virtual void SetMRMLSceneInternal (vtkMRMLScene *newScene) VTK_OVERRIDE
 
void SetSelectionNode (vtkMRMLSelectionNode *)
 
 vtkMRMLApplicationLogic ()
 
virtual ~vtkMRMLApplicationLogic ()
 
- 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 ()
 
virtual void Modified () VTK_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=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 ()
 

Static Protected Member Functions

static ITK_THREAD_RETURN_TYPE NetworkingThreaderCallback (void *)
 Callback used by a MultiThreader to start a networking thread. More...
 
static ITK_THREAD_RETURN_TYPE ProcessingThreaderCallback (void *)
 Callback used by a MultiThreader to start a processing thread. More...
 
- 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 46 of file vtkSlicerApplicationLogic.h.

Member Typedef Documentation

◆ Superclass

Definition at line 53 of file vtkSlicerApplicationLogic.h.

Member Enumeration Documentation

◆ RequestEvents

List of events potentially fired by the application logic.

Enumerator
RequestModifiedEvent 
RequestReadDataEvent 
RequestWriteDataEvent 
RequestProcessedEvent 

Event fired when a readData, writeData or readScene request has been processed. The uid of the request is passed as callData.

Todo:
Add support for "modified" request.

Definition at line 78 of file vtkSlicerApplicationLogic.h.

Constructor & Destructor Documentation

◆ vtkSlicerApplicationLogic()

vtkSlicerApplicationLogic::vtkSlicerApplicationLogic ( )
protected

◆ ~vtkSlicerApplicationLogic()

vtkSlicerApplicationLogic::~vtkSlicerApplicationLogic ( )
protected

Member Function Documentation

◆ CreateProcessingThread()

void vtkSlicerApplicationLogic::CreateProcessingThread ( )

Create a thread for processing.

◆ GetClassName()

virtual const char* vtkSlicerApplicationLogic::GetClassName ( )
virtual

Reimplemented from vtkMRMLApplicationLogic.

◆ GetModuleShareDirectory()

static std::string vtkSlicerApplicationLogic::GetModuleShareDirectory ( const std::string &  moduleName,
const std::string &  filePath 
)
static

Get share directory associated with moduleName located in filePath.

◆ GetModuleSlicerXYLibDirectory()

static std::string vtkSlicerApplicationLogic::GetModuleSlicerXYLibDirectory ( const std::string &  filePath)
static

Get Slicer-X.Y lib directory associated with module located in filePath.

◆ GetModuleSlicerXYShareDirectory()

static std::string vtkSlicerApplicationLogic::GetModuleSlicerXYShareDirectory ( const std::string &  filePath)
static

Get Slicer-X.Y share directory associated with module located in filePath.

◆ GetReadDataQueueSize()

unsigned int vtkSlicerApplicationLogic::GetReadDataQueueSize ( )

Return the number of items that need to be read from the queue (this allows code that invokes command line modules to know when multiple items are being returned and have all been returned).

◆ IsA()

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

Reimplemented from vtkMRMLApplicationLogic.

◆ IsEmbeddedModule()

static bool vtkSlicerApplicationLogic::IsEmbeddedModule ( const std::string &  filePath,
const std::string &  applicationHomeDir,
const std::string &  slicerRevision 
)
static

Return True if filePath is a descendant of applicationHomeDir.

Note
On MacOSX extensions are installed in the "<Slicer_EXTENSIONS_DIRBASENAME>-<slicerRevision>" folder being a sub directory of the application dir, an extra test is performed to make sure the tested filePath doesn't belong to that "<Slicer_EXTENSIONS_DIRBASENAME>-<slicerRevision>" folder. If this is the case, False will be returned.

◆ IsPluginBuiltIn()

static bool vtkSlicerApplicationLogic::IsPluginBuiltIn ( const std::string &  filePath,
const std::string &  applicationHomeDir 
)
static

Return true if the plugin identified with its filePath is a built-in Slicer module.

◆ IsPluginInstalled()

static bool vtkSlicerApplicationLogic::IsPluginInstalled ( const std::string &  filePath,
const std::string &  applicationHomeDir 
)
static

Return true if the plugin identified with its filePath is loaded from an install tree.

Warning
Since internally the function looks for the existence of CMakeCache.txt, it will return an incorrect result if the plugin is installed in the build tree of an other project.

◆ IsTypeOf()

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

◆ NetworkingThreaderCallback()

static ITK_THREAD_RETURN_TYPE vtkSlicerApplicationLogic::NetworkingThreaderCallback ( void *  )
staticprotected

Callback used by a MultiThreader to start a networking thread.

◆ New()

static vtkSlicerApplicationLogic* vtkSlicerApplicationLogic::New ( )
static

The Usual vtk class functions.

◆ PrintSelf()

void vtkSlicerApplicationLogic::PrintSelf ( ostream &  os,
vtkIndent  indent 
)

◆ ProcessingThreaderCallback()

static ITK_THREAD_RETURN_TYPE vtkSlicerApplicationLogic::ProcessingThreaderCallback ( void *  )
staticprotected

Callback used by a MultiThreader to start a processing thread.

◆ ProcessModified()

void vtkSlicerApplicationLogic::ProcessModified ( )

Process a request on the Modified queue. This method is called in the main thread of the application because calls to Modified() can cause an update to the GUI. (Method needs to be public to fit in the event callback chain.)

◆ ProcessNetworkingTasks()

void vtkSlicerApplicationLogic::ProcessNetworkingTasks ( )
protected

Networking Task processing loop that is run in a networking thread.

◆ ProcessProcessingTasks()

void vtkSlicerApplicationLogic::ProcessProcessingTasks ( )
protected

Task processing loop that is run in the processing thread.

◆ ProcessReadData()

void vtkSlicerApplicationLogic::ProcessReadData ( )

Process a request to read data and set it on a referenced node. This method is called in the main thread of the application because calls to load data will cause a Modified() on a node which can force a render.

◆ ProcessReadSceneData()

void vtkSlicerApplicationLogic::ProcessReadSceneData ( ReadDataRequest &  req)
protected

Process a request to read data into a scene. This method is called by ProcessReadData() in the application main thread because calls to load data will cause a Modified() on a node which can force a render.

◆ ProcessWriteData()

void vtkSlicerApplicationLogic::ProcessWriteData ( )

Process a request to write data from a referenced node.

◆ ProcessWriteSceneData()

void vtkSlicerApplicationLogic::ProcessWriteSceneData ( WriteDataRequest &  req)
protected

◆ PropagateFiducialListSelection()

void vtkSlicerApplicationLogic::PropagateFiducialListSelection ( )

Perform the default behaviour related to selecting a fiducial list (display it in the Fiducials GUI)

◆ RequestModified()

vtkMTimeType vtkSlicerApplicationLogic::RequestModified ( vtkObject *  )

Request a Modified call on an object. This method allows a processing thread to request a Modified call on an object to be performed in the main thread. This allows the call to Modified to trigger GUI changes. RequestModified() is called from the processing thread to modify an object in the main thread. Return the request UID (monotonically increasing) of the request or 0 if the request failed to be registered.

Todo:
Fire RequestProcessedEvent when processing Modified requests.
See also
RequestReadData(), RequestWriteData()

◆ RequestReadFile()

vtkMTimeType vtkSlicerApplicationLogic::RequestReadFile ( const char *  refNode,
const char *  filename,
int  displayData = false,
int  deleteFile = false 
)

Request that data be read from a file and set it on the referenced node. The request will be sent to the main thread which will be responsible for reading the data, setting it on the referenced node, and updating the display. Return the request UID (monotonically increasing) of the request or 0 if the request failed to be registered. When the request is processed, RequestProcessedEvent is invoked with the request UID as calldata.

See also
RequestReadScene(), RequestWriteData(), RequestModified()

◆ RequestReadScene()

vtkMTimeType vtkSlicerApplicationLogic::RequestReadScene ( const std::string &  filename,
std::vector< std::string > &  targetIDs,
std::vector< std::string > &  sourceIDs,
int  displayData = false,
int  deleteFile = false 
)

Request that a scene be read from a file. Mappings of node IDs in the file (sourceIDs) to node IDs in the main scene (targetIDs) can be specified. Only nodes listed in sourceIDs are loaded back into the main scene. Hierarchical nodes will be handled specially, in that only the top node needs to be listed in the sourceIds. Return the request UID (monotonically increasing) of the request or 0 if the request failed to be registered. When the request is processed, RequestProcessedEvent is invoked with the request UID as calldata.

See also
RequestReadData(), RequestWriteData()

◆ RequestUpdateParentTransform()

vtkMTimeType vtkSlicerApplicationLogic::RequestUpdateParentTransform ( const std::string &  updatedNode,
const std::string &  parentTransformNode 
)

Request setting of parent transform. The request will executed on the main thread. Return the request UID (monotonically increasing) of the request or 0 if the request failed to be registered. When the request is processed, RequestProcessedEvent is invoked with the request UID as calldata.

See also
RequestReadScene(), RequestWriteData(), RequestModified()

◆ RequestUpdateSubjectHierarchyLocation()

vtkMTimeType vtkSlicerApplicationLogic::RequestUpdateSubjectHierarchyLocation ( const std::string &  updatedNode,
const std::string &  siblingNode 
)

Request setting of subject hierarchy location (will have the same parent and same level as sibling node). The request will executed on the main thread. Return the request UID (monotonically increasing) of the request or 0 if the request failed to be registered. When the request is processed, RequestProcessedEvent is invoked with the request UID as calldata.

See also
RequestReadScene(), RequestWriteData(), RequestModified()

◆ RequestWriteData()

vtkMTimeType vtkSlicerApplicationLogic::RequestWriteData ( const char *  refNode,
const char *  filename 
)

Request that data be written from a file to a remote destination. Return the request UID (monotonically increasing) of the request or 0 if the request failed to be registered. When the request is processed, RequestProcessedEvent is invoked with the request UID as calldata.

See also
RequestReadData(), RequestReadScene()

◆ SafeDownCast()

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

◆ ScheduleTask()

int vtkSlicerApplicationLogic::ScheduleTask ( vtkSlicerTask )

Schedule a task to run in the processing thread. Returns true if task was successfully scheduled. ScheduleTask() is called from the main thread to run something in the processing thread.

◆ SetMRMLSceneDataIO()

void vtkSlicerApplicationLogic::SetMRMLSceneDataIO ( vtkMRMLScene scene,
vtkMRMLRemoteIOLogic remoteIOLogic,
vtkDataIOManagerLogic dataIOManagerLogic 
)

Update the data IO, local and remote, with the new scene For stand alone applications, follow the set up steps in qSlicerCoreApplicationPrivate::initDataIO() to set up the remote IO logic and data manager logic and then call this method to hook them into the scene.

See also
qSlicerCoreApplicationPrivate::initDataIO()
vtkMRMLRemoteIOLogic::AddDataIOToScene()

◆ SetTracingOff()

void vtkSlicerApplicationLogic::SetTracingOff ( )
inline

Definition at line 181 of file vtkSlicerApplicationLogic.h.

◆ SetTracingOn()

void vtkSlicerApplicationLogic::SetTracingOn ( )
inline

These routings act as place holders so that test scripts can turn on and off tracing. These are just hooks for use with external tracing tool (such as AQTime)

Definition at line 180 of file vtkSlicerApplicationLogic.h.

◆ TerminateProcessingThread()

void vtkSlicerApplicationLogic::TerminateProcessingThread ( )

Shutdown the processing thread.


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