]> Creatis software - clitk.git/commitdiff
*** empty log message ***
authorbouilhol <bouilhol>
Tue, 12 Apr 2011 11:52:57 +0000 (11:52 +0000)
committerbouilhol <bouilhol>
Tue, 12 Apr 2011 11:52:57 +0000 (11:52 +0000)
vv/scripts/create_mhd_4D.sh

index e3b4c1bcde9123a09cb462634a43d6d6094704f6..662c5a3b63be5cfcc4adc747c2fb8aa8a12ebf4e 100755 (executable)
@@ -28,7 +28,8 @@ then
   exit 1
 fi
 
-nb_phase_file=`find $1 -iname "*[0-99].[0-9].mhd" -o -iname "*[0-99]*\]*.mhd" | wc -l`
+#nb_phase_file=`find $1 -iname "*[0-99].[0-9].mhd" -o -iname "*[0-99]*\]*.mhd" | wc -l`
+nb_phase_file=`find $1 -iname "*[0-9].mhd" -o -iname "*[0-9]*\]*.mhd" | wc -l`
 if [ $nb_phase_file = 0 ]
 then
   echo "Error: no phase found"
@@ -38,7 +39,8 @@ fi
 ########## CT #########
 
 list_pattern=""
-list_phase_file=`find $1 -iname "*[0-99].[0-9].mhd"`
+#list_phase_file=`find $1 -iname "*[0-99].[0-9].mhd"`
+list_phase_file=`find $1 -iname "*[0-9].mhd"`
 for phase_file in $list_phase_file
 do
   phase_file_name=`basename $phase_file`
@@ -63,17 +65,21 @@ do
     pattern=""
   fi
 
-  nbph0=`find $1 -iname "${pattern}[0-9].[0-9].mhd" | wc -l`
-  orig0=`find $1 -iname "${pattern}[0-9].[0-9].mhd" | sort | head -n 1`
-  listph0=`find $1 -iname "${pattern}[0-9].[0-9].raw" | sort`
+  #nbph0=`find $1 -iname "${pattern}[0-9].[0-9].mhd" | wc -l`
+  #orig0=`find $1 -iname "${pattern}[0-9].[0-9].mhd" | sort | head -n 1`
+  #listph0=`find $1 -iname "${pattern}[0-9].[0-9].raw" | sort`
 
-  nbph1=`find $1 -iname "${pattern}[0-9][0-9].[0-9].mhd" | wc -l`
-  orig1=`find $1 -iname "${pattern}[0-9][0-9].[0-9].mhd" | sort | head -n 1`
-  listph1=`find $1 -iname "${pattern}[0-9][0-9].[0-9].raw" | sort`
+  #nbph1=`find $1 -iname "${pattern}[0-9][0-9].[0-9].mhd" | wc -l`
+  #orig1=`find $1 -iname "${pattern}[0-9][0-9].[0-9].mhd" | sort | head -n 1`
+  #listph1=`find $1 -iname "${pattern}[0-9][0-9].[0-9].raw" | sort`
 
-  nbph=$(( nbph0+nbph1 ))
-  orig=`echo -e "$orig0\n$orig1" | head -n 1`
-  listph="$listph0 $listph1"
+  #nbph=$(( nbph0+nbph1 ))
+  #orig=`echo -e "$orig0\n$orig1" | head -n 1`
+  #listph="$listph0 $listph1"
+
+  nbph=`find $1 -iname "${pattern}*[0-9].mhd" | wc -l`
+  orig=`find $1 -iname "${pattern}*[0-9].mhd" | sort | head -n 1`
+  listph=`find $1 -iname "${pattern}*[0-9].raw" | sort`
 
   file_name_4D="${pattern}_4D.mhd"
 
@@ -85,13 +91,16 @@ done
 ############ PET ###########
 
 list_pattern=""
-list_phase_file=`find $1 -iname "*[0-99]*\]*.mhd"`
+#list_phase_file=`find $1 -iname "*[0-99]*\]*.mhd"`
+list_phase_file=`find $1 -iname "*[0-9]*\]*.mhd"`
 for phase_file in $list_phase_file
 do
   phase_file_name=`basename $phase_file`
-  if [[ ! -z `echo "$phase_file_name" | grep "[0-99]-.*\]"` ]]
+  #if [[ ! -z `echo "$phase_file_name" | grep "[0-99]-.*\]"` ]]
+  if [[ ! -z `echo "$phase_file_name" | grep "[0-9]-.*\]"` ]]
   then
-    prefix=`echo $phase_file_name | sed "s/.*[0-99]-/-/;s/\]_.*//"`
+    #prefix=`echo $phase_file_name | sed "s/.*[0-99]-/-/;s/\]_.*//"`
+    prefix=`echo $phase_file_name | sed "s/.*[0-9]-/-/;s/\]_.*//"`
   else
     prefix="NONE"
   fi
@@ -110,11 +119,16 @@ do
     pattern=""
   fi
 
-  nbph=`find $1 -iname "*[0-99]${pattern}\]*.mhd" | wc -l`
-  orig=`find $1 -iname "*[0-99]${pattern}\]*.mhd" | sort | head -n 1`
-  listph=`find $1 -iname "*[0-99]${pattern}\]*.raw" | sort`
+  #nbph=`find $1 -iname "*[0-99]${pattern}\]*.mhd" | wc -l`
+  #orig=`find $1 -iname "*[0-99]${pattern}\]*.mhd" | sort | head -n 1`
+  #listph=`find $1 -iname "*[0-99]${pattern}\]*.raw" | sort`
+
+  nbph=`find $1 -iname "*[0-9]${pattern}\]*.mhd" | wc -l`
+  orig=`find $1 -iname "*[0-9]${pattern}\]*.mhd" | sort | head -n 1`
+  listph=`find $1 -iname "*[0-9]${pattern}\]*.raw" | sort`
   
-  file_name_4D=`basename "$orig" | sed "s/[0-99]${pattern}\]/${pattern}\]/;s/_.mhd/_4D.mhd/"`
+  #file_name_4D=`basename "$orig" | sed "s/[0-99]${pattern}\]/${pattern}\]/;s/_.mhd/_4D.mhd/"`
+  file_name_4D=`basename "$orig" | sed "s/[0-9]${pattern}\]/${pattern}\]/;s/_.mhd/_4D.mhd/"`
 
   write_mhd_4D $1