On May 28, 2009, at 11:10 AM, [email protected]
wrote:
Message: 5
Date: Thu, 28 May 2009 13:21:35 -0400
From: "Srihasam, Krishna" <[email protected]>
Subject: [Freesurfer] problems aligning fsfast functional to
anatomical..
To: "[email protected]" <[email protected]>
Message-ID:
<97172f7b8a916a44bf05ea8d13905ece4e174dc...@itccrmail02.med.harvard.edu
>
Content-Type: text/plain; charset="us-ascii"
Hi,
I am having trouble overlaying my functional data generate by FSFAST
stream onto the surfaces which I generated using Freesurfer. The
registration is going haywire. I used spmregister-sess and the
output registers coronal sections of the anatomical to horizontal
sections of the fMRI data. So, I tried using the original
anatomical image, not the surfaces I generated from it, the
registration looks great. I used mri_info to check the difference
between the images and my original anatomical image is 256x256x240
in size and its resolution is 0.5x0.5x0.5mm. The data seems to be
stored as float. The brainmask.mgz in the mri directory of where I
created the surfaces has different stats: 256x256x256 ; resolution:
1x1x1 and the data is in UCHAR. BTw, I am working on data from
monkey rain. Any help will be more that appreciated..
-Krishna
Yeah, to which anatomical did you coregister it? hopefully to the
256x256x256 volumes as this seems to be the base for the surface. How
did you create your surfaces in the first place? I think most monkey
people scan at 0.5mm isotropic, but tell freesurfer the
voxelresolution is 1mm isotropic, so that freesurfer does not degrade
the resolution. But that means you always have to coregister
functionals to the anatimcals with faked resolution (I like to pick
the T1.mgz, nu.mgz or even the rawavg.mgz but that changes between
sessions). This also means you will have to upscale the functionals by
at least a factor of two to account for the change of the anatomical
header. If its is helpful I can also send you a version of the script
that finally displays activation maps over volume and surface.
ahoi & good luck
Sebastian
This is the script I use to coregister functionals from fsfast
(vfreesurfer 3.0.5) to volumes, this will not work with 4.3.1 out of
the box, as it uses old formats and command line arguments, if I
recall correctly.
#! /bin/csh -f
# prepare the necessary steps for the registration of the functionals
to the structural scans
# this should allow arbitrary structurals
#TODO unify all register scripts (func2func func2arb_struct
func2struct func2session_struct)
#TODO: automagically load surface if one exists
cd ../mystudy
#1. create the subjectname file,
# this has to point to a valid subdirectory of freesurfers $SUBJECTDIR
# bail out if subjectname exists...
#EDIT THIS
set base_dir = /space/data/moeller/cooked
# define stuff for the coregistration
set redo_initial_reg = 1 # start with a fresh registration matrix
baesd on the headers...
set try_fsl_rigid_registration = 1 # use flirt for the initial matrix
set check_reg = 1 # if set to 1 display the registration in
tkregister2, otherwise skip
set edit_string = "--noedit"
set flirt_opts_string = #"-maxangle 15 -dof 6" # sometimes flirt needs
constraints...
set reg_id = #".chamber"#".electrode" # allow registation labels
# TREAT AS MAIN REGISTRATION?
set reg_2_main_struct = 1 # if one treat the structural as the main
structural (and create bold/register.dat)
# Napoleon face localiser, chamber coordinates
#set structural_session = 061119Napoleon
set structural_session = 080110QX90
#set targ_dir = ${base_dir}/${structural_session}/mri
set targ_dir = ${SUBJECTS_DIR}/${structural_session}/mri
set targ_vol = T1.mgz#rawavg.mgz
## Monchichi face localiser, chamber coordinates
#set structural_session = 070123Monchichi
#set targ_dir = ${base_dir}/anatomicals/${structural_session}/mri
#set targ_vol = nu_electrode.mgz
#set targ_dir = $targ_dir
# the volume to be moved
set mov_sess = `cat ./sf`
set mov_dir = ../t1epi
set mov_vol = fmc_000.bshort
echo $mov_sess
#2. create the t1epi directory for the registration
# and copy the first functional average into it
# why not simply symlink ../bold/101/001 to t1epi ???
set in_dir = ../bold/901/001
set out_dir = ../t1epi
set out_vol = tmp_fsl_rotated.${mov_sess}_2_${structural_session}$
{reg_id}
if !(-e ${out_dir}) then
mkdir ${out_dir}
cp ${in_dir}/fmc*.* ${out_dir}/
endif
#3. set the in_register.dat file (do not overwrite existing files)
set out_reg = ${mov_sess}_2_${structural_session}${reg_id}.register.dat
set out_reg_dir = ../t1epi
# create the initial registration...
if (!(-e ${out_reg_dir}/${out_reg}) || (${redo_initial_reg} == 1)) then
echo "Initial step, header creation..."
# the monkey structurals' scanned at 0.5mm have been imported
into freesurfer with the resolution forced to be 1.0mm
# so the functionals have to be scaled by the same factor of 2 to
allow the registration... (--noedit does not apply --movescale 2, so
skip this)
tkregister2 --sd ${targ_dir} --s ${structural_session} --targ $
{targ_dir}/${targ_vol} --mov ${mov_dir}/${mov_vol} --reg $
{out_reg_dir}/${out_reg} --regheader #--movscale 2 #--noedit
endif
# try to coregister the volumes using fsl's flirt...
if (${try_fsl_rigid_registration} == 1) then
if (!(-e ${out_reg_dir}/${out_reg}.done_by_fsl) || ($
{redo_initial_reg} == 1)) then
# now convert the initial registration matrix into fsl format, to
seed the registration...
set fs2fslreg = initxfm.fslmat
tkregister2 --targ ${targ_dir}/${targ_vol} --mov ${mov_dir}/$
{mov_vol} --s ${structural_session} --reg ${out_reg_dir}/${out_reg} $
{edit_string} --fslregout ${out_reg_dir}/${fs2fslreg}
echo "using FLIRT for registration... might take a while"
fsl_rigid_register -r ${targ_dir}/${targ_vol} -i ${mov_dir}/$
{mov_vol} -o ${out_dir}/${out_vol} \
-regmat ${out_reg_dir}/${out_reg} -initxfm ${out_reg_dir}/$
{fs2fslreg} ${flirt_opts_string}
#tkmedit -f ${out_dir}/${out_vol} -aux ${targ_dir}/${targ_vol}
touch ${out_reg_dir}/${out_reg}.done_by_fsl
endif
endif
if ((${%check_reg} > 0) & (${check_reg} == 1)) then
# actually register the session averages..
if ((-e ${targ_dir}/../surf/lh.white) && (-e ${targ_dir}/../surf/
lh.white)) then
tkregister2 --s ${structural_session} --targ ${targ_dir}/$
{targ_vol} --mov ${mov_dir}/${mov_vol} --reg ${out_reg_dir}/${out_reg}
--surf white
else
tkregister2 --sd ${targ_dir} --s ${structural_session} --targ $
{targ_dir}/${targ_vol} --mov ${mov_dir}/${mov_vol} --reg $
{out_reg_dir}/${out_reg} #--surf white
endif
endif
#6. copy register.dat into fsd (bold)
set reg_targ_dir = ../bold
set targ_reg = $out_reg
#cp ${out_reg_dir}/${out_reg} ${reg_targ_dir}/${targ_reg}
if !(-e ${reg_targ_dir}/regs) then
mkdir ${reg_targ_dir}/regs
endif
cp ${out_reg_dir}/${out_reg} ${reg_targ_dir}/regs/${targ_reg}
if (${reg_2_main_struct} == 1) then
echo "treating as main registration (creating bold/
register.dat)..."
cp ${out_reg_dir}/${out_reg} ${out_reg_dir}/$
{structural_session}.register.dat
cp ${out_reg_dir}/${out_reg} ${out_reg_dir}/register.dat
cp ${out_reg_dir}/${out_reg} ${reg_targ_dir}/register.dat
endif
# auto registration supposedly requires same session anatomicals...
#autoreg-sess –sf sessid –df sesspar
# last line follows...
--
Sebastian Moeller
telephone: 626-395-6713
German GSM: 0 15 77 - 1 90 31 41
[email protected]
Division of Biology
MC 114-96
California Institute of Technology
1200 East California Boulevard
CA 91125, Pasadena
USA
_______________________________________________
Freesurfer mailing list
[email protected]
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer