diff --git a/setup.py b/setup.py index 53f9200c7a8be948b9c4d56d9dabc467e87e8b2a..b4a2aee399e6f066472e0d51106219c21882c277 100644 --- a/setup.py +++ b/setup.py @@ -13,5 +13,5 @@ setup(name='SpinalDiffusionTools', author_email=['saad@fmrib.ox.ac.uk'], packages=['spinal_dmri_pipeline'], install_requires=install_requires, - scripts=['spinal_dmri_pipeline/scripts/spinal_preproc.sh','spinal_dmri_pipeline/scripts/spinal_models.sh','spinal_dmri_pipeline/scripts/spinal_create_siemens_directions.py'] + scripts=['spinal_dmri_pipeline/scripts/spinal_preproc.sh','spinal_dmri_pipeline/scripts/spinal_models.sh','spinal_dmri_pipeline/scripts/spinal_create_siemens_directions.py','spinal_dmri_pipeline/scripts/fwdti.py'] ) diff --git a/spinal_dmri_pipeline/scripts/spinal_models.sh b/spinal_dmri_pipeline/scripts/spinal_models.sh index 19877aeedf86d39412b6a2081d6344abdd204aa5..ed2fca84b9edef90301ede609800f4283e004611 100755 --- a/spinal_dmri_pipeline/scripts/spinal_models.sh +++ b/spinal_dmri_pipeline/scripts/spinal_models.sh @@ -19,25 +19,25 @@ D=$1 # Create out folders echo "Create output folders" mkdir -p $D/DTIFIT +mkdir -p $D/DKIFIT mkdir -p $D/FW_DTIFIT mkdir -p $D/TDI mkdir -p $D/TDI_lr -# change this -saad_scripts=/home/fs0/saad/usefulscripts # DTIFIT -fsl_sub -q veryshort.q -l $D/logs dtifit -k $D/Diffusion/data -m $D/Diffusion/nodif_brain_mask -r $D/Diffusion/bvecs -b $D/Diffusion/bvals -o $D/Diffusion/dti --save_tensor +fsl_sub -q veryshort.q -l $D/logs dtifit -k $D/Diffusion/data -m $D/Diffusion/nodif_brain_mask -r $D/Diffusion/bvecs -b $D/Diffusion/bvals -o $D/DTIFIT/dti --save_tensor +fsl_sub -q veryshort.q -l $D/logs -N dkifit "dtifit -k $D/Diffusion/data -m $D/Diffusion/nodif_brain_mask -r $D/Diffusion/bvecs -b $D/Diffusion/bvals -o $D/DKIFIT/kurt --save_tensor --kurt;fslmaths $D/DKIFIT/kurt_kurt -thr 0 -uthr 4 $D/DKIFIT/kurt_kurt" -fsl_sub -q veryshort.q -l $D/logs dtifit -k $D/Diffusion/data -m $D/Diffusion/nodif_brain_mask -r $D/Diffusion/bvecs -b $D/Diffusion/bvals -o $D/Diffusion/kurt --save_tensor --kurt --kurtdir # FW_DTIFIT -fwscript=$saad_scripts/fwdti.py -fsl_sub -q veryshort.q -l $D/logs $fwscript --data $D/Diffusion/data \ +fsl_sub -q veryshort.q -l $D/logs fwdti.py --data $D/Diffusion/data \ --mask $D/Diffusion/nodif_brain_mask \ - --bvecs $D/Diffusion/bvecs --bvals $D/Diffusion/bvals --out $D/Diffusion/fwdti + --bvecs $D/Diffusion/bvecs --bvals $D/Diffusion/bvals --out $D/FW_DTIFIT/fwdti +exit 1 # BedpostX +rm -rf $D/Diffusion.bedpostX bedpostx_gpu $D/Diffusion -n 2 -b 5000 -model 1 ID=`cat ${D}/Diffusion.bedpostX/logs/postproc_ID` @@ -72,9 +72,10 @@ tdi $D/Diffusion.bedpostX .2 $D/TDI .25 -S 1000 --randfib=1 --sampvox=.3 ID_TDI_LR=`tdi $D/Diffusion.bedpostX .5 $D/TDI_lr .25 -S 1000 --randfib=1 --sampvox=.3` # make into xtract-style output -mkdir -p $D/tdi_lr/tracts/spinalcord -cmd="fslmaths $D/tdi_lr/fdt_paths -div `cat $D/tdi_lr/waytotal` $D/tdi_lr/tracts/spinalcord/densityNorm" -cmd="$cmd;imcp $D/tdi_lr/fdt_paths_localdir $D/tdi_lr/tracts/spinalcord/density_localdir" -fsl_sub -q veryshort.q -l $D/logs -j $ID_TDI_LR -N post_tdi $cmd +# NOT WORKING YET +# mkdir -p $D/tdi_lr/tracts/spinalcord +# cmd="fslmaths $D/tdi_lr/fdt_paths -div `cat $D/tdi_lr/waytotal` $D/tdi_lr/tracts/spinalcord/densityNorm" +# cmd="$cmd;imcp $D/tdi_lr/fdt_paths_localdir $D/tdi_lr/tracts/spinalcord/density_localdir" +# fsl_sub -q veryshort.q -l $D/logs -j $ID_TDI_LR -N post_tdi $cmd echo "Done." diff --git a/spinal_dmri_pipeline/scripts/spinal_preproc.sh b/spinal_dmri_pipeline/scripts/spinal_preproc.sh index 0435c621e1022441ed087a2a5ef173cc6883add1..c0684ea7320ae5da2eec2fc1f85bb0bafe2efd37 100755 --- a/spinal_dmri_pipeline/scripts/spinal_preproc.sh +++ b/spinal_dmri_pipeline/scripts/spinal_preproc.sh @@ -167,7 +167,10 @@ echo "Creating SC mask with SCT" echo "" mkdir -p $D/T2w sctbin=/vols/Scratch/saad/sct_5.4/bin -$sctbin/sct_deepseg_sc -i `$FSLDIR/bin/imglob -extension ${T2file}.nii.gz` -c t2 -o $D/T2w/t2_seg.nii.gz +$sctbin/sct_deepseg_sc -i `$FSLDIR/bin/imglob -extension ${T2file}.nii.gz` -c t2 -o $D/T2w/t2_seg_no_tumour.nii.gz +# When there is a tumour, try to detect it and add it to the mask +sct_deepseg -task seg_tumor_t2 -i `$FSLDIR/bin/imglob -extension ${T2file}.nii.gz` -c t2 -o $D/T2w/t2_tumour_seg.nii.gz +fslmaths $D/T2w/t2_seg_no_tumour.nii.gz -add $D/T2w/t2_tumour_seg.nii.gz -bin $D/T2w/t2_seg.nii.gz dmri=$D/Eddy/dwis.nii.gz $sctbin/sct_maths -i $dmri -mean t -o $D/Eddy/dmri_mean.nii.gz $sctbin/sct_register_multimodal -i $D/T2w/t2_seg.nii.gz -d $D/Eddy/dmri_mean.nii.gz -identity 1 -x nn -ofolder $D/T2w @@ -186,5 +189,9 @@ echo " eddy submitted ID:$ID_eddy" ID_quad=`fsl_sub -q veryshort.q -l $D/logs -j $ID_eddy -N spinal_quad eddy_quad $D/Eddy/eddy_corrected_data -idx $D/Eddy/index.txt -par $D/Eddy/acqparams.txt -m $D/Eddy/mask -b $D/Eddy/bvals -g $D/Eddy/bvecs -f $D/Topup/topup_results_field.nii.gz -v ` echo " quad submitted ID:$ID_quad" +# Generate QC figures here + +# Generate report here + echo "Done."