Difference between revisions of "2013 Summer Project Week:CLI Matlab"

From NAMIC Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
<gallery>
 
<gallery>
 
Image:PW-MIT2013.png|[[2013_Summer_Project_Week#Projects|Projects List]]
 
Image:PW-MIT2013.png|[[2013_Summer_Project_Week#Projects|Projects List]]
Image:MatlabCliExample2.png| Example thresholding CLI module implemented in Matlab. '''Demo video: http://screencast.com/t/CQbbJ9bnw6f'''
+
Image:MatlabCliExample2.png| Example thresholding CLI module implemented in Matlab. '''[http://screencast.com/t/CQbbJ9bnw6f Click here for a demo video]'''
 
Image:MatlabModuleGenerator.png| Module for generating Matlab CLI module skeletons.
 
Image:MatlabModuleGenerator.png| Module for generating Matlab CLI module skeletons.
 
Image:MatlabCommander2.png| Helper module to run Matlab scripts.
 
Image:MatlabCommander2.png| Helper module to run Matlab scripts.
Line 10: Line 10:
 
==Key Investigators==
 
==Key Investigators==
 
* Queen's: Andras Lasso
 
* Queen's: Andras Lasso
* PMH, Toronto: Kevin Wang
+
* Kitware: Jc
* Isomics: Steve Pieper
 
  
 
<div style="margin: 20px;">
 
<div style="margin: 20px;">
Line 40: Line 39:
  
 
<h3>Progress</h3>
 
<h3>Progress</h3>
Matlab functions can now be called directly from Slicer as a CLI module!
+
Matlab functions can now be called directly from Slicer as a CLI module! Available in the SlicerRT extension for Windows. Probably it will be moved into a separate extension.
 
* Matlab module generator: the user specifies a module name, the generator creates a skeleton .m file, a CLI definition .xml file, and a CLI launcher .bat file from a template, then the user customize the .xml and .m files.
 
* Matlab module generator: the user specifies a module name, the generator creates a skeleton .m file, a CLI definition .xml file, and a CLI launcher .bat file from a template, then the user customize the .xml and .m files.
 
* MatlabCommander: this module provides simple remote Matlab method execution for testing, this module is also used internally by the CLI launcher
 
* MatlabCommander: this module provides simple remote Matlab method execution for testing, this module is also used internally by the CLI launcher
 
Next steps:
 
Next steps:
 
* Support more helper functions for reading/writing more file formats (images, fiducials, numbers, strings, etc. are already covered)
 
* Support more helper functions for reading/writing more file formats (images, fiducials, numbers, strings, etc. are already covered)
* Provide launcher script for Linux/Mac (on request)
+
* Provide launcher script for Linux/Mac (if requested)
  
 
'''Demo video: http://screencast.com/t/CQbbJ9bnw6f'''
 
'''Demo video: http://screencast.com/t/CQbbJ9bnw6f'''

Latest revision as of 13:49, 21 June 2013

Home < 2013 Summer Project Week:CLI Matlab

Key Investigators

  • Queen's: Andras Lasso
  • Kitware: Jc

Objective

Allow easy implementation of CLI modules in Matlab.

Approach, Plan

Implement a module that can run Matlab functions as a CLI. It should not require building of Slicer or a C++ compiler. Should be possible to install from an extension.

Create a Python script that generates the following scripts:

  • Proxy: a Python CLI module (with a .bat executer on Windows), it returns the CLI description XML to Slicer during module discovery, it calls the Matlab stub script when Slicer executes the module. It may also start the Matlab server, if it's not running already.
  • Stub: a Matlab function that performs the actual processing. It receives the same parameters as the CLI module (input and output file names, numerical values, etc.), it reads the data from files (with helper file I/O functions), performs the computations, and writes results to files.

Other necessary components:

  • Matlab server: Matlab script that executes commands that it receives through OpenIGTLink. Already exists, was developed during the last project week.
  • Helper Matlab functions: file I/O to read write image, model, transform, etc., maybe command-line parameter parsing (if the CLI parameters are all passed as a simple string; alternatively, the parameter string parsing may be done in the proxy script).

Progress

Matlab functions can now be called directly from Slicer as a CLI module! Available in the SlicerRT extension for Windows. Probably it will be moved into a separate extension.

  • Matlab module generator: the user specifies a module name, the generator creates a skeleton .m file, a CLI definition .xml file, and a CLI launcher .bat file from a template, then the user customize the .xml and .m files.
  • MatlabCommander: this module provides simple remote Matlab method execution for testing, this module is also used internally by the CLI launcher

Next steps:

  • Support more helper functions for reading/writing more file formats (images, fiducials, numbers, strings, etc. are already covered)
  • Provide launcher script for Linux/Mac (if requested)

Demo video: http://screencast.com/t/CQbbJ9bnw6f

Delivery Mechanism

This work will be delivered to the NA-MIC Kit as part of the SlicerRT extension.

References