Hi,
It is actually quite difficult to keep matlab happy with
the right environment. We have solved this in the
file $FSLDIR/etc/matlab/save_avw_hdr.m with the
following strategy:
tmp=sprintf('sh -c ". ${FSLDIR}/etc/fslconf/fsl.sh;
FSLOUTPUTTYPE=NIFTI_PAIR; ex
port FSLOUTPUTTYPE; $FSLDIR/bin/fslcreatehd %d %d %d %d %6.4f %6.4f
%6.4f %6.4f
0 0 0 %d
%s"',dims(1),dims(2),dims(3),dims(4),vsize(1),vsize(2),vsize(3),vsize(4
),dtype,fname);
system(tmp);
It is the bit:
'sh -c ". ${FSLDIR}/etc/fslconf/fsl.sh;
which is absolutely critical for setting up the correct
environment. You shouldn't have to set the output type
explicitly, as the fsl.sh file will do that for you. We set
it explicitly here as we wanted to force the matlab
save routine to work in this way - it is specific to this
application.
If you go with the above solution for running prelude
then it should work OK. Look at, or modify the file
$FSLDIR/etc/matlab/save_avw_hdr.m if the above
isn't clear.
All the best,
Mark
On 30 Jan 2010, at 01:33, Gopesh Patel wrote:
> Hi all,
>
> I am trying to use prelude inside matlab but I get the following
> error:
>
> ERROR:: Environment variable FSLOUTPUTTYPE is not set!
> Please make sure that the appropriate configuration file is sourced
> by your
> shell (e.g. by putting it in .profile).
> e.g. bash or sh users add the line ". ${FSLDIR}/etc/fslconf/fsl.sh"
> e.g. tcsh or csh users add the line "source ${FSLDIR}/etc/fslconf/
> fsl.csh"
>
> I can successfully use prelude in terminal but within matlab it
> doesn't work.
>
> I set the FSLDIR to /usr/local/fsl and source the fsl.sh
> successfully and
> added the PATH to .bashrc. When I type echo $FSLOUTPUTTYPE in
> terminal it
> also shows me NIFTI_GZ.
>
> I read the posts of other members having similar problem but none of
> them
> helped me. I don't have any clue what's happening.
>
> Gopesh
>
|