]> Creatis software - clitk.git/blobdiff - tools/clitkNormalizeImageFilterGenericFilter.txx
Correct roi name into DicomRTStruct
[clitk.git] / tools / clitkNormalizeImageFilterGenericFilter.txx
index e6911afde54adce2a07e5a3656d18520ca235b43..ea8773334d2307d99953eab8c0a133690c215bc8 100644 (file)
@@ -144,13 +144,28 @@ namespace clitk
         ito.GoToBegin();
         itm.GoToBegin();
 
+        double total = 0.0;
         while (!ito.IsAtEnd()) {
+          if(itm.Get() == 1) {
+            ito.Set(((float) it.Get() - minImg)/(maxImg-minImg));
+            total += ito.Get();
+          }
+          ++it;
+          ++ito;
+          ++itm;
+        }
+
+        // Normalisation wrt total ?
+        if (mArgsInfo.total_normalisation_flag) {
+          ito.GoToBegin();
+          itm.GoToBegin();
+          while (!ito.IsAtEnd()) {
             if(itm.Get() == 1) {
-                ito.Set(((float) it.Get() - minImg)/(maxImg-minImg));
+              ito.Set(ito.Get()/total);
             }
-            ++it;
             ++ito;
             ++itm;
+          }
         }
         //
         //