Hi all,
I am planning to use FATCAT and am preprocessing the data using fMRIPrep. The fMRIPrep by default uses the MNI152NLin2009cAsym template. Is this the same as the mni_icbm152_t1_tal_nlin_asym_09c.nii template that one can obtain online from the McDonnell BIC? I believe the 2009a version is the one that is modified in the fatcat_proc_mni_ref zip file, but I want to use the 2009c version to match with fMRIPrep.
If so, what steps do I need to do to convert it to something like mni_icbm152_t2_relx_tal_nlin_sym_09c_ACPCE.nii.gz? The two main differences seem to be that it is manually AC-PC aligned and regridded to have an even number of slices in all FOV planes. I guess the even numbers has to do with how AFNI finds the center of images? I’d like to have the wtell file, as well, but I don’t how to do that either. Any suggestions would be useful.
Thanks,
Matt
Hi, Matthew-
You should be able to use those other dsets. NB: I am not sure what FMRIprep’s dset is exactly—you could use AFNI’s 3dDiff to difference it with the MNI volume you cited.
The pair of FATCAT reference volumes (one pair for T1w, and one pair for T2w) are just: a template, and weightmask (with the weighting being an ellipsoid/spheroid in the subcortical region). In the original demo, the MNI template was tweaked to be ACPC aligned (because that was a focal aspect for collaborators). In your case, it sounds like you would not like this rotating associated with ACPC alignment, because you want to match a specific template space. That should be fine—the ACPC alignment is pretty minimal rotation, and is mostly for visualization aspects.
The recipe for making the pair of *ACPCE.nii.gz and *ACPCE_wtell.nii.gz dsets are in the 3dinfo -history ...
of each dset. But the following script should pick out the highlights and make the relevant datasets for you. So, if you save this as “do_new_fatproc_ref.tcsh”, you can run it as “tcsh do_new_fatproc_ref.tcsh”, and it should make the datasets of interest for you:
#!/bin/tcsh
# ----------------------- get data ---------------------------------
set my_mni = mni_icbm152_nlin_asym_09c # used to make new data
if ( ! -d ${my_mni} ) then
echo "++ Get MNI dir: ${my_mni}"
curl -O www.bic.mni.mcgill.ca/~vfonov/icbm/2009/${my_mni}_nifti.zip
unzip ${my_mni}_nifti.zip
if ( $status ) then
echo "** ERROR: problem getting my MNI: ${my_mni}"
exit 1
endif
endif
# ----------------------- proc data ---------------------------------
# get the T1, mask and T2 dsets
set dset_t1 = `\ls ${my_mni}/mni*_t1_*.nii | grep --color=never -v mask`
set dset_t2 = `\ls ${my_mni}/mni*_t2_*.nii`
set dset_mask = `\ls ${dset_t1:gas/.nii/_mask.nii/}`
echo "++ T1 dset is : ${dset_t1}"
echo "++ T2 dset is : ${dset_t2}"
echo "++ mask dset is : ${dset_mask}"
set dset_t1_mskd = `basename ${dset_t1:gas/.nii/_pseudoACPCE.nii.gz/}`
3dcalc \
-overwrite \
-a ${dset_mask} \
-b ${dset_t1} \
-expr 'a*b' \
-prefix ${dset_t1_mskd} \
-float
echo "++ Created masked t1: ${dset_t1_mskd}"
set dset_t2_mskd = `basename ${dset_t2:gas/.nii/_pseudoACPCE.nii.gz/}`
3dcalc \
-overwrite \
-a ${dset_mask} \
-b ${dset_t2} \
-expr 'a*b' \
-prefix ${dset_t2_mskd} \
-float
echo "++ Created masked t1: ${dset_t1_mskd}"
# make oblong weight
3dcalc \
-overwrite \
-a ${dset_mask} \
-expr 'step((1-(x-0)*(x-0)/(30**2)-(y-9)*(y-9)/(50**2)-(z-2)*(z-2)/(30**2)))' \
-prefix ELL.nii \
-float
3dmerge \
-overwrite \
-1blur_rms 4.2 \
-prefix ELLBLUR.nii \
ELL.nii
set dset_t1_wtell = `basename ${dset_t1:gas/.nii/_pseudoACPCE_wtell.nii.gz/}`
3dcalc \
-overwrite \
-a ${dset_t1_mskd} \
-b ELLBLUR.nii \
-expr 'a*(1+5*b)' \
-prefix ${dset_t1_wtell}
set dset_t2_wtell = `basename ${dset_t2:gas/.nii/_pseudoACPCE_wtell.nii.gz/}`
3dcalc \
-overwrite \
-a ${dset_t2_mskd} \
-b ELLBLUR.nii \
-expr 'a*(1+5*b)' \
-prefix ${dset_t2_wtell}
# clean
\rm ELL*.nii
cat <<EOF
++ DONE.
See the following dsets:
t2 masked ref template dset : ${dset_t2_mskd}
t2 masked 'ellipse weight' dset : ${dset_t2_wtell}
t1 masked ref template dset : ${dset_t1_mskd}
t1 masked 'ellipse weight' dset : ${dset_t1_wtell}
Though the MNI dsets here have not really been ACPC aligned (hence, the 'pseudo' in the name)
EOF
I don’t think it is necessary to resample it to RAI dset orientation, for example, which was done in the original.
Please let me know how that seems.
–pt
Dear Dr. Taylor,
This is incredibly helpful. Thanks so much!
One other question that is slightly related as I am not entirely familiar with some of the AFNI lingo: If I resample an image using 3dresample, is that equivalent to regridding it? I’m asking because the FATCAT tutorial specifies a “grid” with even numbers of slices, whereas fsl’s templates tend to have dimensions with odd numbers of slices in all directions. Or is that an issue dimensions are figured from the “edge of voxel” vs. “center of voxel”?
Best wishes,
Matt
Hi again,
The script seems to crash on the lines involving the :gas flag (e.g., set dset_mask = ls ${dset_t1:gas/.nii/_mask.nii/)
. Is there a way around that? Maybe just copy the image to the _mask.nii and then set that image to dset_mask?
Thanks,
matt
Hi again,
The script seems to crash on the lines involving the :gas flag (e.g., set dset_mask = ls ${dset_t1:gas/.nii/_mask.nii/)
. Is there a way around that? Maybe just copy the image to the _mask.nii and then set that image to dset_mask?
Thanks,
matt
Hi, Matt-
(Sidenote: “Paul”, please, instead of “Dr. Taylor”.)
3dresample can be used to adjust lots of dataset and header properties together—it assumes that things are correct to start with (in contrast to 3drefit, which is used to fix/change just header info, leaving the data unchanged).
You can resample to a new grid, yes, that is typically something that 3dresample is used for. After that, your dataset might still appear in the same spatial (xyz) location, but have different orientation or voxel size or matrix size or… something.
I don’t know that matrix dimensionality even/oddness is a requisite in AFNI—a benefit of even matrix sizes is that the left and right hemispheres can be easily split, rather than having a “zero” slice that is neither, for example.
–pt
Hi, Matt-
Are you runnign it as “tcsh”? the :gas/AAA/BBB/ should just be replacing AAA in the string with BBB. By all means, rename the dsets as appropriate.
(I am in Heathrow on way to OHBM, and need to board plane, might not be able to reply to third question quickly…)
–pt
Hi Matt-
The script did work OK for me, that is odd…
This line:
dset_mask = `ls ${dset_t1:gas/.nii/_mask.nii/)`
is just taking the string stored in ${dset_t1}, and replacing “.nii” from it with “_mask.nii”, and then searching for that new file name. You can just replace it with the actual dset name, I was aiming to generalize it, but certainly that could be hardwired to that actual file name in that subdir.
–pt
Thanks. That’s what I figured.
Enjoy OHBM! 