[Neuroimaging] wrap a matlab script for Nipype

Hao wen hao.freesurfer at hotmail.com
Wed Jun 29 04:25:07 EDT 2016


Hello:

I am new to nipype, and recently, I want to wrap a matlab script for Nipype, but in your website, the example is not so specific,and I checked out all the posts that you have talked about, it is not so clear, whatever for the command line or to create the matlab interface by ourself, can you just make a good tutorial for us? in fact, the tutorial in the nipype website is not so well-structured, in my opinion...

Specifically, here is my case I wanna wrap a matlab function with a nipype freesurfer node, my matlab function actually just got some jpg files and save it to the output directory, I followed some options from the tutorial and other posts:


By the way, i am on Ubuntu 12.04


def runmatlab():
    from nipype.interfaces.matlab import MatlabCommand
    mlab = MatlabCommand()
    mlab.inputs.script = "/aramis/home/wen/HAO_lab/testhelloworld.m"
    out = mlab.run()
    out.outputs['matlab_output']
    print out.outputs.matlab_output
    return out.outputs.matlab_output

from nipype.interfaces.utility import Function
import nipype.pipeline.engine as pe

runmatlab = pe.Node(name='runmatlab',
               interface=Function(input_names=[],
                                  output_names=['out_file'],
                                  function=runmatlab))

runmatlab.run()


the matlab file is just to print  'hello world'



I got this in the _report file :

Node: utility
=============

 Hierarchy : runmatlab
 Exec ID : runmatlab

Original Inputs
---------------

* function_str : S'def runmatlab():\n    from nipype.interfaces.matlab import MatlabCommand\
n    mlab = MatlabCommand()\n    mlab.inputs.script = "/aramis/home/wen/HAO_lab/testhellowor
ld.m"\n    out = mlab.run()\n    out.outputs[\'matlab_output\'] \n    print out.outputs.matl
ab_output\n    return out.outputs.matlab_output\n'
.
* ignore_exception : False

in the runmatlab node, I got some files

Also, I tried the tutorial example2 in nipype website : http://nipy.org/nipype/devel/matlab_interface_devel.html, In my spyder, I got no display, but in my dir, I got the pyscript.m, I run it in my matlab, I got the result, does that mean that spyder cant find my matlab???? but I saw that in some post that you said the MatlabCommand will not use matlab engine, they just give some matlab script to it to run?

Any advice will be appreciated:)

Hao

Neuroimaging in Python - Pipelines and Interfaces - nipy ...<http://nipy.org/nipype/devel/matlab_interface_devel.html>
nipy.org
How to wrap a MATLAB script¶ This is minimal script for wrapping MATLAB code. You should replace the MATLAB code template, and define approriate inputs and outputs.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20160629/8a61f360/attachment.html>


More information about the Neuroimaging mailing list