Created
May 1, 2013 21:51
-
-
Save stowler/5498677 to your computer and use it in GitHub Desktop.
for meeting with Pearce and Evan: proof-of-concept parent script for PET & T1 coregistration to MNI152
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A short proof-of-concept script for meeting with Pearce and Evan (W, 20130501) | |
# | |
# Demonstrates adaptation of existing tools for automated PET->T1->MNI152 | |
# registration. | |
# | |
# INPUT: dicoms for a deidentified participant's T1 and PET sequences. | |
# | |
# OUTPUT: PET and T1 nifti volumes nonlinearly registered to MNI152 template (RPI). | |
# - LH/RH orientation: no fiducial marker. Relying on metadata chains: | |
# DICOM->bxh->NIFTI->NIFTI->NIFTI... | |
# | |
################################################# | |
# step 1/5 - prepare inputs and outputs: | |
################################################# | |
subj=tpAuto | |
inputDirT1Dicoms=~/Downloads/TP_MRI | |
inputDirPetDicoms=~/Downloads/TP_PET | |
bxhDir=~/Downloads/bxh_xcede_tools-1.10.7-lsb30.x86_64 | |
tempDir=/tmp | |
outDir=~/Downloads/TP_outputAutomated | |
rm -fr /tmp/${subj}* | |
rm -fr ${outDir} | |
mkdir ${outDir} | |
################################################# | |
# step 2/5 - convert T1 from dicoms to nifti: | |
################################################# | |
# ...here we invoke software from FSL and FBIRN: | |
${bxhDir}/bin/dicom2bxh ${inputDirT1Dicoms}/ser* ${tempDir}/${subj}_t1.bxh | |
${bxhDir}/bin/bxh2analyze --overwrite --nii ${tempDir}/${subj}_t1.bxh ${tempDir}/${subj}_t1 | |
fslreorient2std ${tempDir}/${subj}_t1.nii* ${outDir}/${subj}_t1.nii | |
################################################# | |
# step 3/5 - convert PET from dicoms to nifti: | |
################################################# | |
# ...here we invoke software from FSL and FBIRN: | |
${bxhDir}/bin/dicom2bxh ${inputDirPetDicoms}/ser* ${tempDir}/${subj}_pet.bxh | |
${bxhDir}/bin/bxh2analyze --overwrite --nii ${tempDir}/${subj}_pet.bxh ${tempDir}/${subj}_pet | |
fslreorient2std ${tempDir}/${subj}_pet.nii* ${outDir}/${subj}_pet.nii | |
################################################# | |
# step 4/5 - coregister PET and T1 to MNI152 template: | |
################################################# | |
# invoking a longer pre-existing script of mine that uses FSL to do the heavy | |
# lifting (bet for skull strip, flirt and fnirt for linear and nonlinear | |
# registration. Source code for that script: http://goo.gl/R0dpy ): | |
bash ~/brainwhere/registerTo1mmMNI152.sh \ | |
-s ${subj} \ | |
-t ${outDir}/${subj}_t1.nii* \ | |
-o ${outDir} \ | |
-e ${outDir}/${subj}_pet.nii* | |
################################################# | |
# step 5/5 - display the results interactively in fslview: | |
################################################# | |
fslview ${outDir}/*warp* & | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment