Dear Xiaoxu and Arno,
These problems, running commands from Matlab on cygwin and
mac I think have the same cause.
The problem appears to be due to the fact that when MATLAB
is started outside of the terminal, it does not get the terminal's
environment settings, and so several critical variables, such as
FSLOUTPUTTYPE and FSLDIR are not set. As a consequence,
nothing will run.
The easiest way around this is to force the correct FSL configure
script to be sourced prior to running the desired FSL command.
For example:
dos('/usr/local/fsl/bin/bet infile infile_brain -m')
did *not* work on my mac when running Matlab from the dock, but
dos('source /usr/local/fsl/etc/fslconf/fsl.sh ; /usr/local/fsl/bin/bet
infile infile_brain -m')
did work fine.
Note that you may need to source fsl.csh if your normal shell is csh not
bash.
I assume that the same will work for cygwin just as well, although
note that some people have had trouble mixing different drives with
cygwin - it might be better to have the data on the same drive as you
installed fsl (i.e. C drive for you).
This is certainly the easiest way to get your environment set up correctly.
You can even simplify this by making a matlab function that put the
source command in automatically.
Hopefully this will fix your problems.
All the best,
Mark
P.S. Alternatively, it is possible to set up environment variables
globally on
startup for both mac and windows, and if you are familiar with this then
it is another option, however, the above is probably easier unless you are
quite familiar with environment setups.
Xiaoxu Liu wrote:
>Hi there,
> I want to execute FSL command BET in my PC version matlab script. My FSL
>is located in C:\Cygwin directory. If I use script like this:
>
>fslCommand ='C:\cygwin\usr\local\fsl\bin\bet_16si D:/Infile D:/Infile_brain
>-m -f 0.4 -v');
>dos(fslCommand);
>
>There is just no response at all. What should I do? Your suggestion and any
>tips are very helpful. Thanks.
>
>Xiaoxu Liu
>
>
|