Commit 3d26d1cc authored by Christoph Arthofer's avatar Christoph Arthofer
Browse files

Delete cmore_run_reg2template.sh

parent 7a504cf6
#!/bin/bash
# Author: Christoph Arthofer
# Copyright: FMRIB 2021
TAG='cmore'
BASE_DIR="cmore/data/"
DATA_DIR="cmore/data/orig/"
ID_PATH="cmore/data/IDs.csv"
N_IMGS=$(cat ${ID_PATH} | wc -l)
AFF_IMG_REF_ID="T1_unbiased_affine_template_MNI_T1_brain"
NLN_IMG_REF_ID="unbiased_nonlinear_template_it18"
AFF_REF_DIR="template/affine/"
AFF_REF_PATH="${AFF_REF_DIR}${AFF_IMG_REF_ID}.nii.gz"
NLN_REF_DIR="template/nonlinear/"
NLN_REF_PATH="${NLN_REF_DIR}${NLN_IMG_REF_ID}.nii.gz"
PARAM_IT_PATH="${NLN_REF_DIR}mmorf_config.ini"
i_outp=0
# Create output directory for affine registrations
AFFINE_DIR="${BASE_DIR}affine/"
mkdir -p ${AFFINE_DIR}
# Register all individual images to the affine reference template
i_outp=$((i_outp+1))
printf -v i "%04d" $i_outp
qsub -o ${BASE_DIR}${i}_output_affine_FLIRT.log \
-N ${TAG}_registrations_affine_it1 \
-q short.qc \
-t 1-${N_IMGS}:1 \
cmore_FLIRT_registration.sh ${ID_PATH} ${DATA_DIR} ${AFFINE_DIR} ${AFF_REF_PATH} ${AFF_IMG_REF_ID}
# Register indivdiual T2 images to corresponding T1 images
i_outp=$((i_outp+1))
printf -v i "%04d" $i_outp
qsub -o ${BASE_DIR}${i}_output_affine_FLIRT_T2_2_T1_it1.log \
-N ${TAG}_registrations_affine_t2_2_t1_it1 \
-q short.qc \
-t 1-${N_IMGS}:1 \
cmore_FLIRT_registrations_T1_2_T2.sh ${ID_PATH} ${DATA_DIR} ${AFFINE_DIR}
i_outp=$((i_outp+1))
printf -v i "%04d" $i_outp
qsub -hold_jid ${TAG}_registrations_affine_t2_2_t1_it1,${TAG}_registrations_affine_testing_it1 \
-o ${BASE_DIR}${i}_output_affine_transform_T2_2_MNI.log \
-N ${TAG}_transform_T2_2_MNI \
-q short.qc \
-t 1-${N_IMGS}:1 \
cmore_applyxfm2T2.sh ${ID_PATH} ${AFFINE_DIR} ${DATA_DIR} ${AFF_IMG_REF_ID} ${AFF_REF_PATH}
# ----------------------------------------------------------------------------------------------------------------------
# Nonlinear registrations with MMORF
NLN_DIR="${BASE_DIR}nonlinear/"
mkdir -p ${NLN_DIR}
i_outp=$((i_outp+1))
printf -v i "%04d" $i_outp
REF_DIR=${NLN_REF_DIR}
REF_ID=${NLN_IMG_REF_ID}
qsub -hold_jid ${TAG}_transform_T2_2_MNI \
-o ${BASE_DIR}${i}_output_nln_registrations_it1.log \
-N ${TAG}_registrations_mmorf \
-q gpu8.q \
-l gpu=1 \
-l gputype=p100 \
-t 1-${N_IMGS}:1 \
cmore_mmorf.sh ${ID_PATH} ${REF_DIR} ${REF_ID} ${AFFINE_DIR} ${DATA_DIR} ${NLN_DIR} ${PARAM_IT_PATH}
# Applying unbiased warps to CMORE T1 whole-head images
IMG_PATH="${DATA_DIR}%03d/T1/T1_unbiased.nii.gz"
WARP_PATH="${NLN_DIR}%03d_to_unbiased_nonlinear_template_it18_warp.nii.gz"
WARPED_IMG_PATH="${NLN_DIR}%03d_to_unbiased_nonlinear_template_it18_T1_head.nii.gz"
WARPED_IMG_NORM_PATH="${NLN_DIR}%03d_to_unbiased_nonlinear_template_it18_T1_head_norm.nii.gz"
AFFMAT_PATH="${AFFINE_DIR}%03d_to_T1_unbiased_affine_template_MNI_T1_brain_T1reg.mat"
REF_PATH="${NLN_REF_DIR}unbiased_nonlinear_template_it18_T1_head.nii.gz"
i_outp=$((i_outp+1))
printf -v i "%04d" $i_outp
qsub -hold_jid ${TAG}_registrations_mmorf \
-o ${BASE_DIR}${i}_output_nln_applyUnbiased2T1Head_it1.log \
-N ${TAG}_nln_applyUnbiased2T1Head_it1 \
-q short.qc \
-t 1-${N_IMGS}:1 \
cmore_applyWarp.sh ${ID_PATH} ${IMG_PATH} ${WARP_PATH} ${WARPED_IMG_PATH} ${WARPED_IMG_NORM_PATH} ${AFFMAT_PATH} ${REF_PATH}
# Applying unbiased warps to CMORE T2 whole-head images
IMG_PATH="${DATA_DIR}%03d/T2_FLAIR/T2_FLAIR_unbiased.nii.gz"
WARP_PATH="${NLN_DIR}%03d_to_unbiased_nonlinear_template_it18_warp.nii.gz"
WARPED_IMG_PATH="${NLN_DIR}%03d_to_unbiased_nonlinear_template_it18_T2_head.nii.gz"
WARPED_IMG_NORM_PATH="${NLN_DIR}%03d_to_unbiased_nonlinear_template_it18_T2_head_norm.nii.gz"
AFFMAT_PATH="${AFFINE_DIR}%03d_to_T1_unbiased_affine_template_MNI_T1_brain_T2reg.mat"
REF_PATH="${NLN_REF_DIR}unbiased_nonlinear_template_it18_T2_head.nii.gz"
i_outp=$((i_outp+1))
printf -v i "%04d" $i_outp
qsub -hold_jid ${TAG}_registrations_mmorf \
-o ${BASE_DIR}${i}_output_nln_applyUnbiased2T1Head_it1.log \
-N ${TAG}_nln_applyUnbiased2T1Head_it1 \
-q short.qc \
-t 1-${N_IMGS}:1 \
cmore_applyWarp.sh ${ID_PATH} ${IMG_PATH} ${WARP_PATH} ${WARPED_IMG_PATH} ${WARPED_IMG_NORM_PATH} ${AFFMAT_PATH} ${REF_PATH}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment