X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkLabelImageOverlapMeasureFilter.txx;h=037570916b0346be55ed56ff47cf1988485db821;hb=ad4ece7dc0107e7ed2dfff895321a02f5051bce9;hp=a29aa6a3f810eb1987a8adbd2f62b82bc7d1e4a2;hpb=401388055a9276c211c06f7f82ea5a0869ca3728;p=clitk.git diff --git a/itk/clitkLabelImageOverlapMeasureFilter.txx b/itk/clitkLabelImageOverlapMeasureFilter.txx index a29aa6a..0375709 100644 --- a/itk/clitkLabelImageOverlapMeasureFilter.txx +++ b/itk/clitkLabelImageOverlapMeasureFilter.txx @@ -94,9 +94,17 @@ 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_2NotIn1, input1, GetBackgroundValue()); + //writeImage(image_union, "union.mha"); //writeImage(image_intersection, "intersection.mha"); + //writeImage(image_1NotIn2, "image_1NotIn2.mha"); + //writeImage(image_2NotIn1, "image_2NotIn1.mha"); // Compute size typedef itk::LabelStatisticsImageFilter StatFilterType; @@ -121,12 +129,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; } //--------------------------------------------------------------------