Difference between revisions of "2014 Summer Project Week:Parameter Node Serialization"
From NAMIC Wiki
(3 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
* Jc (Kitware) | * Jc (Kitware) | ||
* Matt (Kitware) | * Matt (Kitware) | ||
+ | * Nicole (SPL) | ||
+ | |||
==Project Description== | ==Project Description== | ||
The module parameter node is a very useful data structure and serialization/deserialization would be very beneficial to many uses cases.However, currently the only way to serialize/deserialize is to save the entire mrml scene which is not optimal. There has been some work done by Matt to facilite this using Json. At project week, we will have discussion and finalize the plan to develop code for this purpose. | The module parameter node is a very useful data structure and serialization/deserialization would be very beneficial to many uses cases.However, currently the only way to serialize/deserialize is to save the entire mrml scene which is not optimal. There has been some work done by Matt to facilite this using Json. At project week, we will have discussion and finalize the plan to develop code for this purpose. | ||
Line 25: | Line 27: | ||
<div style="width: 27%; float: left; padding-right: 3%;"> | <div style="width: 27%; float: left; padding-right: 3%;"> | ||
<h3>Progress</h3> | <h3>Progress</h3> | ||
− | * | + | * Group discussion on various approaches including Matt's Json serializer. |
+ | * Tested Python script for importing and exporting parameter node. | ||
+ | To do: | ||
+ | * Create extension? too simple for extension. | ||
+ | * Put this concept into CLI/Loadable module template? | ||
+ | * Put this code into slicer.util as utility function for power users and developers. | ||
</div> | </div> | ||
</div> | </div> | ||
+ | |||
+ | = Google Hangout 2014-06-24 = | ||
+ | |||
+ | Attendees: Kevin, Csaba, Andriy, Jim, Steve, Nicole, Michael, Jc, Andras | ||
+ | |||
+ | Topic discussed: | ||
+ | * Parameter Serializer | ||
+ | |||
+ | * Json-ld | ||
+ | ** Identify module with version. | ||
+ | |||
+ | * Issue with saving vs exporting. | ||
+ | |||
+ | * Extend Parameter node to be reusable by loadable module. | ||
+ | |||
+ | Action items: | ||
+ | |||
+ | * short term: Extension to save a subset of nodes to a dedicated scene. | ||
+ | |||
+ | * medium term: Generalize approach of ParameterSerializer (json export) to regular parameter nodes. | ||
+ | |||
+ | == Python script to export parameter node == | ||
+ | |||
+ | <pre> | ||
+ | >>> pnode = slicer.mrmlScene.GetNodeByID('vtkMRMLCommandLineModuleNode1') | ||
+ | >>> tmpScene = slicer.vtkMRMLScene() | ||
+ | >>> tmpScene.AddNode(pnode) | ||
+ | >>> tmpScene.Commit('c:\\wangk\\tmp\\tmpScene.mrml') | ||
+ | </pre> | ||
+ | |||
+ | == Python script to import parameter node == | ||
+ | |||
+ | <pre> | ||
+ | >>> tmpScene = slicer.vtkMRMLScene() | ||
+ | >>> node = slicer.vtkMRMLCommandLineModuleNode() | ||
+ | >>> tmpScene.RegisterNodeClass(node) | ||
+ | >>> tmpScene.SetURL('c:\\wangk\\tmp\\tmpScene.mrml') | ||
+ | >>> tmpScene.Import() | ||
+ | >>> tmpScene.InitTraversal() | ||
+ | >>> pnode = tmpScene.GetNextNode() | ||
+ | >>> slicer.mrmlScene.AddNode(pnode) | ||
+ | </pre> |
Latest revision as of 14:40, 27 June 2014
Home < 2014 Summer Project Week:Parameter Node SerializationKey Investigators
- Kevin Wang (Princess Margaret Cancer Center)
- Steve Pieper
- Jim Miller (GE)
- Jc (Kitware)
- Matt (Kitware)
- Nicole (SPL)
Project Description
The module parameter node is a very useful data structure and serialization/deserialization would be very beneficial to many uses cases.However, currently the only way to serialize/deserialize is to save the entire mrml scene which is not optimal. There has been some work done by Matt to facilite this using Json. At project week, we will have discussion and finalize the plan to develop code for this purpose.
Objective
- To develop utility for serialization/deserialization of module parameter node.
Approach, Plan
- Meet and discuss with all interested parties to come up with a plan.
- prototype code development.
Progress
- Group discussion on various approaches including Matt's Json serializer.
- Tested Python script for importing and exporting parameter node.
To do:
- Create extension? too simple for extension.
- Put this concept into CLI/Loadable module template?
- Put this code into slicer.util as utility function for power users and developers.
Google Hangout 2014-06-24
Attendees: Kevin, Csaba, Andriy, Jim, Steve, Nicole, Michael, Jc, Andras
Topic discussed:
- Parameter Serializer
- Json-ld
- Identify module with version.
- Issue with saving vs exporting.
- Extend Parameter node to be reusable by loadable module.
Action items:
- short term: Extension to save a subset of nodes to a dedicated scene.
- medium term: Generalize approach of ParameterSerializer (json export) to regular parameter nodes.
Python script to export parameter node
>>> pnode = slicer.mrmlScene.GetNodeByID('vtkMRMLCommandLineModuleNode1') >>> tmpScene = slicer.vtkMRMLScene() >>> tmpScene.AddNode(pnode) >>> tmpScene.Commit('c:\\wangk\\tmp\\tmpScene.mrml')
Python script to import parameter node
>>> tmpScene = slicer.vtkMRMLScene() >>> node = slicer.vtkMRMLCommandLineModuleNode() >>> tmpScene.RegisterNodeClass(node) >>> tmpScene.SetURL('c:\\wangk\\tmp\\tmpScene.mrml') >>> tmpScene.Import() >>> tmpScene.InitTraversal() >>> pnode = tmpScene.GetNextNode() >>> slicer.mrmlScene.AddNode(pnode)