Oh, I see now. It never failed for me because matlab is defined in my 
path. I think the right logic is
if($FS_MKCON_USE_BIN == 0 && UseOctave == 0) then ...

I've put a new version here
https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2
Can you try it out?



On 07/06/2018 01:20 PM, Patrycja Naumczyk wrote:
>
>         External Email - Use Caution
>
> Hi Doug,
>
> I walked through the mkcontrast2 and found it failed when executing 
> the loop below:
>
> if($FS_MKCON_USE_BIN == 0) then
>   set MATLAB = `getmatlab`;
>   if($status) then
>     echo "ERROR: cannot find matlab. Is it in your path?"
>     exit 1;
>   endif
> endif
>
> I changed the clause to
> if($FS_MKCON_USE_BIN == 1)
> as to me it didn't make sense to verify if you can find matlab in the 
> path, when the $FS_MKCON_USE_BIN is set to 0. Now it works OK, and 
> creates the contrast files as it should via octave.
>
> Best regards,
> Patrycja
>
>
> 2018-07-03 21:48 GMT+02:00 Patrycja Naumczyk 
> <patrycja.naumc...@gmail.com <mailto:patrycja.naumc...@gmail.com>>:
>
>     OK - I double checked, and even compared the new mkcontrast2 with
>     the old one to verify that I copied all as I should (see below).
>     Still the mkcontrast2 exits when checking $FS_MKCON_USE_BIN with
>     the same error message (no matter if this variable is undefined or
>     is it defined and set to zero):
>
>     ERROR: cannot find matlab. Is it in your path?
>     ERROR running mkcontrast
>
>     'diff' output (new > old):
>
>     57,163c157
>     <   if($UseOctave == 0) then
>     <     echo "------- matlab output --------------------"
>     <     cat $mfile | $MATLAB -nosplash -display iconic -nodesktop
>     <   else
>     <     echo "------- octave output --------------------"
>     <     cat $mfile | octave
>     <   endif
>     ---
>     >   cat $mfile | $MATLAB -nosplash -display iconic -nodesktop
>     447a442,466
>     >   if($UseOctave) then
>     >     if($?FS_OCTAVE_LIB == 0) then
>     >       echo "ERROR: you must set the FS_OCTAVE_LIB environment
>     variable"
>     >       exit 1;
>     >     endif
>     >     if(! -e $FS_OCTAVE_LIB) then
>     >       echo "ERROR: cannot find $FS_OCTAVE_LIB"
>     >       exit 1;
>     >     endif
>     >     if($?FS_OCTAVE_BIN == 0) then
>     >       echo "ERROR: you must set the FS_OCTAVE_BIN environment
>     variable"
>     >       exit 1;
>     >     endif
>     >     if(! -x $FS_OCTAVE_BIN) then
>     >       echo "ERROR: cannot find or execute $FS_OCTAVE_BIN"
>     >       exit 1;
>     >     endif
>     >     if($?LD_LIBRARY_PATH == 0) setenv LD_LIBRARY_PATH ""
>     >     if($#LD_LIBRARY_PATH == 0) then
>     >       setenv LD_LIBRARY_PATH $FS_OCTAVE_LIB
>     >     else
>     >       setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$FS_OCTAVE_LIB
>     >     endif
>     >   endif
>     >
>     470a490
>     >
>
>     Probably I am omitting something, but I have no clue what is the
>     problem here :/
>
>     Patrycja
>
>     2018-07-03 19:35 GMT+02:00 Douglas N. Greve
>     <dgr...@mgh.harvard.edu <mailto:dgr...@mgh.harvard.edu>>:
>
>         Are you sure you're using the new one? I've tested it on my
>         system, and
>         it works.
>
>         On 07/03/2018 01:33 PM, Patrycja Naumczyk wrote:
>         >
>         >         External Email - Use Caution
>         >
>         > Douglas,
>         >
>         > thank you for clarifying. The problem is that both when
>         > $FS_MKCON_USE_BIN is not defined and when it is set to '0'
>         mkcontrast2
>         > asks for MATLAB path (as in my previous mail). What should I
>         do to
>         > make it use octave instead?
>         >
>         > Best regards,
>         > Patrycja
>         >
>         > 2018-07-03 19:23 GMT+02:00 Douglas N. Greve
>         <dgr...@mgh.harvard.edu <mailto:dgr...@mgh.harvard.edu>
>         > <mailto:dgr...@mgh.harvard.edu
>         <mailto:dgr...@mgh.harvard.edu>>>:
>         >
>         >     questions answered below
>         >
>         >     On 07/03/2018 01:14 PM, Patrycja Naumczyk wrote:
>         >     >
>         >     >         External Email - Use Caution
>         >     >
>         >     > Douglas,
>         >     >
>         >     > thanks a lot - unfortunately this still doesn't work -
>         it stops
>         >     at the
>         >     > same cause:
>         >     >
>         >     > mkcontrast-sess -analysis PASAT.sm5.lh -contrast test
>         -a 1 -c 0
>         >     > INFO: Found 2 Non-Null Conditions
>         >     > INFO: Found 3 Delays
>         >     > Condition Weights: 1.00000000000000000000 0
>         >     > mkcontrast2 -config PASAT.sm5.lh/test.config -anadir
>         PASAT.sm5.lh
>         >     > -wcond 1.00000000000000000000 0 -sumconds -o
>         PASAT.sm5.lh/test.mat
>         >     > -wdelay 1 0 0 -octave
>         >     >   $Id: mkcontrast2,v 1.3 2016/03/11 23:46:48 greve Exp $
>         >     > cmtxfile  PASAT.sm5.lh/test.mat
>         >     > nconds    2,  wcond 1.00000000000000000000 0
>         >     > ndelays   3, wdelay 1 0 0
>         >     > ndelays   3, wpsa
>         >     > sumconds  1
>         >     > sumdelays 0
>         >     > nircorr   0
>         >     > TER       0.050000
>         >     > rdelta
>         >     > rtau
>         >     > ERROR: cannot find matlab. Is it in your path?
>         >     > ERROR running mkcontrast
>         >     > mkcontrast2 -config PASAT.sm5.lh/test.config -anadir
>         PASAT.sm5.lh
>         >     > -wcond 1.00000000000000000000 0 -sumconds -o
>         PASAT.sm5.lh/test.mat
>         >     > -wdelay 1 0 0 -octave
>         >     > Tue Jul  3 18:52:59 CEST 2018
>         >     >
>         >     > which is apparently when verifying the
>         $FS_MKCON_USE_BIN ? I don't
>         >     > have such a variable (I believe it wasn't necessary
>         with v5.3?).
>         >     > Looking for it I found that a bunch of environment
>         variables are
>         >     > advised in the new FS tutorial
>         >     >
>         (http://freesurfer.net/fswiki/FsTutorial/CourseLaptopSetup
>         <http://freesurfer.net/fswiki/FsTutorial/CourseLaptopSetup>
>         >   
>          <http://freesurfer.net/fswiki/FsTutorial/CourseLaptopSetup
>         <http://freesurfer.net/fswiki/FsTutorial/CourseLaptopSetup>>). I
>         >  should
>         >     > probably update the .bashrc file, but I would like to
>         clarify:
>         >     > 1. Are all of variables mentioned below needed for
>         proper v6.0
>         >     FS-Fast
>         >     > functioning or are some of them needed only for course
>         settings?
>         >     > FS_SPMREG_USE_BIN
>         >     > FS_MKCON_USE_BIN
>         >     > FS_SXA3_USE_BIN
>         >     These are only needed if you want to use the matlab binaries
>         >     > 2. To use octave instead of MATLAB - only the
>         $FS_MKCON_USE_BIN should
>         >     > be set to '0', or should I change any of the other two?
>         >     Just FS_MKCON_USE_BIN(or leave it undefined).
>         >     > 3. If all three are needed - what do the
>         $FS_SPMREG_USE_BIN and
>         >     > $FS_SXA3_USE_BIN stand for?
>         >     These are to use the matlab binaries when running these
>         programs
>         >     (binaries don't require a license). We do not use spm for
>         >     registration
>         >     anymore, so that this irrelevant. SXA3 refers to
>         selxavg3-sess.
>         >     > 4. Are there any other environment variables that
>         differ between the
>         >     > v.5.3 and v6.0 that I should also add?
>         >     I don't think so.
>         >     >
>         >     > Best regards,
>         >     > Patrycja
>         >     >
>         >     >
>         >     >
>         >     > 2018-07-03 18:31 GMT+02:00 Douglas N. Greve
>         >     <dgr...@mgh.harvard.edu <mailto:dgr...@mgh.harvard.edu>
>         <mailto:dgr...@mgh.harvard.edu <mailto:dgr...@mgh.harvard.edu>>
>         >     > <mailto:dgr...@mgh.harvard.edu
>         <mailto:dgr...@mgh.harvard.edu> <mailto:dgr...@mgh.harvard.edu
>         <mailto:dgr...@mgh.harvard.edu>>>>:
>         >  >
>         >     >     Sorry for the delay. I've put a new version here
>         >     >
>         https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2
>         <https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2>
>         >   
>          <https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2
>         <https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2>>
>         >     >
>         >   
>           <https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2
>         <https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2>
>         >   
>          <https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2
>         <https://gate.nmr.mgh.harvard.edu/safelinks/greve/mkcontrast2>>>
>         >     >     copy it to $FREESURFER_HOME/fsfast/bin
>         >     >
>         >     >
>         >     >
>         >     >
>         >     >     On 07/03/2018 12:13 PM, Patrycja Naumczyk wrote:
>         >     >     >
>         >     >     >
>         >     >     > Hi all,
>         >     >     >
>         >     >     > I'll repost - does FSv6 no longer support octave
>         for FS-Fast
>         >     >     processing?
>         >     >     >
>         >     >     > Would appreciate clarification on this :)
>         >     >     > Patrycja
>         >     >     >
>         >     >     > 2018-06-29 21:41 GMT+02:00 Patrycja Naumczyk
>         >     >     > <patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>
>         >     <mailto:patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>>
>         >     >     <mailto:patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>
>         >     <mailto:patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>>>
>         >     >     <mailto:patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>
>         >     <mailto:patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>>
>         >     >     <mailto:patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>
>         >     <mailto:patrycja.naumc...@gmail.com
>         <mailto:patrycja.naumc...@gmail.com>>>>>:
>         >     >     >
>         >     >     >     Hi all,
>         >     >     >
>         >     >     >     I just switched from FS 5.3 to 6.0 on Gentoo
>         Linux.
>         >     Previously
>         >     >     >     Freesurfer worked fine under octave setup (as
>         >     specified here:
>         >     >     >
>         >     >
>         >
>         
> https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>
>         >   
>          
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>>
>         >     >
>         >   
>           
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>
>         >   
>          
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>>>
>         >     >     >
>         >     >
>         >   
>            
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>
>         >   
>          
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>>
>         >     >
>         >   
>           
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>
>         >   
>          
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html
>         
> <https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-January/022135.html>>>>),
>         >     >     >     but after the update, when I tried testing a
>         MATLAB
>         >     related
>         >     >     >     function I get an error:
>         >     >     >
>         >     >     >     mkcontrast-sess -analysis PASAT.sm5.lh
>         -contrast test
>         >     -a 1 -c 0
>         >     >     >     INFO: Found 2 Non-Null Conditions
>         >     >     >     INFO: Found 3 Delays
>         >     >     >     Condition Weights: 1.00000000000000000000 0
>         >     >     >     mkcontrast2 -config PASAT.sm5.lh/test.config
>         -anadir
>         >     >     PASAT.sm5.lh
>         >     >     >     -wcond 1.00000000000000000000 0 -sumconds -o
>         >     >     PASAT.sm5.lh/test.mat
>         >     >     >     -wdelay 1 0 0 -octave
>         >     >     >       $Id: mkcontrast2,v 1.3 2016/03/11 23:46:48
>         greve Exp $
>         >     >     >     cmtxfile PASAT.sm5.lh/test.mat
>         >     >     >     nconds    2,  wcond 1.00000000000000000000 0
>         >     >     >     ndelays   3, wdelay 1 0 0
>         >     >     >     ndelays   3, wpsa
>         >     >     >     sumconds  1
>         >     >     >     sumdelays 0
>         >     >     >     nircorr   0
>         >     >     >     TER       0.050000
>         >     >     >     rdelta
>         >     >     >     rtau
>         >     >     >     ERROR: cannot find matlab. Is it in your path?
>         >     >     >     ERROR running mkcontrast
>         >     >     >     mkcontrast2 -config PASAT.sm5.lh/test.config
>         -anadir
>         >     >     PASAT.sm5.lh
>         >     >     >     -wcond 1.00000000000000000000 0 -sumconds -o
>         >     >     PASAT.sm5.lh/test.mat
>         >     >     >     -wdelay 1 0 0 -octave
>         >     >     >     Fri Jun 29 21:21:16 CEST 2018
>         >     >     >
>         >     >     >     It seems that the environment variable
>         (FS_USE_OCTAVE) is
>         >     >     >     recognized correctly (the function runs with
>         "-octave"
>         >     >     flag), but
>         >     >     >     somehow is omitted during execution? What
>         can I do
>         >     about it?
>         >     >     >
>         >     >     >     I checked that v.5.3 used mkcontrast,
>         whereas v.6.0 uses
>         >     >     >     mkcontrast2 which does not seem to support
>         octave? Is it
>         >     >     possible
>         >     >     >     to force calling mkcontrast instead of
>         mkcontrast2?
>         >     >     >
>         >     >     >     Best regards,
>         >     >     >     Patrycja
>         >     >     >
>         >     >     >
>         >     >     >
>         >     >     >
>         >     >     > _______________________________________________
>         >     >     > Freesurfer mailing list
>         >     >     > Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         >     <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>>
>         >     >     <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         >     <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>>>
>         >     >     >
>         > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>         >   
>          <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>
>         >     >   
>          <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>         >   
>          <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>>
>         >     >
>         >     >     _______________________________________________
>         >     >     Freesurfer mailing list
>         >     > Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         >     <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>>
>         >     <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         >    <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>>>
>         >     >
>         https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>         >   
>          <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>
>         >     >
>         >
>           <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>         >   
>          <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>>
>         >     >
>         >     >
>         >     >     The information in this e-mail is intended only
>         for the
>         >     person to
>         >     >     whom it is
>         >     >     addressed. If you believe this e-mail was sent to
>         you in
>         >     error and
>         >     >     the e-mail
>         >     >     contains patient information, please contact the
>         Partners
>         >     >     Compliance HelpLine at
>         >     > http://www.partners.org/complianceline
>         <http://www.partners.org/complianceline>
>         >     <http://www.partners.org/complianceline
>         <http://www.partners.org/complianceline>>
>         >     >     <http://www.partners.org/complianceline
>         <http://www.partners.org/complianceline>
>         >     <http://www.partners.org/complianceline
>         <http://www.partners.org/complianceline>>> . If the e-mail was
>         sent
>         >     >     to you in error
>         >     >     but does not contain patient information, please
>         contact the
>         >     >     sender and properly
>         >     >     dispose of the e-mail.
>         >     >
>         >     >
>         >     >
>         >     >
>         >     > _______________________________________________
>         >     > Freesurfer mailing list
>         >     > Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         >     <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>>
>         >     >
>         https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>         >   
>          <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>
>         >
>         >     _______________________________________________
>         >     Freesurfer mailing list
>         > Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         <mailto:Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>>
>         > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>         >   
>          <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>>
>         >
>         >
>         >
>         >
>         > _______________________________________________
>         > Freesurfer mailing list
>         > Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>
>         _______________________________________________
>         Freesurfer mailing list
>         Freesurfer@nmr.mgh.harvard.edu
>         <mailto:Freesurfer@nmr.mgh.harvard.edu>
>         https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>         <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer>
>
>
>
>
>
> _______________________________________________
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

Reply via email to