]> Creatis software - clitk.git/commitdiff
added DosePerEnergy merger and modified filename for mergeStats
authorMarc Vila-Oliva <vilaoliva@linux15.dg.creatis.insa-lyon.fr>
Thu, 4 Jul 2013 17:05:45 +0000 (19:05 +0200)
committerMarc Vila-Oliva <vilaoliva@linux15.dg.creatis.insa-lyon.fr>
Thu, 4 Jul 2013 17:05:45 +0000 (19:05 +0200)
cluster_tools/gate_power_merge.sh

index 55fc1f00ce974e4a1430dc2be9f2647e641bd3f2..1a75244468abbd97ecc4ba6525b6d6317e704ebe 100755 (executable)
@@ -134,7 +134,7 @@ ${rootMerger} ${arguments} > /dev/null || error "error while calling ${rootMerge
 echo "  ${indent}merged ${count} files"
 }
 
-statMerger="mergeStatFile.py"
+statMerger="mergeStatFile.sh"
 test -x "./mergeStatFile.sh" && statMerger="./mergeStatFile.sh"
 
 function merge_stat {
@@ -165,6 +165,37 @@ end_bar
 echo "  ${indent}merged ${count} files"
 }
 
+doseMerger="mergeDosePerEnegryFile.sh"
+test -x "./mergeDosePerEnergyFile.sh" && doseMerger="./mergeDosePerEnergyFile.sh"
+
+function merge_dose {
+local merged="$1"
+shift
+echo "  ${indent}entering dose merger"
+echo "  ${indent}merger is ${doseMerger}"
+echo "  ${indent}creating ${merged}"
+local count=0
+start_bar $#
+while test $# -gt 0
+do
+    local partial="$1"
+    shift
+    let count++
+
+    if test ! -f "${merged}"
+    then
+        update_bar ${count} "copying first partial result ${partial}"
+        cp "${partial}" "${merged}"
+        continue
+    fi
+
+    update_bar ${count} "adding ${partial}"
+    ${doseMerger} -i "${merged}" -j "${partial}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}"
+done
+end_bar
+echo "  ${indent}merged ${count} files"
+}
+
 txtImageMerger="clitkMergeAsciiDoseActor"
 test -f "./clitkMergeAsciiDoseActor" && txtImageMerger="./clitkMergeAsciiDoseActor"
 
@@ -336,6 +367,16 @@ function merge_dispatcher {
         return
     fi
 
+    if test "${firstpartialoutputextension}" == "txt" && grep -qs 'energydose' "${firstpartialoutputfile}"
+    then
+        echo "${indent}this is a dose file"
+        local mergedfile="${outputdir}/$(basename "${firstpartialoutputfile}")"
+        merge_dose "${mergedfile}" ${partialoutputfiles} || error "error while merging"
+        return
+    fi
+
+
+
     if test "${firstpartialoutputextension}" == "txt" && grep -qs 'Resol' "${firstpartialoutputfile}"
     then
         local resol="$(sed -nr '/Resol/s/^.*=\s+\((.+)\)\s*$/\1/p' "${firstpartialoutputfile}")"