I did not make any changes to bbregister.

Thank you for all your help.

Sal

On May 28, 2013 6:57 AM, "Douglas N Greve" <greve@nmr.mgh.harvard.edu> wrote:
and bbregister?

On 05/28/2013 02:03 AM, Salil Soman wrote:
It was attached to my earlier email (included again here). The only chnages I made are at lines 129 (set fsvol = brainmask) and 132 (echo "FSVOL $fsvol").

-S



On Mon, May 27, 2013 at 9:14 PM, Douglas Greve <greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>> wrote:

    Can you send me your original version of fslregister and bregister?


    On 5/27/13 10:53 PM, Salil Soman wrote:
    I have been using 5.3 of freesurfer for centos 6. As far as I can
    tell, the problem was with fslregister, which was getting called
    by bbregister. I've downloaded the link you just sent, remarked
    out the line I added to fslregister (see the file I sent in
    response to your email), and I get the same error. Restoring my
    modification makes the code work again.

    Thank you,

    Sal


    On Mon, May 27, 2013 at 7:43 PM, Douglas Greve
    <greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>> wrote:


        which version of FS are you using? This was a problem with
        5.2 but it should be fixed with 5.3.
        If you have 5.2 or earlier, you can use this version of
        bbregister
        ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/bbregister

        doug


        On 5/27/13 10:32 PM, Salil Soman wrote:
        Thank you Doug,

        fsvol was defined, which was why I was confused. I put in a
        command to echo the fsvol value in the line before where the
        error was getting generated, and it echoed "ERROR". Adding a
        line specifically defining fsvol using set in the section
        fixed the problem (as far as I can tell).

        -Sal


        On Mon, May 27, 2013 at 7:16 PM, Douglas Greve
        <greve@nmr.mgh.harvard.edu
        <mailto:greve@nmr.mgh.harvard.edu>> wrote:

            Hi Sal, fsvol should be defined. Can you send me your
            fslregister?
            doug



            On 5/26/13 12:58 AM, Salil Soman wrote:
            Dear Freesurfer experts,

            WIth the combination of FS 5.3 and FSL 5.0.2.1, It
            looks like I am having some problems with the
            fslregister script. From what I have been able to
            investigate. It looks like there is an issue that fsvol
            may not get named if you are not dealing .cor files.

            Code in question from fslregister script:

            # Use the rawavg as input (for testing only)
            if($fsvol == rawavg.cor) then
              set refvol = $SUBJECTS_DIR/$subjid/mri/$fsvol.mgz
              if(! -e $refvol) then
                # Does not exist, create
                set orig = $SUBJECTS_DIR/$subjid/mri/orig.mgz
                set rawavg = $SUBJECTS_DIR/$subjid/mri/rawavg.mgz
                set cmd = (mri_vol2vol --mov $rawavg --targ $orig
            --o $refvol \
            --no-save-reg --regheader)
                echo $cmd |& tee -a $LF
                $cmd |& tee -a $LF
                if($status) exit 1;
                # Now mask it
                set brain = $SUBJECTS_DIR/$subjid/mri/brainmask.mgz
                set cmd = (mri_mask $refvol $brain $refvol)
                echo $cmd |& tee -a $LF
                $cmd |& tee -a $LF

            I think this lack of fsvol being named results in the
            errors I am getting:

            --------------------------------------
            /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS
            mri_convert ERROR: could not determine file for
            /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS/mri/ERROR:
            ./tmp.bbregister.756/fslregister/refvol.fslregister.nii
            mri_convert ERROR: could not determine file for
            /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS/mri/ERROR:
            ./tmp.bbregister.756/fslregister/refvol.fslregister.nii

            mri_convert: extra arguments ("not" and following)

            Any suggestions would be a huge help.

            -Sal




            On Sat, May 25, 2013 at 8:35 PM, Salil Soman
            <salsoman@stanford.edu <mailto:salsoman@stanford.edu>>
            wrote:

                Done. Thank you for your consideration. The best I
                can figure so far is
                1) the script's attempt to make the
                tmp.bbregister.7392 directory fails
                and 2) (after I manually make this directory),
                there seems to be something going wrong at the
                level of fslregister

                I have fsl 5.0.2.1 and freesurfer 5.3 running, and
                am regularly able to run freesurfer and
                tracula (using only the flirt method, the bbr
                method was giving me trouble as well).

                The code is all running on a sun grid engine, with
                individual ubuntu 12.04.1 LTS machines.

                Your help on this matter would be greatly appreciated.

                Sal



                On Sat, May 25, 2013 at 8:23 PM, Douglas Greve
                <greve@nmr.mgh.harvard.edu
                <mailto:greve@nmr.mgh.harvard.edu>> wrote:

                    Hi Sal, can you post this to the list instead
                    of me directly?
                    thanks!
                    doug



                    On 5/25/13 11:00 PM, Salil Soman wrote:
                    Dear Doug,

                    I attempted to run the process we discussed
                    earlier today for registering a different
                    tissue contrast to the T1 after freesurfer 5.3
                    was run.

                    I had run an FSSPGR for my subject using the
                    following command:

                    recon-all -i SPGR/*.gz -s WMR3T_0015z_FS
                    -nuintensitycor-3T -nocanorm -openmp 50
                    -hippo-subfields -all

                    It finished without any problems.

                    Then I tried running the bbrregister command:

                    bbregister --s WMR3T_0015z_FS --mov
                    QSM_906.nii.gz --init-fsl --reg register.dat
                    --bold

                    (this version was with bold contrast, but I
                    get the same error if I try t1 or t2).

                    The process fails and I get the following
                    error log (below). Any suggestions on what I
                    am doing wrong?

                    Thanks,

                    Sal

                    ---------- Forwarded message ----------
                    From: *Salil Soman* <salsoman@stanford.edu
                    <mailto:salsoman@stanford.edu>>
                    Date: Sat, May 25, 2013 at 7:54 PM
                    Subject: bbregister fail log
                    To: salsoman@stanford.edu
                    <mailto:salsoman@stanford.edu>


                    Logfile for bbregister
                    Sat May 25 19:51:15 PDT 2013

                    setenv SUBJECTS_DIR
                    /mnt/glusterfs/salsoman/output/FS
                    cd
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS
                    /mnt/glusterfs/salsoman/freesurfer/bin/bbregister
                    --s WMR3T_0015z_FS --mov QSM_906.nii.gz
                    --init-fsl --reg register.dat --bold

                    $Id: bbregister,v 1.49.2.2 2013/02/23 01:32:22
                    mreuter Exp $
                    Linux corn18.stanford.edu
                    <http://corn18.stanford.edu> 3.2.0-36-generic
                    #57-Ubuntu SMP Tue Jan 8 21:44:52 UTC 2013
                    x86_64 x86_64 x86_64 GNU/Linux
                    FREESURFER_HOME /mnt/glusterfs/salsoman/freesurfer
                    mri_convert QSM_906.nii.gz
                    ./tmp.bbregister.26724/template.nii
                    mri_convert QSM_906.nii.gz
                    ./tmp.bbregister.26724/template.nii
                    $Id: mri_convert.c,v 1.179.2.7 2012/09/05
                    21:55:16 mreuter Exp $
                    reading from QSM_906.nii.gz...
                    TR=98.00, TE=0.00, TI=0.00, flip angle=0.00
                    i_ras = (-1, 0, 0)
                    j_ras = (0, 0.313177, 0.949695)
                    k_ras = (0, -0.949695, 0.313177)
                    writing to ./tmp.bbregister.26724/template.nii...
                    fslregister --s WMR3T_0015z_FS --mov
                    ./tmp.bbregister.26724/template.nii --reg
                    ./tmp.bbregister.26724/reg.init.dat --niters 1
                    --maxangle 90 --nobetmov --tmp
                    ./tmp.bbregister.26724/fslregister --dof 6
                    --fsvol brainmask

                    Log file is
                    ./tmp.bbregister.26724/reg.init.dat.fslregister.log

                    Sat May 25 19:51:17 PDT 2013
                    --s WMR3T_0015z_FS --mov
                    ./tmp.bbregister.26724/template.nii --reg
                    ./tmp.bbregister.26724/reg.init.dat --niters 1
                    --maxangle 90 --nobetmov --tmp
                    ./tmp.bbregister.26724/fslregister --dof 6
                    --fsvol brainmask
                    $Id: fslregister,v 1.34.2.2 2012/11/08
                    16:18:56 greve Exp $
                    corn18.stanford.edu <http://corn18.stanford.edu>
                    Linux corn18.stanford.edu
                    <http://corn18.stanford.edu> 3.2.0-36-generic
                    #57-Ubuntu SMP Tue Jan 8 21:44:52 UTC 2013
                    x86_64 x86_64 x86_64 GNU/Linux
                    nIters 1
                    --------------------------------------
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS
                    mri_convert ERROR: could not determine file
                    for
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS/mri/ERROR:
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister.nii
                    mri_convert ERROR: could not determine file
                    for
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS/mri/ERROR:
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister.nii

                    mri_convert: extra arguments ("not" and following)

                    type mri_convert -u for usage

                    --------------------------------------
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS
                    mri_convert
                    ./tmp.bbregister.26724/template.nii
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii
                    --frame 0
                    mri_convert
                    ./tmp.bbregister.26724/template.nii
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii
                    --frame 0
                    $Id: mri_convert.c,v 1.179.2.7 2012/09/05
                    21:55:16 mreuter Exp $
                    reading from
                    ./tmp.bbregister.26724/template.nii...
                    TR=98.00, TE=0.00, TI=0.00, flip angle=0.00
                    i_ras = (-1, 0, 0)
                    j_ras = (0, 0.313177, 0.949695)
                    k_ras = (0, -0.949695, 0.313177)
                    keeping frame 0
                    writing to
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii...
                    Mov determinant is -0.984886
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS
                    tkregister2_cmdl --mov
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii
                    --reg
                    ./tmp.bbregister.26724/fslregister/reg0.26760.dat
                    --regheader --fslregout
                    ./tmp.bbregister.26724/reg.init.dat.fsl.mat0
                    --s WMR3T_0015z_FS --noedit
                    tkregister_tcl
                    /mnt/glusterfs/salsoman/freesurfer/tktools/tkregister2.tcl
                    INFO: no target volume specified, assuming
                    FreeSurfer orig volume.
                    target  volume orig
                    movable volume
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii
                    reg file
                    ./tmp.bbregister.26724/fslregister/reg0.26760.dat
                    LoadVol  0
                    ZeroCRAS 0
                    $Id: tkregister2.c,v 1.121.2.1 2011/03/28
                    20:25:16 greve Exp $
                    Diagnostic Level -1
                    INFO: loading target
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS/mri/orig.mgz
                    Ttarg: --------------------
                    -1.000   0.000   0.000 128.000;
                     0.000   0.000   1.000  -128.000;
                     0.000  -1.000   0.000 128.000;
                     0.000   0.000   0.000 1.000;
                    INFO: loading movable
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii
                    Tmov: --------------------
                    -1.000   0.000   0.000 112.000;
                     0.000   0.000   0.985  -83.715;
                     0.000  -1.000   0.000 112.000;
                     0.000   0.000   0.000 1.000;
                    mkheaderreg = 1, float2int = 0
                    Computing reg from header (and possibly input
                    matrix)
                    ---- Input registration matrix (computed) --------
                     1.000  -0.000  -0.000 1.591;
                    -0.000  -0.950   0.313 0.719;
                     0.000  -0.313  -0.950  -5.896;
                     0.000   0.000   0.000 1.000;
                    ---------------------------------------
                    ---- Input registration matrix --------
                     1.000  -0.000  -0.000 1.591;
                    -0.000  -0.950   0.313 0.719;
                     0.000  -0.313  -0.950  -5.896;
                     0.000   0.000   0.000 1.000;
                    Determinant 1
                    subject = WMR3T_0015z_FS
                    RegMat ---------------------------
                     1.000  -0.000  -0.000 1.591;
                    -0.000  -0.950   0.313 0.719;
                     0.000  -0.313  -0.950  -5.896;
                     0.000   0.000   0.000 1.000;
                    FSLOUTPUTTYPE NIFTI
                    tkreg2FSL: mov det = -0.984886, ref det = -1
                    Sat May 25 19:51:22 PDT 2013
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS
                    flirt.fsl -ref
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister.nii
                    -in
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii
                    -bins 256 -cost corratio -dof 6 -searchrx -90
                    90 -searchry -90 90 -searchrz -90 90 -verbose
                    0 -omat
                    ./tmp.bbregister.26724/fslregister/fslmat0.trans.mat
                    -schedule
                    /mnt/glusterfs/salsoman/fsl/etc/flirtsch/xyztrans.sch
                    -init ./tmp.bbregister.26724/reg.init.dat.fsl.mat0
                    ** ERROR (nifti_image_read): failed to find
                    header file for
                    './tmp.bbregister.26724/fslregister/refvol.fslregister'
                    ** ERROR:
                    nifti_image_open(./tmp.bbregister.26724/fslregister/refvol.fslregister):
                    bad header info
                    ERROR: failed to open file
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister
                    ERROR: Could not open image
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister
                    Image Exception : #22 :: Failed to read volume
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister.nii
                    terminate called after throwing an instance of
                    'RBD_COMMON::BaseException'
                    Abort
                    Sat May 25 19:51:22 PDT 2013
                    /mnt/glusterfs/salsoman/output/FS/WMR3T_0015z_FS
                    flirt.fsl -ref
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister.nii
                    -in
                    ./tmp.bbregister.26724/fslregister/movvol.fslregister.nii
                    -bins 256 -cost corratio -dof 6 -searchrx -90
                    90 -searchry -90 90 -searchrz -90 90 -verbose
                    0 -omat
                    ./tmp.bbregister.26724/reg.init.dat.fsl.mat
                    -init
                    ./tmp.bbregister.26724/fslregister/fslmat0.trans.mat
                    -schedule
                    /mnt/glusterfs/salsoman/freesurfer/bin/flirt.newdefault.20080811.sch
                    ** ERROR (nifti_image_read): failed to find
                    header file for
                    './tmp.bbregister.26724/fslregister/refvol.fslregister'
                    ** ERROR:
                    nifti_image_open(./tmp.bbregister.26724/fslregister/refvol.fslregister):
                    bad header info
                    ERROR: failed to open file
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister
                    ERROR: Could not open image
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister
                    Image Exception : #22 :: Failed to read volume
                    ./tmp.bbregister.26724/fslregister/refvol.fslregister.nii
                    terminate called after throwing an instance of
                    'RBD_COMMON::BaseException'
                    Abort
                    tkregister2_cmdl --s WMR3T_0015z_FS --mov
                    ./tmp.bbregister.26724/template.nii --reg
                    ./tmp.bbregister.26724/reg.init.dat --fslreg
                    ./tmp.bbregister.26724/reg.init.dat.fsl.mat
                    --noedit
                    tkregister_tcl
                    /mnt/glusterfs/salsoman/freesurfer/tktools/tkregister2.tcl
                    ERROR: cannot open
                    ./tmp.bbregister.26724/reg.init.dat.fsl.mat
                    cat: ./tmp.bbregister.26724/reg.init.dat: No
                    such file or directory
                    tmp: Subscript out of range.

                    Started at Sat May 25 19:51:17 PDT 2013
                    Ended   at Sat May 25 19:51:23 PDT 2013

                    fslregister Done

                    To check results, run:
                    tkregister2 --mov
                    ./tmp.bbregister.26724/template.nii --reg
                    ./tmp.bbregister.26724/reg.init.dat --surf orig

                    mri_segreg --mov
                    ./tmp.bbregister.26724/template.nii --init-reg
                    ./tmp.bbregister.26724/reg.init.dat --out-reg
                    ./tmp.bbregister.26724/bbr.pass1.dat
                    --subsamp-brute 100 --subsamp 100 --tol 1e-4
                    --tol1d 1e-3 --brute -4 4 4 --surf white
                    --gm-proj-frac 0.5 --gm-gt-wm 0.5
                    regio_read_register(): No such file or directory
                    Could not open ./tmp.bbregister.26724/reg.init.dat
                    mri_segreg --mov
                    ./tmp.bbregister.26724/template.nii --init-reg
                    ./tmp.bbregister.26724/bbr.pass1.dat --out-reg
                    register.dat --brute -0.1 0.1 0.1 --interp
                    trilinear --wm-proj-abs 2 --tol 1e-8 --tol1d
                    1e-3 --c0 0 --mincost register.dat.mincost
                    --dof 6 --nmax 36 --param register.dat.param
                    --surf white --cur-reg
                    ./tmp.bbregister.26724/reg.curopt.dat
                    --gm-proj-frac 0.5 --nsub 1 --gm-gt-wm 0.5
                    regio_read_register(): No such file or directory
                    Could not open
                    ./tmp.bbregister.26724/bbr.pass1.dat
                    Cleaning up

                    Started at Sat May 25 19:51:15 PDT 2013
                    Ended   at Sat May 25 19:51:24 PDT 2013
                    BBR-Run-Time-Sec 9

                    bbregister Done
                    To check results, run:
                    tkregister2 --mov QSM_906.nii.gz --reg
                    register.dat --surf


                    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 . 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.










--
Douglas N. Greve, Ph.D.
MGH-NMR Center
greve@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/