In 3D Slicer, the MRML scene can be thought of as the workspace, consisting of everything that you interact with, including streaming data, segmentations, models, view layout, etc. In addition, the scene can include components that are not directly visualized. A scene can be saved and loaded at a later time, maintaining the same appearance, data and everything else included in the scene. The scene can also be "closed" removing the scene and providing a fresh workspace (File>close scene or via code: slicer.mrmlScene.Clear() ). All the components in the scene are called MRML nodes. In other words, the MRML scene manages MRML nodes.
A MRML nodes can be thought of as a container that holds attributes of the node and references connecting it to other nodes. There are three main node types: data nodes, display nodes, and storage nodes.
Regardless of the node type, each node has the following properties.
- Data nodes stores data. For example this includes streaming ultrasound images, tracking information and transforms, models, segmented images, etc.
- Display nodes store the visualization attributes for a data node. For visualizing the same information multiple ways, a data node can be referenced to multiple display nodes.
- Storage node stores the file name and format for a data node. This is only created when data is loaded from or saved to the persistent storage (disk) or your computer.
- Attributes can be thought of as variables of MRML nodes. For example, a data node containing an image volume could have attributes storing voxel spacing, position, or orientation. An example of an attribute for a display node is the display name. Similarly, a storage node has a file name attribute.
- References allow nodes to interact with other nodes of any type. For example, a model node may reference a transform node in order to apply the transform to the model.
- Events and observers describe a system in which nodes emit events that can be observed by other nodes to allow them to make the appropriate changes. For example, when a transform node is updated, it will emit an event notifying all observers (such as the models that reference it) that it has been modified.
Widgets are the building blocks or individual components of the graphic user interface. In 3D Slicer, the GUI utilizes the Qt framework that enables the design and development of cross platform (ie. Windows, Mac, and Linux) user interfaces. 3D Slicer can access all the Qt classes. In addition to all these available classes, 3D Slicer provides a selection of widgets for interacting with MRML nodes. These Slicer widgets follow the naming convention qMRML[custom name], where "custom name" differs based on the functionality of the widget.
Logic is the bulk of the processing of any application. The logic will control the MRML nodes and the view. For example, if a button within the GUI is dedicated to streaming ultrasound clicking the button will run the logic controlling this connection. Once the connection is established, the logic can output the ultrasound stream for viewing.
- Best development practices in 3D Slicer encourages the following naming convention for logic functions: vtk[custom logic function]Logic.
- Any function written in the logic section of a published module can be called on and reused by other developers.