From 3d3a49fd5446f30d0eeff47e4a99ba4a9e29d85d Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Fri, 3 Feb 2012 07:57:12 +0100 Subject: [PATCH] Add nb of pixels in A and not in B (and reverse) --- itk/clitkLabelImageOverlapMeasureFilter.txx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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; } //-------------------------------------------------------------------- -- 2.47.1