From: David Sarrut Date: Fri, 3 Feb 2012 06:57:12 +0000 (+0100) Subject: Add nb of pixels in A and not in B (and reverse) X-Git-Tag: v1.4.0~255 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=3d3a49fd5446f30d0eeff47e4a99ba4a9e29d85d;p=clitk.git Add nb of pixels in A and not in B (and reverse) --- diff --git a/itk/clitkLabelImageOverlapMeasureFilter.txx b/itk/clitkLabelImageOverlapMeasureFilter.txx index a29aa6a..9a422a4 100644 --- a/itk/clitkLabelImageOverlapMeasureFilter.txx +++ b/itk/clitkLabelImageOverlapMeasureFilter.txx @@ -94,7 +94,13 @@ GenerateData() ImagePointer image_intersection = clitk::Clone(input1); clitk::Or(image_union, input2, GetBackgroundValue()); clitk::And(image_intersection, input2, GetBackgroundValue()); + + ImagePointer image_1NotIn2 = clitk::Clone(input1); + clitk::AndNot(image_1NotIn2, input2, GetBackgroundValue()); + ImagePointer image_2NotIn1 = clitk::Clone(input2); + clitk::AndNot(image_1NotIn2, input1, GetBackgroundValue()); + //writeImage(image_union, "union.mha"); //writeImage(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; } //--------------------------------------------------------------------