Commit 584ded32 authored by Alberto Lazari's avatar Alberto Lazari
Browse files

updated pipelines for DWI

parent 80654cf3
#!/usr/bin/env bash
# definitions
#workDir=/vols/Scratch/alazari/longitudinal_paTMS/resting_state
workDir=/home/fs0/ndcn0979/scratch/Adrianna/BET
scriptDir=/home/fs0/ndcn0979/scratch/Adrianna/Scripts
fixDir=/home/fs0/ndcn0979/scratch/Adrianna/Scripts/fix
module load fix
#Do 03-3185 manually because of 176 thresholds
for subj in 3185
#1070 1079 3178 3179 3180 3181 3182 3183 3184 3186 3187 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 ;
do
echo $subj
echo "FIX $subj"
for time in PRE POST FOLLOWUP;
do
echo $time
# specify the subjects
#subjList="
#1070 1079 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200"
# Change permission
echo change permission of folder
# chmod 777 $workDir/03-"$subj"/"$time"/RestingState/
# chmod 777 $workDir/03-"$subj"/"$time"/RestingState/*
# chmod 777 $workDir/03-"$subj"/"$time"/RestingState/*/*
# chmod 777 $workDir/03-"$subj"/"$time"/RestingState/*/*/*
# chmod 777 $workDir/03-"$subj"/"$time"/RestingState/*/*/*/*
# chmod 777 $workDir/03-"$subj"/"$time"/RestingState/*/*/*/*/*
# prepare the .sh file to apply FIX classifier for each fix_reg
$workDir/03-"$subj"/"$time"/RestingState/fix_reg.ica
#Make sure you can find fix_reg.ica for each subj/time
#find $workDir/03-"$subj"/"$time"/RestingState/fix_reg.ica # comment out the rest before you run
# Execute FIX
$fixDir/training_file/Standard.RData 5
fsl_sub -q veryshort.q fix $workDir/03-"$subj"/"$time"/RestingState/fix_reg.ica /home/fs0/home/ndcn0979/scratch/Adrianna/Scripts/fix/training_file/Standard.RData 5 -m -h -0
# Apply fix clean up
# `fix_clean=` fsl_sub -q veryshort.q -j ${fix_classify} $fixDir/fix/fix -a $workDir/03-"$subj"/"$time"/RestingState/"$subj""$time"/"$subj"_"$time".ica/fix4melview_Rstandard_classifier_thr5.txt -m -h -0 done
#$workDir/03-"$subj"/"$time"/RestingState/"$subj""$time".fsf
#sed -i "s/XXX/"$subj"g" $workDir/03-"$subj"/"$time"/RestingState/"$subj""$time".fsf
#sed -i "s/YYY/"$time"g" $workDir/03-"$subj"/"$time"/RestingState/"$subj""$time".fsf
# run the .fsf design on feat
# fsl_sub -q short.q -s openmp,2 feat $workDir/"$subj"/"$subj"
#fsl_sub -q long.q -s openmp,2 feat $workDir/03-"$subj"/"$time"/RestingState/"$subj""$time"
echo "done"
done
done
# Mini-Guide
STEP 1. Run Cristiana's wrapper (diffpostproc_pipeline_full.sh)
# DIFFUSION
Relevant scripts:
wrapper_Cristiana_pipeline.sh
wrapper_NODDI_and_b0.sh
copy_niftis_and_mncs.sh
STEP 2. Extract average b0 + run Amy's run_NODDI.sh
STEP 1. Run Cristiana's wrapper (diffpostproc_pipeline_full.sh)
STEP 3. Run Amy's run_NODDI_cleanup.sh - which extracts NODDI parameters
STEP 2. Extract average b0 + run Amy's run_NODDI.sh (wrapper_NODDI_and_b0.sh)
STEP 4. Run Cristiana's full clean-up with diff_cleanup.sh
STEP 3. Run Cristiana's clean-up script to free up space in the directories
STEP 5. Run wrapper to copy files and convert to mnc (copying ODI and fintra/NDI, but not fiso)
STEP 4. Run wrapper to copy files and convert to mnc (copying ODI and fintra/NDI, but not fiso)
STEP 6. Offline QC and import to Graham for registration of average b0s
# QSN
# Notes: no b0 needed?
# Select a good echo that you can use with MBM first
STEP 1. Run registration with MBM on one of the echoes, so you can get a good brain mask. Use the same initial model as for the diffusion data.
STEP 2. Convert mask to nifti and expand it.
STEP 3. Run Cristiana's pipeline.
\ No newline at end of file
......@@ -3,22 +3,21 @@
# definitions
scriptDir=/vols/Scratch/alazari/preclinicalMPM_scripts/
subjList="MS80@20210312_192904_MS80_Merima_Doldcr_T2w_Diffusion_1_3"
# "20210301_160217_MS74_MS74_MCAO_T2w_Diffusion_QSM_round2_1_3
# 20210302_195833_MS75_MS74_MCAO_T2w_Diffusion_QSM_1_2
# 20210315_184117_MS95_MS95_Merima_Doldcr_T2w_Diffusion_1_1
# 20210303_164834_MS76_MS76_MCAO_T2w_Diffusion_QSM_round2_1_2
# 20210304_165220_MS78_MS78_MCAO_T2w_Diffusion_QSM_round2_1_2
# 20210316_193017_MS77_MS77_Merima_Doldcr_T2w_Diffusion_1_3
# 20210305_205129_MS93_N_Merima_Doldcr_T2w_Diffusion_1_1
# 20210308_191125_MS86_Merima_Doldcr_T2w_Diffusion_1_2
# 20210317_190003_MS94_MS94_Merima_Doldcr_T2w_Diffusion_1_3
# 20210309_174418_MS88_Merima_Doldcd_T2w_Diffusion_1_1
# 20210311_174652_MS79_MS79_Merima_Doldcd_T2w_Diffusion_1_3
# 20210322_155431_MS73_MS73_Merima_Doldcd_T2w_Diffusion_1_5
# 20210323_182201_MS87_MS87_Merima_Doldcd_Tw2_Diffusion_1_6
# 20210319_194410_MS85_MS85_Merima_Doldcr_T2w_Diffusion2_1_4"
subjList="MS80@20210312_192904_MS80_Merima_Doldcr_T2w_Diffusion_1_3
MS74@20210301_160217_MS74_MS74_MCAO_T2w_Diffusion_QSM_round2_1_3
MS75@20210302_195833_MS75_MS74_MCAO_T2w_Diffusion_QSM_1_2
MS95@20210315_184117_MS95_MS95_Merima_Doldcr_T2w_Diffusion_1_1
MS76@20210303_164834_MS76_MS76_MCAO_T2w_Diffusion_QSM_round2_1_2
MS78@20210304_165220_MS78_MS78_MCAO_T2w_Diffusion_QSM_round2_1_2
MS77@20210316_193017_MS77_MS77_Merima_Doldcr_T2w_Diffusion_1_3
MS93@20210305_205129_MS93_N_Merima_Doldcr_T2w_Diffusion_1_1
MS86@20210308_191125_MS86_Merima_Doldcr_T2w_Diffusion_1_2
MS94@20210317_190003_MS94_MS94_Merima_Doldcr_T2w_Diffusion_1_3
MS88@20210309_174418_MS88_Merima_Doldcd_T2w_Diffusion_1_1
MS79@20210311_174652_MS79_MS79_Merima_Doldcd_T2w_Diffusion_1_3
MS73@20210322_155431_MS73_MS73_Merima_Doldcd_T2w_Diffusion_1_5
MS87@20210323_182201_MS87_MS87_Merima_Doldcd_Tw2_Diffusion_1_6
MS85@20210319_194410_MS85_MS85_Merima_Doldcr_T2w_Diffusion2_1_4"
for subjScan in $subjList; do
......@@ -35,35 +34,45 @@ for subjScan in $subjList; do
mkdir -p $outDirMNC
# copy the average b0 (input for MBM for diffusion)
cp $workDir/data_gibbs_eddy_b0_mean.nii.gz $outDir/"$subj"_data_gibbs_eddy_b0_mean.nii.gz
# copy the DTIFIT outputs
cp $workDir/dtifit_gibbs_eddy/dtifit_gibbs_eddy_MD.nii.gz $outDir/"$subj"_MD.nii.gz
cp $workDir/dtifit_gibbs_eddy/dtifit_gibbs_eddy_FA.nii.gz $outDir/"$subj"_FA.nii.gz
cp $workDir/dtifit_gibbs_eddy/dtifit_gibbs_eddy_V1.nii.gz $outDir/"$subj"_V1.nii.gz
# copy the NODDI outputs
cp $workDir/data_noddi_bpx.NODDI_Watson_diff_exvivo/mean_fintra.nii.gz $outDir/"$subj"_mean_fintra.nii.gz
cp $workDir/data_noddi_bpx.NODDI_Watson_diff_exvivo/OD.nii.gz $outDir/"$subj"_OD.nii.gz
# convert everything to MNC
gunzip $outDir/"$subj"_data_gibbs_eddy_b0_mean.nii.gz
nii2mnc $outDir/"$subj"_data_gibbs_eddy_b0_mean.nii $outDirMNC/"$subj"_data_gibbs_eddy_b0_mean.mnc
gunzip $outDir/"$subj"_MD.nii.gz
nii2mnc $outDir/"$subj"_MD.nii $outDirMNC/"$subj"_MD.mnc
gunzip $outDir/"$subj"_V1.nii.gz
nii2mnc $outDir/"$subj"_V1.nii $outDirMNC/"$subj"_V1.mnc
gunzip $outDir/"$subj"_FA.nii.gz
nii2mnc $outDir/"$subj"_FA.nii $outDirMNC/"$subj"_FA.mnc
gunzip $outDir/"$subj"_mean_fintra.nii.gz
nii2mnc $outDir/"$subj"_mean_fintra.nii $outDirMNC/"$subj"_mean_fintra.mnc
gunzip $outDir/"$subj"_OD.nii.gz
nii2mnc $outDir/"$subj"_OD.nii $outDirMNC/"$subj"_OD.mnc
# cp $workDir/data_gibbs_eddy_b0_mean.nii.gz $outDir/"$subj"_data_gibbs_eddy_b0_mean.nii.gz
#
# # copy the DTIFIT outputs
# cp $workDir/dtifit_gibbs_eddy/dtifit_gibbs_eddy_MD.nii.gz $outDir/"$subj"_MD.nii.gz
# cp $workDir/dtifit_gibbs_eddy/dtifit_gibbs_eddy_FA.nii.gz $outDir/"$subj"_FA.nii.gz
# cp $workDir/dtifit_gibbs_eddy/dtifit_gibbs_eddy_V1.nii.gz $outDir/"$subj"_V1.nii.gz
#
# # copy the NODDI outputs
# cp $workDir/data_noddi_bpx.NODDI_Watson_diff_exvivo/mean_fintra.nii.gz $outDir/"$subj"_mean_fintra_56.nii.gz
# cp $workDir/data_noddi_bpx.NODDI_Watson_diff_exvivo/OD.nii.gz $outDir/"$subj"_OD_56.nii.gz
#
# # convert everything to MNC
# gunzip $outDir/"$subj"_data_gibbs_eddy_b0_mean.nii.gz
# nii2mnc $outDir/"$subj"_data_gibbs_eddy_b0_mean.nii $outDirMNC/"$subj"_data_gibbs_eddy_b0_mean.mnc
#
# gunzip $outDir/"$subj"_MD.nii.gz
# nii2mnc $outDir/"$subj"_MD.nii $outDirMNC/"$subj"_MD.mnc
#
# gunzip $outDir/"$subj"_V1.nii.gz
# nii2mnc $outDir/"$subj"_V1.nii $outDirMNC/"$subj"_V1.mnc
#
# gunzip $outDir/"$subj"_FA.nii.gz
# nii2mnc $outDir/"$subj"_FA.nii $outDirMNC/"$subj"_FA.mnc
#
# gunzip $outDir/"$subj"_mean_fintra_56.nii.gz
# nii2mnc $outDir/"$subj"_mean_fintra_56.nii $outDirMNC/"$subj"_mean_fintra_56.mnc
#
# gunzip $outDir/"$subj"_OD_56.nii.gz
# nii2mnc $outDir/"$subj"_OD_56.nii $outDirMNC/"$subj"_OD_56.mnc
# copy the new NODDI outputs
cp $workDir/data_noddi_bpx.NODDI_Watson_diff_exvivo/mean_fintra.nii.gz $outDir/"$subj"_mean_fintra_47.nii.gz
cp $workDir/data_noddi_bpx.NODDI_Watson_diff_exvivo/OD.nii.gz $outDir/"$subj"_OD_47.nii.gz
gunzip $outDir/"$subj"_mean_fintra_47.nii.gz
nii2mnc $outDir/"$subj"_mean_fintra_47.nii $outDirMNC/"$subj"_mean_fintra_47.mnc
gunzip $outDir/"$subj"_OD_47.nii.gz
nii2mnc $outDir/"$subj"_OD_47.nii $outDirMNC/"$subj"_OD_47.mnc
echo "done"
......
......@@ -28,16 +28,17 @@ for subj in $subjList; do
outDir=/vols/Scratch/myelin/Mohamed/Merima_data_secondbatch_preprocessed/"$subj"
# produce average b0
select_dwi_vols $outDir/data_gibbs_eddy.nii.gz $outDir/bvals $outDir/data_gibbs_eddy_b0_mean.nii.gz 0 -m
# # produce average b0
# select_dwi_vols $outDir/data_gibbs_eddy.nii.gz $outDir/bvals $outDir/data_gibbs_eddy_b0_mean.nii.gz 0 -m
#
# # run NODDI
# /home/fs0/amyh/func/run_NODDI.sh $outDir/data_noddi_bpx -m exvivo --dax 0.00056 --diso 0.001 –runMCMC
# run NODDI
#$scriptDir/merima_pipelines/AH_run_NODDI.sh $outDir/data_noddi_bpx -m exvivo --dax 0.00056 --diso 0.001 –runMCMC
/home/fs0/amyh/func/run_NODDI.sh $outDir/data_noddi_bpx -m exvivo --dax 0.00056 --diso 0.001 –runMCMC
# run NODDI with updated dax assumptions + Rician bias correction
#/home/fs0/amyh/func/run_NODDI.sh $outDir/data_noddi_bpx -m exvivo --dax 0.00047 --diso 0.001 --runMCMC —rician
# clean up NODDI and calculate parametric maps
#/home/fs0/amyh/scratch/NODDI/run_NODDI_cleanup.sh $outDir/data_noddi_bpx -m exvivo
#/vols/Data/km/cetisca/scripts/diff_cleanup.sh $outDir
/vols/Data/km/cetisca/scripts/diff_cleanup.sh $outDir
echo "done"
......
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