Difference between revisions of "Projects/Slicer3/2007 Project Week MRML Scenes for the Execution Model including Transforms"
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {| | |
+ | |[[Image:ProjectWeek-2007.png|thumb|320px|Return to [[2007_Programming/Project_Week_MIT|Project Week Main Page]] ]] | ||
+ | | | ||
+ | '''XML Module Description''' | ||
+ | <pre> | ||
+ | <scene></scene> | ||
− | = | + | <node descendents="true"></node> |
− | + | <transform type="linear"></transform> | |
− | =Additional Information= | + | </pre> |
− | == Strawman Plan == | + | |
+ | '''Example Command Lines''' | ||
+ | '''[Command line plugin]''' ./SomePluginTakingAScene --scene /path/to/scene/file.mrml | ||
+ | '''[Shared object plugin]''' slicer:13B0835A --scene slicer:04E346F0 | ||
+ | |||
+ | '''[Command line plugin]''' ./SomePluginTakingANode --node /path/to/scene/file.mrml#"Some node id" | ||
+ | '''[Shared object plugin]''' slicer:13B0835A --node slicer:04E346F0#Some node id | ||
+ | |||
+ | '''[Command line plugin]''' ./SomePluginTakingATransform --transform /path/to/scene/file.mrml#"Some transform node id" | ||
+ | '''[Shared object plugin]''' slicer:13B0835A --transform slicer:04E346F0#Some transform node id | ||
+ | |||
+ | |} | ||
+ | |||
+ | __NOTOC__ | ||
+ | ===Key Investigators=== | ||
+ | * GE Research: Jim Miller | ||
+ | * Kitware: Brad Davis | ||
+ | * BWH: Nicole Aucoin | ||
+ | * Isomics: Alex Yarmarkovich, Steve Pieper | ||
+ | |||
+ | |||
+ | <div style="margin: 20px;"> | ||
+ | |||
+ | <div style="width: 27%; float: left; padding-right: 3%;"> | ||
+ | <h1>Objective</h1> | ||
+ | Pass MRML scenes and nodes to Slicer plugins. | ||
+ | |||
+ | |||
+ | </div> | ||
+ | |||
+ | <div style="width: 27%; float: left; padding-right: 3%;"> | ||
+ | |||
+ | <h1>Approach, Plan</h1> | ||
+ | |||
+ | Support several paths | ||
+ | # Pass nodes in scene wrapper files | ||
+ | # Pass nodes directly from MRML tree in memory | ||
+ | # Pass scenes in files | ||
+ | # Pass scenes from MRML tree in memory | ||
+ | |||
+ | </div> | ||
+ | |||
+ | <div style="width: 40%; float: left;"> | ||
+ | |||
+ | <h1>Progress</h1> | ||
+ | |||
+ | Scene wrapper file approach for transform types is under development as a test case. | ||
+ | |||
+ | Several discussions between Jim, Alex, Brad, and Steve on MRML design and MRML storage. Will investigate collecting all input and output nodes into a single scene that is sent back and forth to the command line module. Key issue is managing MRML node ids: node id in Slicer active scene -> node id in small scene file sent to module -> node id in the module. May need modifications to AddNode() and Copy() methods in MRML. | ||
+ | |||
+ | '''Update:''' | ||
+ | |||
+ | Back at the ranch, and with a few quiet days for programming, we were able to modify the execution model to communicate transforms via MRML files, complete with ID remapping. The infrastructure established will be utilized for other node types, including hierarchical nodes. | ||
+ | |||
+ | This infrastructure also opens the door for a new type of module in the execution model, one that can communicate directly with the MRML tree in memory. | ||
+ | |||
+ | </div> | ||
+ | |||
+ | <br style="clear: both;" /> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | |||
+ | ===References=== | ||
+ | |||
+ | |||
+ | ===Additional Information=== | ||
+ | |||
+ | ====Strawman Plan ==== | ||
* MRML | * MRML | ||
Line 23: | Line 96: | ||
** needs to import the resulting mrml scene written by mrmlCLI back into Slicer3's scene | ** needs to import the resulting mrml scene written by mrmlCLI back into Slicer3's scene | ||
− | == Example Scenario == | + | ====Example Scenario ==== |
# User reads grayscale | # User reads grayscale | ||
Line 47: | Line 120: | ||
### imports mrml scene file in to current slicer scene | ### imports mrml scene file in to current slicer scene | ||
− | == Other Issues == | + | ==== Other Issues ==== |
* Model maker may use mrml scene hierarchy nodes to group the output together so all models from a given build can be deleted as a group. | * Model maker may use mrml scene hierarchy nodes to group the output together so all models from a given build can be deleted as a group. | ||
* We will want to find a way to tell Slicer that the newly created models should have the same transform ID as the source volume (this is complicated because the current scene import will try to give each node a unique ID, so it may not be possible for the scene written by the mrmlCLI to point to nodes in the Slicer3 mrml scene). | * We will want to find a way to tell Slicer that the newly created models should have the same transform ID as the source volume (this is complicated because the current scene import will try to give each node a unique ID, so it may not be possible for the scene written by the mrmlCLI to point to nodes in the Slicer3 mrml scene). | ||
+ | |||
+ | ==== Brad's Notes For EMSegment Use Cases ==== | ||
+ | |||
+ | *The new EMSegment command line utility uses the "pass scene by file" method with the --mrmlSceneFileName flag. Within this program | ||
+ | **a MRML scene is created | ||
+ | **appropriate EMSegment node types are registered with the scene | ||
+ | **the scene is read | ||
+ | **some scene data may be overridden by command line arguments (e.g., which image do you want to segment) | ||
+ | **by default the first EMSegment parameter node is used for segmentation parameters (can override by passing name of node to command line) | ||
+ | **processing occurs via the vtkEMSegmentLogic (vtkSlicerModuleLogic) class just like in the internal module | ||
+ | **the results (labelmap) are written to disk | ||
+ | |||
+ | *The ideal use case for an external module, running within slicer, is | ||
+ | **Slicer3 passes: | ||
+ | ***the EMSegment parameter node and all referenced (recursively) nodes | ||
+ | ***the input images | ||
+ | **The module returns: | ||
+ | ***the segmentation results |
Latest revision as of 16:56, 6 July 2007
Home < Projects < Slicer3 < 2007 Project Week MRML Scenes for the Execution Model including Transforms![]() Return to Project Week Main Page |
XML Module Description <scene></scene> <node descendents="true"></node> <transform type="linear"></transform> Example Command Lines [Command line plugin] ./SomePluginTakingAScene --scene /path/to/scene/file.mrml [Shared object plugin] slicer:13B0835A --scene slicer:04E346F0 [Command line plugin] ./SomePluginTakingANode --node /path/to/scene/file.mrml#"Some node id" [Shared object plugin] slicer:13B0835A --node slicer:04E346F0#Some node id [Command line plugin] ./SomePluginTakingATransform --transform /path/to/scene/file.mrml#"Some transform node id" [Shared object plugin] slicer:13B0835A --transform slicer:04E346F0#Some transform node id |
Key Investigators
- GE Research: Jim Miller
- Kitware: Brad Davis
- BWH: Nicole Aucoin
- Isomics: Alex Yarmarkovich, Steve Pieper
Objective
Pass MRML scenes and nodes to Slicer plugins.
Approach, Plan
Support several paths
- Pass nodes in scene wrapper files
- Pass nodes directly from MRML tree in memory
- Pass scenes in files
- Pass scenes from MRML tree in memory
Progress
Scene wrapper file approach for transform types is under development as a test case.
Several discussions between Jim, Alex, Brad, and Steve on MRML design and MRML storage. Will investigate collecting all input and output nodes into a single scene that is sent back and forth to the command line module. Key issue is managing MRML node ids: node id in Slicer active scene -> node id in small scene file sent to module -> node id in the module. May need modifications to AddNode() and Copy() methods in MRML.
Update:
Back at the ranch, and with a few quiet days for programming, we were able to modify the execution model to communicate transforms via MRML files, complete with ID remapping. The infrastructure established will be utilized for other node types, including hierarchical nodes.
This infrastructure also opens the door for a new type of module in the execution model, one that can communicate directly with the MRML tree in memory.
References
Additional Information
Strawman Plan
- MRML
- virtual method on each node GetReferencedNodes() returns a list of nodes (e.g. model node returns display node, storage node, transform node)
- [Jim]
- Is this a list of nodes or list of node ids?
- Referenced nodes are managed in an ad hoc manner. We could have a map of reference ids. Key would be a string for the name of the reference, for instance "TransformNodeID". Value would be a string for the id. This would allow the GetReferencedNodes() method to be written abstractly on the container of reference ids rather than having to be implemented in node that adds a reference id to the hierarchy.
- [Steve]: yes, a list of ids.
- [Steve]: I like the container idea - each node needs to have a custom set of referenced nodes, but keeping them in a standard container type might also allow us to handle the observer/event management more consistently.
- method in MRMLScene GetSubscene(nodeList) returns list all the nodes referenced by all the nodes in the list (recursively searches)
- virtual method on each node GetReferencedNodes() returns a list of nodes (e.g. model node returns display node, storage node, transform node)
- CommandLineModule
- need a way in XML to say that a module is 'mrml aware' -- call them mrmlCLIs
- when nodes are selected as args to a mrmlCLI
- need to create a subscene containing all the selected nodes and referenced nodes (use GetSubscene)
- need to pass mrml ids for arguments rather than filenames
- need to write the subscene to temp space, along with any volumes or models that aren't saved (needs to use the storage nodes) and pass that as argument to mrmlCLI
- needs to import the resulting mrml scene written by mrmlCLI back into Slicer3's scene
Example Scenario
- User reads grayscale
- Creates labelmap with Editor or Segmenter (label volume is not yeat saved)
- User enters ModelMaker and selects label map as input and hits Apply
- a temp mrml scene is created with
- label map volume node
- volume display node (ref'd by volume)
- color node (ref'd by display)
- possibly a transform node (ref'd by volume)
- possibly more transform nodes (ref'd by transform nodes)
- volume storage node (created by CommandLineModule to point to temp storage of label map)
- model maker is invoked with arguments for:
- the temp mrml scene
- id of the input volume
- parameters
- model maker
- reads mrml scene
- pulls out needed info (e.g. label names for each model it makes)
- builds the models
- puts output into mrml scene that it saves out
- CommandLineModule
- imports mrml scene file in to current slicer scene
- a temp mrml scene is created with
Other Issues
- Model maker may use mrml scene hierarchy nodes to group the output together so all models from a given build can be deleted as a group.
- We will want to find a way to tell Slicer that the newly created models should have the same transform ID as the source volume (this is complicated because the current scene import will try to give each node a unique ID, so it may not be possible for the scene written by the mrmlCLI to point to nodes in the Slicer3 mrml scene).
Brad's Notes For EMSegment Use Cases
- The new EMSegment command line utility uses the "pass scene by file" method with the --mrmlSceneFileName flag. Within this program
- a MRML scene is created
- appropriate EMSegment node types are registered with the scene
- the scene is read
- some scene data may be overridden by command line arguments (e.g., which image do you want to segment)
- by default the first EMSegment parameter node is used for segmentation parameters (can override by passing name of node to command line)
- processing occurs via the vtkEMSegmentLogic (vtkSlicerModuleLogic) class just like in the internal module
- the results (labelmap) are written to disk
- The ideal use case for an external module, running within slicer, is
- Slicer3 passes:
- the EMSegment parameter node and all referenced (recursively) nodes
- the input images
- The module returns:
- the segmentation results
- Slicer3 passes: