Commit 26afb813 authored by Alberto Lazari's avatar Alberto Lazari
Browse files

updated scripts for Merima's second experiment

parent 6d7638e7
#!/usr/bin/env bash
# definitions
workDir=/vols/Scratch/myelin/Mohamed/Merima_SecondExperiment_firstbatch
scriptDir=/vols/Scratch/alazari/preclinicalMPM_scripts
outDir=/vols/Scratch/myelin/Mohamed/Merima_SecondExperiment_firstbatch_preprocessed/
mkdir -p $outDir
mkdir -p $outDir/T2w
exportDir=/vols/Scratch/myelin/Mohamed/Merima_SecondExperiment_firstbatch_preprocessed_export
mkdir -p $exportDir
mkdir -p $exportDir/T2w
mkdir -p $exportDir/T2w/MNC
subjList="MS07@20211008_154740_MS07_Merima_Doldcr_T2w_Diffusion_1_1
MS08@20211011_201821_MS08_Merima_Doldcr_T2w_Diffusion_1_1
MS09@20211012_174125_MS09_Merima_Doldcr_T2w_Diffusion_1_2
MS10@20211013_180206_MS10_Merima_Doldcr_T2w_Diffusion_1_1
MS11@20211014_162422_MS11_Merima_Doldcr_T2w_Diffusion_1_1
MS12@20211015_180125_MS12_Merima_Doldcr_T2w_Diffusion_1_1
MS13@20211018_175940_MS13_Merima_Doldcr_T2w_Diffusion_1_2
MS14@20211019_174300_MS14_Merima_Doldcr_T2w_Diffusion_1_2
MS15@20211021_200506_MS15_Merima_Doldcr_T2w_Diffusion_1_1
MS16@20211022_151312_MS16_Merima_Doldcr_T2w_Diffusion_1_2
MS17@20211026_172625_MS17_Merima_Doldcr_T2w_Diffusion_1_1
MS18@20211027_203821_MS18_Merima_Doldcr_T2w_Diffusion_1_1
MS19@20211029_154024_MS19b_Merima_Doldcr_T2w_Diffusion_1_1
MS22@20211108_194315_MS22_Merima_Doldcr_T2w_Diffusion_4_1_5
MS23@20211103_181935_MS23_Merima_Doldcr_T2w_Diffusion_1_1
MS25@20211104_155453_MS25_Merima_Doldcd_T2w_Diffusion_1_1
MS26@20211109_155744_MS26_Merima_Doldcr_T2w_Diffusion_1_1"
# T2w is number 7
# MS02@20210930_183625_MS02_MS02_Merima_Doldcr_T2w_Diffusion_1_1
# MS03@20211004_193158_MS03_MS03_Merima_Doldcr_T2w_Diffusion_1_1
# MS04@20211006_163600_MS04b_MS04_Merima_Doldcr_T2w_Diffusion_1_1
# MS06@20211007_161034_MS06_MS06_Merima_Doldcr_T2w_Diffusion_1_1
# T2w is number 5
# MS07@20211008_154740_MS07_Merima_Doldcr_T2w_Diffusion_1_1
# MS08@20211011_201821_MS08_Merima_Doldcr_T2w_Diffusion_1_1
# MS09@20211012_174125_MS09_Merima_Doldcr_T2w_Diffusion_1_2
# MS10@20211013_180206_MS10_Merima_Doldcr_T2w_Diffusion_1_1
# MS11@20211014_162422_MS11_Merima_Doldcr_T2w_Diffusion_1_1
# MS12@20211015_180125_MS12_Merima_Doldcr_T2w_Diffusion_1_1
# MS13@20211018_175940_MS13_Merima_Doldcr_T2w_Diffusion_1_2
# MS14@20211019_174300_MS14_Merima_Doldcr_T2w_Diffusion_1_2
# MS15@20211021_200506_MS15_Merima_Doldcr_T2w_Diffusion_1_1
# MS16@20211022_151312_MS16_Merima_Doldcr_T2w_Diffusion_1_2
# MS17@20211026_172625_MS17_Merima_Doldcr_T2w_Diffusion_1_1
# MS18@20211027_203821_MS18_Merima_Doldcr_T2w_Diffusion_1_1
# MS19@20211029_154024_MS19b_Merima_Doldcr_T2w_Diffusion_1_1
# MS22@20211108_194315_MS22_Merima_Doldcr_T2w_Diffusion_4_1_5
# MS23@20211103_181935_MS23_Merima_Doldcr_T2w_Diffusion_1_1
# MS25@20211104_155453_MS25_Merima_Doldcd_T2w_Diffusion_1_1
# MS26@20211109_155744_MS26_Merima_Doldcr_T2w_Diffusion_1_1
#"MS81_3_20200903"
# "MS81_10_20200904
# MS82_3_20200914
# MS86_10_20200924
# MS81_1_20200901
# MS82_N_20200911
# MS86_1_20200921
# MS81_3_20200903
# MS84_10_20200918
# MS86_3_20200923
# MS81_N_20200907
# MS84_1_20200916
# MS86_N_20200925
# MS82_10_20200915
# MS84_3_20200917
# MS82_1_20200910
# MS84_N_20200909"
module add minc-toolkit-v1
for subjScan in $subjList; do
# separate the subject and the scan number
subj=${subjScan%@*}
scan=${subjScan#*@}
echo "conversion to mnc format for $subj"
# /vols/Data/postmort/dSSFP_process/bin/dSSFP_preprocess/unring $workDir/"$subj"/T2w/MS81_3_Merima_Doldcr_T2w_Diffusion_Part2_7_1_1.nii $workDir/"$subj"/T2w/"$subj"_T2w_anat_unringed
# /vols/Data/postmort/dSSFP_process/bin/dSSFP_preprocess/unring $workDir/"$subj"/T2w/"$subj"_T2w_anat.nii $workDir/"$subj"/T2w/"$subj"_T2w_anat_unringed
/vols/Data/postmort/dSSFP_process/bin/dSSFP_preprocess/unring $workDir/"$scan"/5/pdata/1/nifti/"$subj"*.nii $outDir/T2w/"$subj"_T2w_anat_unringed
#cp $workDir/"$subj"/T2w/"$subj"_T2w_anat_unringed.nii.gz $exportDir/T2w/"$subj"_T2w_anat_unringed.nii.gz
nii2mnc -quiet -signed -float $outDir/T2w/"$subj"_T2w_anat_unringed.nii $exportDir/T2w/MNC/"$subj"_T2w_anat.mnc
echo "done"
done
# Mini-Guide
# T2w
Just run the Convert_2_MNC_T2w.sh script
# DIFFUSION
Relevant scripts:
......
......@@ -3,21 +3,44 @@
# definitions
scriptDir=/vols/Scratch/alazari/preclinicalMPM_scripts/
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"
subjList="MS02@20210930_183625_MS02_MS02_Merima_Doldcr_T2w_Diffusion_1_1
MS03@20211004_193158_MS03_MS03_Merima_Doldcr_T2w_Diffusion_1_1
MS04@20211006_163600_MS04b_MS04_Merima_Doldcr_T2w_Diffusion_1_1
MS06@20211007_161034_MS06_MS06_Merima_Doldcr_T2w_Diffusion_1_1
MS07@20211008_154740_MS07_Merima_Doldcr_T2w_Diffusion_1_1
MS08@20211011_201821_MS08_Merima_Doldcr_T2w_Diffusion_1_1
MS09@20211012_174125_MS09_Merima_Doldcr_T2w_Diffusion_1_2
MS10@20211013_180206_MS10_Merima_Doldcr_T2w_Diffusion_1_1
MS11@20211014_162422_MS11_Merima_Doldcr_T2w_Diffusion_1_1
MS12@20211015_180125_MS12_Merima_Doldcr_T2w_Diffusion_1_1
MS13@20211018_175940_MS13_Merima_Doldcr_T2w_Diffusion_1_2
MS14@20211019_174300_MS14_Merima_Doldcr_T2w_Diffusion_1_2
MS15@20211021_200506_MS15_Merima_Doldcr_T2w_Diffusion_1_1
MS16@20211022_151312_MS16_Merima_Doldcr_T2w_Diffusion_1_2
MS17@20211026_172625_MS17_Merima_Doldcr_T2w_Diffusion_1_1
MS18@20211027_203821_MS18_Merima_Doldcr_T2w_Diffusion_1_1
MS19@20211029_154024_MS19b_Merima_Doldcr_T2w_Diffusion_1_1
MS22@20211108_194315_MS22_Merima_Doldcr_T2w_Diffusion_4_1_5
MS23@20211103_181935_MS23_Merima_Doldcr_T2w_Diffusion_1_1
MS25@20211104_155453_MS25_Merima_Doldcd_T2w_Diffusion_1_1
MS26@20211109_155744_MS26_Merima_Doldcr_T2w_Diffusion_1_1"
# 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
......@@ -27,14 +50,14 @@ for subjScan in $subjList; do
echo "copying and converting files for $subj"
workDir=/vols/Scratch/myelin/Mohamed/Merima_data_secondbatch_preprocessed/"$scan"
outDir=/vols/Scratch/myelin/Mohamed/Merima_data_secondbatch_preprocessed_export/NIFTI/"$subj"
outDirMNC=/vols/Scratch/myelin/Mohamed/Merima_data_secondbatch_preprocessed_export/MNC/"$subj"
workDir=/vols/Scratch/myelin/Mohamed/Merima_SecondExperiment_firstbatch_preprocessed/"$scan"
outDir=/vols/Scratch/myelin/Mohamed/Merima_SecondExperiment_firstbatch_preprocessed_export/NIFTI/"$subj"
outDirMNC=/vols/Scratch/myelin/Mohamed/Merima_SecondExperiment_firstbatch_preprocessed_export/MNC/"$subj"
mkdir -p $outDir
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
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
......
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
#!/bin/bash
module add mrdegibbs3d
if [ $# -lt 4 ]
then
echo "Usage: $0 inputdir exp_no_shell1 exp_no_shell2 exp_no_blipdown outputdir "
exit 0
fi
orient_corr () {
fslorient -deleteorient $1
fslswapdim $1 z -y x $1
fslorient -setsform 0.1 0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0 1 $1
fslorient -copysform2qform $1
fslorient -setsformcode 1 $1
fslorient -setqformcode 1 $1
}
inputdir=$1
shell1=$2
shell2=$3
blipDown=$4
outputdir=$5
if [ -d "${outputdir}" ];
then
echo "Output directory exists. Will work there."
else
mkdir $5
fi
foldername=$(echo `basename ${inputdir}`)
folderlength=`echo -n $foldername | wc -c`
((folderlength = folderlength - 4))
substring=$(echo `basename ${inputdir}` | cut -b 17-${folderlength})
nofiles_shell1=`ls ${inputdir}/${shell1}/pdata/1/nifti/ -1 | wc -l`
nofiles_shell2=`ls ${inputdir}/${shell2}/pdata/1/nifti/ -1 | wc -l`
((nofiles = $nofiles_shell1 + $nofiles_shell2))
echo merging all files
for i in `seq 1 $nofiles_shell1`
do
printf "$inputdir/${shell1}/pdata/1/nifti/${substring}_${shell1}_1_${i}.nii " >> $outputdir/filenames
done
for i in `seq 1 $nofiles_shell2`
do
printf "$inputdir/${shell2}/pdata/1/nifti/${substring}_${shell2}_1_${i}.nii " >> $outputdir/filenames
done
filelist=`cat $outputdir/filenames`
fslmerge -t ${outputdir}/data_merged_original $filelist
cp /vols/Data/km/cetisca/scripts/diffpostproc_masterfiles/acp.txt ${outputdir}/acp.txt
cp /vols/Data/km/cetisca/scripts/diffpostproc_masterfiles/index.txt ${outputdir}/index.txt
cp /vols/Data/km/cetisca/scripts/diffpostproc_masterfiles/topup_mouse.cnf ${outputdir}/topup_mouse.cnf
echo loading bvecs and bvals
cp ${inputdir}/${shell1}/method ${outputdir}/method_shell1
cp ${inputdir}/${shell2}/method ${outputdir}/method_shell2
cp ${inputdir}/${blipDown}/pdata/1/nifti/${substring}_${blipDown}_1_1.nii ${outputdir}/b0_blipDown.nii
/vols/Data/km/cetisca/functions/extract_bvecs_bvals.sh ${outputdir}
echo queuing orientation correction and mask generation
jid1=`fsl_sub -q veryshort.q -l ${outputdir}/logs1 /vols/Data/km/cetisca/scripts/diffpostproc_step1.sh ${outputdir}`
echo $jid1
echo queuing gibbs correction
#jid2=`/vols/Data/postmort/dSSFP_process/bin/dSSFP_preprocess/gibbs_correction_4D_clust ${outputdir}/data_gibbs.nii.gz -i ${outputdir}/data.nii.gz -l ${outputdir}/gibbslogs -d 1 -j $jid1 -nc -nd 64`
jid2=`fsl_sub -q short.q -j $jid1 -l ${outputdir}/ deGibbs3D ${outputdir}/data.nii.gz ${outputdir}/data_gibbs.nii.gz `
echo $jid2
echo queuing pretopup file processing
jid3=`fsl_sub -q veryshort.q -l ${outputdir}/logs3 -j $jid2 /vols/Data/km/cetisca/scripts/diffpostproc_step3.sh ${outputdir}`
echo $jid3
echo queuing topup
jid4=`fsl_sub -q cuda.q -j $jid3 topup --imain=${outputdir}/b0_topup --datain=${outputdir}/acp.txt --config=${outputdir}/topup_mouse.cnf --out=${outputdir}/topup_mouse_output_2b0 --fout=${outputdir}/topup_mouse_field_2b0 --iout=${outputdir}/topup_mouse_unwarped_images_2b0 --logout=${outputdir}/topup_mouse_2b0.log --verbose`
echo $jid4
echo queuing post-topup file orientations
jid5=`fsl_sub -q veryshort.q -l ${outputdir}/logs4 -j $jid4 /vols/Data/km/cetisca/scripts/diffpostproc_step4.sh ${outputdir}`
echo $jid5
echo queuing applytopup
jid6=`fsl_sub -q veryshort.q -l ${outputdir}/logsapplytopup -j $jid5 applytopup --imain=${outputdir}/data_gibbs_cp --datain=${outputdir}/acp.txt --inindex=1 --topup=${outputdir}/topup_mouse_output_2b0 --method=jac --out=${outputdir}/data_gibbs_applytopup`
echo $jid6
echo queuing eddy cuda
jid7=`fsl_sub -q cuda.q -j $jid5 eddy_cuda8.0 --imain=${outputdir}/data_gibbs_cp --mask=${outputdir}/b0_mean_mask_test.nii.gz --acqp=${outputdir}/acp.txt --index=${outputdir}/index.txt --bvecs=${outputdir}/bvecs_eddy --bvals=${outputdir}/bvals --topup=${outputdir}/topup_mouse_output_2b0 --out=${outputdir}/data_gibbs_eddy --verbose`
echo $jid7
echo queuing final file manipulations/organisations
jid8=`fsl_sub -q short.q -l ${outputdir}/logs5 -j $jid7 /vols/Data/km/cetisca/scripts/diffpostproc_step5.sh ${outputdir}`
echo $jid8
EddyInputError: Error when attempting to read --index file /vols/Scratch/myelin/Mohamed/Merima_data_secondbatch_preprocessed/20210301_160217_MS74_MS74_MCAO_T2w_Diffusion_QSM_round2_1_3/index.txt
Terminating program
#!/usr/bin/env bash
# definitions
workDir=/vols/Scratch/myelin/Mohamed/Merima_data_firstbatch
scriptDir=/vols/Scratch/alazari/preclinicalMPM_scripts/
subjList="MS81_10_20200904"
workDir=/vols/Scratch/myelin/Mohamed/Merima_SecondExperiment_firstbatch
scriptDir=/vols/Scratch/alazari/preclinicalMPM_scripts/merima_pipelines/second_experiment_first_acquisition
subjList="20210930_183625_MS02_MS02_Merima_Doldcr_T2w_Diffusion_1_1
20211004_193158_MS03_MS03_Merima_Doldcr_T2w_Diffusion_1_1
20211006_163600_MS04b_MS04_Merima_Doldcr_T2w_Diffusion_1_1
20211007_161034_MS06_MS06_Merima_Doldcr_T2w_Diffusion_1_1
20211008_154740_MS07_Merima_Doldcr_T2w_Diffusion_1_1
20211011_201821_MS08_Merima_Doldcr_T2w_Diffusion_1_1
20211012_174125_MS09_Merima_Doldcr_T2w_Diffusion_1_2
20211013_180206_MS10_Merima_Doldcr_T2w_Diffusion_1_1
20211014_162422_MS11_Merima_Doldcr_T2w_Diffusion_1_1
20211015_180125_MS12_Merima_Doldcr_T2w_Diffusion_1_1
20211018_175940_MS13_Merima_Doldcr_T2w_Diffusion_1_2
20211019_174300_MS14_Merima_Doldcr_T2w_Diffusion_1_2
20211021_200506_MS15_Merima_Doldcr_T2w_Diffusion_1_1
20211022_151312_MS16_Merima_Doldcr_T2w_Diffusion_1_2
20211026_172625_MS17_Merima_Doldcr_T2w_Diffusion_1_1
20211027_203821_MS18_Merima_Doldcr_T2w_Diffusion_1_1
20211029_154024_MS19b_Merima_Doldcr_T2w_Diffusion_1_1
20211101_165313_MS20b_Merima_Doldcr_T2w_Diffusion_1_1
20211108_194315_MS22_Merima_Doldcr_T2w_Diffusion_4_1_5
20211103_181935_MS23_Merima_Doldcr_T2w_Diffusion_1_1
20211104_155453_MS25_Merima_Doldcd_T2w_Diffusion_1_1
20211109_155744_MS26_Merima_Doldcr_T2w_Diffusion_1_1"
for subj in $subjList; do
......@@ -16,7 +37,7 @@ for subj in $subjList; do
echo "$a"
name=$(sed -n '11p' $workDir/"$subj"_Merima_Doldcr_T2w_Diffusion/"$a"/acqp)
name=$(sed -n '11p' $workDir/"$subj"/"$a"/acqp)
echo "$a" "$name" >> $scriptDir/acquisition_order_"$subj".txt
done
......
1 <1_Localizer>
2 <1_Localizer>
3 <1_Localizer_multi_slice>
4 <MGE>
5 <T2map_MSME>
6 <1_Localizer_multi_slice>
7 <T2_TurboRARE_3D>
8 <win_DtiEpi_12>
9 <win_DtiEpi_12>
10 <win_DtiEpi_12>
11 <mt_MGE_Nav_15>
12 <mt_MGE_Nav_15>
13 <1_Localizer>
14 <1_Localizer_multi_slice>
15 <MGE>
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1 <1_Localizer>
2 <1_Localizer>
3 <1_Localizer_multi_slice>
4
5
6 <1_Localizer_multi_slice>
7 <T2_TurboRARE_3D>
8 <win_DtiEpi_12>
9 <win_DtiEpi_12>
10 <win_DtiEpi_12>
11 <mt_MGE_Nav_15>
12 <mt_MGE_Nav_15>
13 <1_Localizer_multi_slice>
14 <1_Localizer_multi_slice>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1 <1_Localizer>
2 <1_Localizer>
3 <1_Localizer_multi_slice>
4 <MGE>
5
6 <1_Localizer_multi_slice>
7 <T2_TurboRARE_3D>
8 <win_DtiEpi_12>
9 <win_DtiEpi_12>
10 <win_DtiEpi_12>
11 <mt_MGE_Nav_15>
12 <mt_MGE_Nav_15>
13 <1_Localizer>
14 <1_Localizer>
15 <1_Localizer_multi_slice>
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1 <1_Localizer>
2 <1_Localizer>
3 <1_Localizer_multi_slice>
4
5
6 <1_Localizer_multi_slice>
7 <T2_TurboRARE_3D>
8 <win_DtiEpi_12>
9 <win_DtiEpi_12>
10 <win_DtiEpi_12>
11 <mt_MGE_Nav_15>
12 <mt_MGE_Nav_15>
13 <1_Localizer_multi_slice>
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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