Slicer
5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
#include <Libs/MRML/Logic/vtkMRMLApplicationLogic.h>
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, EditNodeEvent, ShowViewContextMenuEvent } |
List of custom events fired by the class. More... | |
enum | IntersectingSlicesOperation { IntersectingSlicesVisibility, IntersectingSlicesInteractive, IntersectingSlicesTranslation, IntersectingSlicesRotation } |
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 | |
virtual void | EditNode (vtkMRMLNode *node) |
Requests the application to show user interface for editing a node. More... | |
void | FitSliceToAll (bool onlyIfPropagateVolumeSelectionAllowed=false, bool resetOrientation=true) |
virtual const char * | GetClassName () |
vtkMRMLColorLogic * | GetColorLogic () const |
vtkMRMLInteractionNode * | GetInteractionNode () const |
Get default Interaction node. More... | |
bool | GetIntersectingSlicesEnabled (IntersectingSlicesOperation operation) |
int | GetIntersectingSlicesIntersectionMode () |
int | GetIntersectingSlicesLineThicknessMode () |
vtkMRMLAbstractLogic * | GetModuleLogic (const char *moduleName) const |
vtkMRMLSelectionNode * | GetSelectionNode () const |
Get default Selection node. More... | |
vtkMRMLSliceLogic * | GetSliceLogic (vtkMRMLSliceNode *sliceNode) const |
vtkMRMLSliceLogic * | GetSliceLogicByLayoutName (const char *layoutName) const |
vtkMRMLSliceLogic * | GetSliceLogicByModelDisplayNode (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... | |
vtkMRMLViewLogic * | GetViewLogic (vtkMRMLViewNode *viewNode) const |
vtkMRMLViewLogic * | GetViewLogicByLayoutName (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 | SetIntersectingSlicesEnabled (IntersectingSlicesOperation operation, bool enabled) |
void | SetIntersectingSlicesIntersectionMode (int mode) |
void | SetIntersectingSlicesLineThicknessMode (int mode) |
void | SetModuleLogic (const char *moduleName, vtkMRMLAbstractLogic *moduleLogic) |
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 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) 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 vtkMRMLApplicationLogic * | New () |
static std::string | PercentEncode (std::string s) |
static vtkMRMLApplicationLogic * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkMRMLAbstractLogic | |
static int | IsTypeOf (const char *type) |
static vtkMRMLAbstractLogic * | New () |
static vtkMRMLAbstractLogic * | SafeDownCast (vtkObject *o) |
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) |
Definition at line 48 of file vtkMRMLApplicationLogic.h.
Definition at line 55 of file vtkMRMLApplicationLogic.h.
List of custom events fired by the class.
Enumerator | |
---|---|
RequestInvokeEvent | |
PauseRenderEvent | |
ResumeRenderEvent | |
EditNodeEvent | |
ShowViewContextMenuEvent |
Definition at line 189 of file vtkMRMLApplicationLogic.h.
Enumerator | |
---|---|
IntersectingSlicesVisibility | |
IntersectingSlicesInteractive | |
IntersectingSlicesTranslation | |
IntersectingSlicesRotation |
Definition at line 254 of file vtkMRMLApplicationLogic.h.
Enumerator | |
---|---|
LabelLayer | |
ForegroundLayer | |
BackgroundLayer | |
AllLayers |
Definition at line 115 of file vtkMRMLApplicationLogic.h.
|
protected |
|
overrideprotected |
|
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).
|
virtual |
Requests the application to show user interface for editing a node.
void vtkMRMLApplicationLogic::FitSliceToAll | ( | bool | onlyIfPropagateVolumeSelectionAllowed = false , |
bool | resetOrientation = true |
||
) |
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 If resetOrientation is true then slice orientation can be modified during function call
|
virtual |
Reimplemented from vtkMRMLAbstractLogic.
Reimplemented in vtkSlicerApplicationLogic.
vtkMRMLColorLogic* vtkMRMLApplicationLogic::GetColorLogic | ( | ) | const |
vtkMRMLInteractionNode* vtkMRMLApplicationLogic::GetInteractionNode | ( | ) | const |
Get default Interaction node.
bool vtkMRMLApplicationLogic::GetIntersectingSlicesEnabled | ( | IntersectingSlicesOperation | operation | ) |
int vtkMRMLApplicationLogic::GetIntersectingSlicesIntersectionMode | ( | ) |
int vtkMRMLApplicationLogic::GetIntersectingSlicesLineThicknessMode | ( | ) |
vtkMRMLAbstractLogic* vtkMRMLApplicationLogic::GetModuleLogic | ( | const char * | moduleName | ) | const |
Gets a constant pointer to module logic associated with a given module
moduleName | name of the module associated to the logic |
vtkMRMLSelectionNode* vtkMRMLApplicationLogic::GetSelectionNode | ( | ) | const |
Get default Selection node.
vtkMRMLSliceLogic* vtkMRMLApplicationLogic::GetSliceLogic | ( | vtkMRMLSliceNode * | sliceNode | ) | const |
vtkMRMLSliceLogic* vtkMRMLApplicationLogic::GetSliceLogicByLayoutName | ( | const char * | layoutName | ) | const |
vtkMRMLSliceLogic* vtkMRMLApplicationLogic::GetSliceLogicByModelDisplayNode | ( | vtkMRMLModelDisplayNode * | displayNode | ) | const |
Get slice logic from slice model display node.
vtkCollection* vtkMRMLApplicationLogic::GetSliceLogics | ( | ) | const |
const char* vtkMRMLApplicationLogic::GetTemporaryPath | ( | ) |
Return the temporary path that was set by the application.
vtkMRMLViewLogic* vtkMRMLApplicationLogic::GetViewLogic | ( | vtkMRMLViewNode * | viewNode | ) | const |
vtkMRMLViewLogic* vtkMRMLApplicationLogic::GetViewLogicByLayoutName | ( | const char * | layoutName | ) | const |
vtkCollection* vtkMRMLApplicationLogic::GetViewLogics | ( | ) | const |
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.
|
virtual |
Reimplemented from vtkMRMLAbstractLogic.
Reimplemented in vtkSlicerApplicationLogic.
|
static |
|
static |
Load any default parameter sets into the specified scene Returns the total number of loaded parameter sets
|
static |
|
overrideprotectedvirtual |
If vtkMRMLScene::EndBatchProcessEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event Internally calls UpdateFromMRMLScene. Can be reimplemented to change the default behavior.
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::EndImportEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::EndRestoreEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::StartBatchProcessEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::StartImportEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::StartRestoreEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
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.
|
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().
|
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 preserves 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. https://en.wikipedia.org/wiki/Percent-encoding See https://github.com/Slicer/Slicer/issues/2605
|
override |
|
overrideprotectedvirtual |
Receives all the events fired by the nodes. To listen to a node, you can add an observer using GetMRMLNodesCallbackCommand() or use the utility macros vtk[SetAndObserve|Observe]MRMLNode[Event]Macro ProcessMRMLNodesEvents calls OnMRMLNodeModified when event is vtkCommand::ModifiedEvent.
Reimplemented from vtkMRMLAbstractLogic.
void vtkMRMLApplicationLogic::PropagateBackgroundVolumeSelection | ( | int | fit = 1 | ) |
Propagate only active background volume in the SelectionNode to slice composite nodes
void vtkMRMLApplicationLogic::PropagateForegroundVolumeSelection | ( | int | fit = 1 | ) |
Propagate only active foreground volume in the SelectionNode to slice composite nodes
void vtkMRMLApplicationLogic::PropagateLabelVolumeSelection | ( | int | fit = 1 | ) |
Propagate only active label volume in the SelectionNode to slice composite nodes
void vtkMRMLApplicationLogic::PropagatePlotChartSelection | ( | ) |
Propagate selected PlotChart in the SelectionNode to Plot view nodes.
void vtkMRMLApplicationLogic::PropagateTableSelection | ( | ) |
Propagate selected table in the SelectionNode to table view nodes.
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)
void vtkMRMLApplicationLogic::PropagateVolumeSelection | ( | int | layer, |
int | fit | ||
) |
Propagate selected volume layer in the SelectionNode to the slice composite nodes.
|
virtual |
Resumes rendering for all views in the current layout.
|
static |
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.
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
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.
|
protected |
void vtkMRMLApplicationLogic::SetIntersectingSlicesEnabled | ( | IntersectingSlicesOperation | operation, |
bool | enabled | ||
) |
void vtkMRMLApplicationLogic::SetIntersectingSlicesIntersectionMode | ( | int | mode | ) |
void vtkMRMLApplicationLogic::SetIntersectingSlicesLineThicknessMode | ( | int | mode | ) |
void vtkMRMLApplicationLogic::SetModuleLogic | ( | const char * | moduleName, |
vtkMRMLAbstractLogic * | moduleLogic | ||
) |
Sets a module with its corresponding logic to the application logic.
moduleName | name of the module. |
moduleLogic | pointer to logic to be associated to the module. If this parameter is nullptr, then the module logic will be removed from the application logic. |
|
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.
Reimplemented from vtkMRMLAbstractLogic.
|
protected |
void vtkMRMLApplicationLogic::SetSliceLogics | ( | vtkCollection * | sliceLogics | ) |
All the slice logics in the application.
void vtkMRMLApplicationLogic::SetTemporaryPath | ( | const char * | path | ) |
Set the temporary path the logics can use. The path should be set by the application.
void vtkMRMLApplicationLogic::SetViewLogics | ( | vtkCollection * | viewLogics | ) |
All the view logics in the application.
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.
bool vtkMRMLApplicationLogic::Unzip | ( | const char * | zipFileName, |
const char * | destinationDirectory | ||
) |
unzip the zip file to the current working directory Returns success or failure.
bool vtkMRMLApplicationLogic::Zip | ( | const char * | zipFileName, |
const char * | directoryToZip | ||
) |
zip the directory into a zip file Returns success or failure.