X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=scripts%2Fcreate_midP_masks-2.0.sh;h=eb5983af70ab378ec4b97ae4a887273ce92109cf;hb=9548105324e0d1e8d440a1e1d83faf37ebcf1c08;hp=bbf44f0fa9a857da69581133681ddb046f715905;hpb=1d616cc7be31f7195c8bba4142e02350cd2fb958;p=clitk.git diff --git a/scripts/create_midP_masks-2.0.sh b/scripts/create_midP_masks-2.0.sh index bbf44f0..eb5983a 100755 --- a/scripts/create_midP_masks-2.0.sh +++ b/scripts/create_midP_masks-2.0.sh @@ -43,7 +43,7 @@ extract_bones() extract_lungs() { echo "$phase_file -> Extracting lungs..." - clitkExtractLung -i $phase_file -o $mask_dir_tmp/lungs_$phase_nb.mhd -a $afdb_file --noAutoCrop --doNotSeparateLungs + clitkExtractLung -i $phase_file -o $mask_dir_tmp/lungs_$phase_nb.mhd -a $afdb_file --noAutoCrop --doNotSeparateLungs --type 1 } @@ -52,6 +52,7 @@ resample() { echo "$phase_file -> Resampling..." clitkResampleImage -i $mask_dir_tmp/patient_$phase_nb.mhd -o $mask_dir_tmp/patient_$phase_nb.mhd --spacing $resample_spacing --interp $resample_algo + clitkResampleImage -i $mask_dir_tmp/patient_mask_$phase_nb.mhd -o $mask_dir_tmp/patient_mask_$phase_nb.mhd --spacing $resample_spacing --interp $resample_algo clitkResampleImage -i $mask_dir_tmp/lungs_$phase_nb.mhd -o $mask_dir_tmp/lungs_$phase_nb.mhd --like $mask_dir_tmp/patient_$phase_nb.mhd } @@ -130,7 +131,9 @@ mm_preprocessing() # extract_bones extract_lungs # remove_tmp_masks 1 - resample + if [ $resample_spacing -ne 0 ] ; then + resample + fi } mm_postprocessing() @@ -143,9 +146,14 @@ mm_postprocessing() motion_mask() { #set cmd line variables - mhd4d=$1 - resample_spacing=$2 - resample_algo=$3 + mhd4d=`basename $1` + if [ $# -eq 3 ] ; then + resample_spacing=$2 + resample_algo=$3 + else + resample_spacing=0 + resample_algo=0 + fi dir=`dirname $1` cd $dir @@ -156,7 +164,11 @@ motion_mask() fi #set other global variables - mask_dir="MASK-${resample_spacing}mm-$resample_algo" + if [ $resample_spacing -ne 0 ] ; then + mask_dir="MASK-${resample_spacing}mm-$resample_algo" + else + mask_dir="MASK" + fi mask_dir_tmp="tmp.$mask_dir" extract_4d_phases $mhd4d @@ -264,8 +276,8 @@ motion_mask() # main # ################# -if [ $# != 3 ]; then - echo "Usage: $0 CT_4D RESAMPLE_SPACING RESAMPLE_ALGORITHM" +if [ $# -ne 3 -a $# -ne 1 ]; then + echo "Usage: $0 CT_4D [RESAMPLE_SPACING RESAMPLE_ALGORITHM]" exit -1 fi @@ -276,5 +288,9 @@ fi # if [ $1 != "using-as-lib" ]; then - motion_mask $1 $2 $3 + if [ $# -eq 3 ] ; then + motion_mask $1 $2 $3 + else + motion_mask $1 + fi fi