Difference between revisions of "Documentation/Nightly/Extensions/MatlabBridge"

From Slicer Wiki
Jump to: navigation, search
Line 31: Line 31:
  
 
Demo videos:
 
Demo videos:
* [http://screencast.com/t/veVw16jB3uk Creating and using a Matlab module]
+
* [http://www.youtube.com/watch?v=dFNbt1sIdqQ Creating and using a Matlab module]
 
* [http://screencast.com/t/LcdrCx9l0 Editing and debugging a Matlab module]
 
* [http://screencast.com/t/LcdrCx9l0 Editing and debugging a Matlab module]
  
Line 59: Line 59:
 
*'''[[Media:MatlabBridgeTutorial.pdf|Comprehensive MatlabBridge tutorial: how to create, run, customize Matlab modules]]'''
 
*'''[[Media:MatlabBridgeTutorial.pdf|Comprehensive MatlabBridge tutorial: how to create, run, customize Matlab modules]]'''
 
*[https://subversion.assembla.com/svn/slicerrt/trunk/MatlabBridge/src/Examples/ A few example modules]
 
*[https://subversion.assembla.com/svn/slicerrt/trunk/MatlabBridge/src/Examples/ A few example modules]
* Demo video: [http://screencast.com/t/veVw16jB3uk Creating and using a Matlab module]
+
* Demo video: [http://www.youtube.com/watch?v=dFNbt1sIdqQ Creating and using a Matlab module]
 
* Demo video: [http://screencast.com/t/LcdrCx9l0 Editing and debugging a Matlab module]
 
* Demo video: [http://screencast.com/t/LcdrCx9l0 Editing and debugging a Matlab module]
 
<!-- ---------------------------- -->
 
<!-- ---------------------------- -->

Revision as of 17:26, 12 December 2013

Home < Documentation < Nightly < Extensions < MatlabBridge


For the latest Slicer documentation, visit the read-the-docs.


Introduction and Acknowledgements

Author: Andras Lasso (PerkLab, Queen's University), Jean-Christophe Fillion-Robin (Kitware), Kevin Wang (Radiation Medicine Program, Princess Margaret Hospital, University Health Network Toronto), Gabor Fichtinger (PerkLab, Queen's University)
Contact: Andras Lasso, <email>lasso@cs.queensu.ca</email>
Project website: http://www.slicerrt.org
License: Slicer license

SparKit  
NA-MIC  

Extension Description

MatlabBridgeLogo.png

MatlabBridge is an extension of 3D Slicer to allow running Matlab functions directly in 3D Slicer.

Highlights:

  • The extension allows running of Matlab functions directly from 3D Slicer: it takes the input from the data loaded into Slicer and visualizes the results in Slicer right after the execution is completed
  • If you change any input on the GUI (and the “AutoRun” option is enabled) the bridge automatically re-runs the Matlab script with the updated parameters and shows the new results
  • If you change your Matlab function then you can re-run the function and see the updated results with a single click
  • The graphical user interface is generated automatically from a standard command-line interface definition XML file (no GUI programming needed)
  • You can get started quickly by generating a skeleton Matlab function and interface definition XML file using the Matlab Module Generator module
  • No building of 3D Slicer or MEX files, etc. are needed – the only requirements are to download and install 3D Slicer with the MatlabBridge extension and have Matlab on your computer

The Matlab module behaves exactly as any other command-line-interface module, the Matlab engine is started automatically in the background (and it is kept running in the background so that you don’t have to wait for Matlab startup each time you run your function)

Demo videos:

Tutorial: How to create, run, customize Matlab modules

Modules

Use Cases

Tutorials

Information for Developers

Troubleshooting

  • Problem: When I try to run my Matlab module, the Matlab process does not start (Matlab window does not appear on the taskbar)
    • Solution [on Windows Vista/7/8]: Please go to the Matlab module generator module and in the “Matlab executable” editbox set the path to your “.../bin/matlab.exe” (not to "activate_matlab.exe" or other exe files in the Matlab program directory or any file in the bin/win64 directory).
  • Problem: When I try to run my Matlab module, the Matlab process starts (Matlab window appears on the taskbar and it displays the message "Starting OpenIGTLink command server at port 4100 Waiting for client connections..."), but the Matlab module execution fails (in the Slicer error log the "igtl::ClientSocket (...): Failed to connect to server 127.0.0.1:4100" message is displayed)
    • Solution [on Windows Vista/7/8]: Firewall settings prevent Matlab-Slicer communication. Please add a firewall exception by the following steps:
      1. Start cmd.exe as administrator (open the Windows Start menu, type "cmd", hit Ctrl + Shift + Enter)
      2. Click Yes, if a dialog box appears asking "Do you want to allow the following program to make changes to this computer?"
      3. Enter the following command: netsh firewall add portopening tcp 4100 MatlabBridge
  • Problem: module execution is not completed
    • Solution: make sure you've selected .../MATLAB/.../bin/matlab.exe as Matlab executable (and not .../MATLAB/.../bin/win64/MATLAB.exe)