From: tbaudier Date: Thu, 29 Nov 2018 11:03:12 +0000 (+0100) Subject: Merge branch 'master' of https://github.com/open-vv/vv X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=babf100c0d140f6b2525532d001b7794fb47a625;hp=5ca03ec7d6721080f7d62f765e369f13d077d65d;p=clitk.git Merge branch 'master' of https://github.com/open-vv/vv --- diff --git a/cluster_tools/gate_power_merge.sh b/cluster_tools/gate_power_merge.sh index b2ced88..43d90d0 100755 --- a/cluster_tools/gate_power_merge.sh +++ b/cluster_tools/gate_power_merge.sh @@ -218,12 +218,14 @@ function merge_doseByRegions { then update_bar ${count} "copying first partial result ${partial}" cp "${partial}" "${merged}" + copyFirstPartialResult -i "${merged}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}" continue fi update_bar ${count} "adding ${partial}" addToPartialResult -i "${merged}" -j "${partial}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}" done + divideUncertaintyResult -i "${merged}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}" end_bar echo " ${indent}merged ${count} files" } diff --git a/cluster_tools/mergeDoseByRegions.sh b/cluster_tools/mergeDoseByRegions.sh index 598df69..b9303aa 100755 --- a/cluster_tools/mergeDoseByRegions.sh +++ b/cluster_tools/mergeDoseByRegions.sh @@ -7,9 +7,9 @@ function usage { } function addToPartialResult { - IN1=$2 - IN2=$4 - RESULT=$6 + IN1=$2 #merged file for previous jobs + IN2=$4 # current job + RESULT=$6 #output merged file test -f ${IN1} && test -f ${IN2} || usage @@ -25,6 +25,44 @@ function addToPartialResult { exit 1 fi + # Find the number of primaries for this job (the same for all line and different of 0) + # Get the number of primaries from edep and square_edep to determine the std. + nbPrimary=0 + for i in $(seq 2 $nblines); do + #Get the line + file2=`sed -n "${i}p" < ${IN2}` + + edep2=$(echo ${file2} | cut -f3 -d' ') + stdEdep2=$(echo ${file2} | cut -f4 -d' ') + sqEdep2=$(echo ${file2} | cut -f5 -d' ') + nbPrimary=$(python <> ${TMP} @@ -51,6 +89,16 @@ function addToPartialResult { sqEdep3=${sqEdep3/#./0.} file3=$(echo $file3 |awk -v r=${sqEdep3} '{$5=r}1') + # Get the number of primaries from edep and square_edep to determine the std. + # Sum the number of primaries with the latter ones + nbPrimaryEdep1=$(echo ${file1} | cut -f4 -d' ') + nbPrimaryEdep3=$(python <> ${TMP} + # for all lines (except the 1st), split according tab + # write the number of primaries + for i in $(seq 2 $nblines); do + #Get the lines + file3=`sed -n "${i}p" < ${RESULT}` + + file3=$(echo $file3 |awk -v r=${nbPrimary} '{$4=r}1') + file3=$(echo $file3 |awk -v r=${nbPrimary} '{$7=r}1') + + #Write the output + echo "${file3}" >> ${TMP} + done + mv -f ${TMP} ${RESULT} +} + function divideUncertaintyResult { IN1=$2 - value=$4 - RESULT=$6 + RESULT=$4 TMP="$(mktemp)" @@ -111,11 +239,15 @@ function divideUncertaintyResult { # Divide uncertainty and replace it in the file3 edep1=$(echo ${file1} | cut -f3 -d' ') + nbPrimaryEdep1=$(echo ${file1} | cut -f4 -d' ') sqEdep1=$(echo ${file1} | cut -f5 -d' ') stdEdep3=$(python <(); // } + else if(PixelType == "double"){ + if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and double..." << std::endl; + UpdateWithDimAndPixelType(); + } else { if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; UpdateWithDimAndPixelType();