Hi Matthew,

On 05/12/2010 09:51 AM, R. Matthew Hutchison wrote:
Hi group,

I am starting with Caret and have gone through most of the tutorials using the data sets provided. The images are fantastic. The part I seem to be missing is actually getting *my* activation maps so that I can view them on the inflated surfaces.
If you use the menu 'Attributes', you'll find at the bottom 'Map Volumes(s) to Surface'. I guess that is what you want. Took me a while to find it as well ;-) .
I was wondering if anyone has a guide, steps, or hints in converting the output files from FSL FEAT (registered to a standard atlas using FSL FLIRT) to files viewable with Caret.
It seems this is not included in the tutorials.
T map macaque data of my individual monkeys to the caret F99 atlas, I used FSL's FNIRT for a nonlinear transformation. Doing this once in a way, that I was somehow satisfied with the result allows me to apply the transformation on the statistical maps, if they are in the individual monkey space. However, You might want to use the F99 atlas already as standard template in the Feat analysis (if it yields convincing results).

I attached a small script that transforms a set of nii.gz-Nifti files found within a directory into a new space according to a Flirt transformation matrix file (linear) or a 3D volume with warp-coefficients (Fnirt, nonlinear). Maybe this gives you an idea. I cannot guarantee that it is bugfree, but at least It did work for me.

A search of the archive does not turn up any recent information on the issue that I could find.

I am actually using macaque data but I figure the steps should be the same as with the human but using the F99 atlas.
Perhaps I am just missing something obvious?

I understand that my data must be registered to the atlas space that I wish to use in Caret. But which FSL file should be used and what is the next step so that I can view them? If it is registered to the atlas then there should be no need to segment the volumes again right?
You can use the zstat* images in the stats subdirecory of your copes as statistical map that you transform to the standars F99 space. In this case you can utilize the F99 segmentation, without segmenting the individual brains. However, in my opinion you are loosing the specificity of the localization, which in my view is one of the huge advantages of primate fMRI. So I do both, mapping data on individual brains, but also map all individuals on the standard atlas for comparision.

Thank you for any help (and patience for a novice),
I hope this gives you some pointers. Good luck anyway,
wolf


R.Matt Hutchison


--
R. Matthew Hutchison, PhD. Candidate
Centre for Functional and Metabolic Mapping
Robarts Research Institute
Cuddy Wing - 9.4T Suite
P.O. Box 5015, 100 Perth Drive
London, Ontario, Canada  N6A 5K8


_______________________________________________
caret-users mailing list
[email protected]
http://brainvis.wustl.edu/mailman/listinfo/caret-users

#!/bin/bash
#
# batch_transform
#
# created: 19.02.2010
# by wolf
#

