]> Creatis software - clitk.git/commitdiff
Add nb of pixels in A and not in B (and reverse)
authorDavid Sarrut <david.sarrut@gmail.com>
Fri, 3 Feb 2012 06:57:12 +0000 (07:57 +0100)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Thu, 24 Jan 2013 06:52:36 +0000 (07:52 +0100)
itk/clitkLabelImageOverlapMeasureFilter.txx

index a29aa6a3f810eb1987a8adbd2f62b82bc7d1e4a2..9a422a40793cef337a3aa8e1f017ebab215f5293 100644 (file)
@@ -94,7 +94,13 @@ GenerateData()
   ImagePointer image_intersection = clitk::Clone<ImageType>(input1);
   clitk::Or<ImageType>(image_union, input2, GetBackgroundValue());
   clitk::And<ImageType>(image_intersection, input2, GetBackgroundValue());
+
+  ImagePointer image_1NotIn2 = clitk::Clone<ImageType>(input1);
+  clitk::AndNot<ImageType>(image_1NotIn2, input2, GetBackgroundValue());
   
+  ImagePointer image_2NotIn1 = clitk::Clone<ImageType>(input2);
+  clitk::AndNot<ImageType>(image_1NotIn2, input1, GetBackgroundValue());
+
   //writeImage<ImageType>(image_union, "union.mha");
   //writeImage<ImageType>(image_intersection, "intersection.mha");
   
@@ -121,12 +127,24 @@ GenerateData()
   statFilter->Update();
   int in2 = statFilter->GetCount(GetLabel1());
 
+  statFilter->SetInput(image_1NotIn2);
+  statFilter->SetLabelInput(image_1NotIn2);
+  statFilter->Update();
+  int l1notIn2 = statFilter->GetCount(GetLabel1());
+
+  statFilter->SetInput(image_2NotIn1);
+  statFilter->SetLabelInput(image_2NotIn1);
+  statFilter->Update();
+  int l2notIn1 = statFilter->GetCount(GetLabel1());
+
   double dice = 2.0*(double)inter/(double)(in1+in2);
   int width = 6;
   std::cout << std::setw(width) << in1 << " "
             << std::setw(width) << in2 << " "
             << std::setw(width) << inter  << " "
             << std::setw(width) << u  << " "
+            << std::setw(width) << l1notIn2  << " "
+            << std::setw(width) << l2notIn1  << " "
             << std::setw(width) << dice << " "; //std::endl;
 }
 //--------------------------------------------------------------------