I have EPI and T2-weighted anatomical images. I am trying to do nonlinear warping of anatomical image to MNI template. However, T2 image (actually, T2 SPACE Dark Fluid, which means suppressed fluids) gave problematic results. Like that:
#!/bin/tcsh
### Define base directory and static filenames
set topdir = $cwd
set subj = "fibro_single"
set anat_file = "fibro_t2.nii.gz"
set template_file = "MNI152_2009_template_SSW.nii.gz"
echo "Warping subject: $subj"
# Create subject-specific directory structure
mkdir -p $topdir/$subj/anat_orig
mkdir -p $topdir/$subj/anat_warped
mkdir -p $topdir/$subj/anat_warped/snapshots
# Go to anat_orig directory
cd $topdir/$subj/anat_orig
# Create temp directory and copy subject T2-weighted image
mkdir -p temp_$subj
cp $topdir/$anat_file temp_$subj
cd temp_$subj
# Run AFNI @SSwarper
@SSwarper \
-input $anat_file \
-subid $subj \
-base $topdir/$template_file
# Compress output datasets (turns .nii into .nii.gz)
gzip -1v *.nii
# Move results to subject's anat_warped directory
\mv -f anatSS.${subj}.nii.gz anatQQ.${subj}.nii.gz \
anatQQ.${subj}.aff12.1D anatQQ.${subj}_WARP.nii.gz \
$topdir/$subj/anat_warped
# Move snapshots for visual QC
\mv -f *.jpg $topdir/$subj/anat_warped/snapshots
# Clean up temp directory
cd ..
\rm -rf temp_$subj
echo "Finished processing $subj"
exit 0
How can I overcome this problem? Unfortunately, I do not have T1 images and there is no possibility to obtain them. Thank you for your help in advance.
Since that is a T2w dataset being input, and the template file is a T1w dataset, you should probably use a different cost function to align across the opposite contrasts. (The default cost functions assume you are inputting a dset with similar tissue contrast to the template.)
I will also note that there is "sswarper2", which you could use, which is a more modern/updated version of the original @SSwarper. It has mostly the same options.
Assuming you are going for sswarper2, could you try adding these options:
... and see how it goes? If the initial affine alignment fails, you could try changing the first opt to:
-cost_aff lpc+ZZ
... which is a more stable version of the first one, but it runs a fair bit slower. NB: if you are going to stick with @SSwarper, you can do the same kind of thing, but there is no separate -cost_aff .. opt, so you would only ues the other two.
Note that sswarper2 creates automatic QC images of its results, too, so you can check them quickly and see results. Those files are called QC*. There is also a directory called ssw_align_hist.sub-000 that contains a running set of intermediate images, to see where things might be going awry.
Are you able to share any example datasets? That would help me run it and track the process, esp. through the QC images that are output, and see if I can offer a simpler way forward.
--pt
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.