Usage() {
cat << EOF

    Usage: $0 <trans_matrix> <ref_fl> [options]

        transforms a list of functional volumes using a given
        transformation matrix or warp coefficient volume

        if the first argument is a transformation matrix, flirt will be used;
        if it is a 3D volume file, fnirt is used.

    OPTIONS:
            -i      input directory - use all files found in this directory
                    default is the current directory
            -o      output directory
            -pf     prefix
            -sf     suffix
            -l      use this list of files
            -p      search pattern for getting the list ('ls 
*<pattern>*.nii.gz')
            -thr    lower threshold to be used after transformation
            -f      apply a threshold to functional data after transformation.
                    As default the minimum of original data is used as lower 
thresshold.
            -ip     interpolation type. nn (default), trilinear, sinc, spline 
(warp only)
            -m      create a transformed mask image in order to mask the data

            ###########################################################
            ##   (c) wolf zinke (2010) - part of the MaFIA toolbox   ##
            ##         > MAcaque Functional Image Analysis <         ##
            ##     for comments and questions: [email protected]     ##
            ###########################################################

EOF
exit 1

}

if [ $# -lt 2 ]; then
    Usage
else
    tmat=$1
    refim=$2
    shift 2
fi

#__________________________________________________________________________________________#

if [ ! -e $tmat ]
then
    echo "ERROR: Transformation matrix not found!"
    echo "       file: $tmat"
    exit
fi

if [ `imtest $tmat` -eq 1 ]
then
    do_warp=1
    ipstr='--interp=nn'
else
    do_warp=0
    ipstr='-interp nearestneighbour'
fi

if [ ! -e $refim ]
then
    echo "ERROR: reference image not found!"
    echo "       file: $refim"
    exit
fi


#__________________________________________________________________________________________#

odir=transformed
idir=`pwd`
get_list=1
prefix=''
suffix=''
get_thr=1
apply_thr=0
mask_img=0
pt=''
use_pt=0

while [ $# -gt 0 ] ;
do
    case $1 in
          -l)   fllst=$2
                get_list=0
                shift 2
                ;;
          -i)   idir=`cleanpath $2`
                shift 2
                ;;
          -o)   odir=`cleanpath $2`
                shift 2
                ;;
          -p)   pt="$2"
                use_pt=1
                shift 2
                ;;
         -sf)   suffix=$2
                shift 2
                ;;
         -pf)   prefix=$2
                shift 2
                ;;
        -thr)   thr=$2
                get_thr=0
                apply_thr=1
                shift 2
                ;;
          -f)   apply_thr=1
                shift
                ;;
         -ip)
                if [ $do_warp -eq 1 ]
                then
                    if [ $2 == 'nn' ]
                    then
                        ipstr='-interp nearestneighbour'
                    else
                        ipstr='-interp $2'
                    fi
                else
                    ipstr='--interp=$2'
                fi
                shift 2
                ;;
          -m)   mask_img=1
                shift
                ;;
          -*)   echo "Wrong option: <$1>"
                echo ""
                Usage
                ;;
           *)   break
                ;;
    esac
done

#__________________________________________________________________________________________#

if [ $get_list -eq 1 ]
then
    if [ $use_pt -eq 1 ]
    then
        fllst=""
        for cpt in $pt
        do
            fllst="$fllst `ls -1 $idir/*.nii.gz | grep "$cpt"`"
        done
    else
        fllst=`ls -1 $idir/*.nii.gz`
    fi
fi

if [ ! -d $odir ]
then
    mkdir $odir
fi

#__________________________________________________________________________________________#

for cfl in $fllst
do
    flnm=`basename $cfl`
    flnm=`remove_ext $flnm`
    onm=`echo $odir/${prefix}${flnm}${suffix}`

    if [ $do_warp -eq 0 ]
    then
        flirt -in $cfl -ref $refim -init $tmat $ipstr -applyxfm -out $onm
    else
        applywarp --ref=$refim --in=$cfl --out=$onm --warp=$tmat $ipstr
    fi

    if [ $(($mask_img + $get_thr)) -gt 0 ]
    then
        fslmaths $cfl -abs -bin tmp_cmask
    fi

    if [ $mask_img -eq 1 ]
    then
        if [ $do_warp -eq 0 ]
        then
            flirt -in tmp_cmask -ref $refim -init $tmat -applyxfm -out 
tmp_cmask_trans
        else
            applywarp --ref=$refim --in=tmp_cmask --out=tmp_cmask_trans 
--warp=$tmat $ipstr
        fi

        fslmaths tmp_cmask_trans -thr 0.25 -bin tmp_cmask_trans
        fslmaths $onm -mas tmp_cmask_trans $onm
    fi

    if [ $apply_thr -eq 1 ]
    then
        if [ $get_thr -eq 1 ]
        then
            thr=`fslstats $cfl -k tmp_cmask -a -R | cut  -d' ' -f1`
        fi
        fslmaths $onm -thr $thr $onm
    fi
done

#__________________________________________________________________________________________#

if [ -e tmp_cmask.nii.gz ]
then
    rm tmp_cmask.nii.gz
fi

if [ -e tmp_cmask_trans.nii.gz ]
then
    rm tmp_cmask_trans.nii.gz
fi

_______________________________________________
caret-users mailing list
[email protected]
http://brainvis.wustl.edu/mailman/listinfo/caret-users

Reply via email to