X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkLabelImageOverlapMeasureFilter.txx;h=037570916b0346be55ed56ff47cf1988485db821;hb=6986b996d66273ab7818c12f51cbf5ae049ac04e;hp=57516bb41634db8996e3822aa0d91ad748b2c110;hpb=d745faae40e9f4340a1e6a3dec7cc96176f3006d;p=clitk.git diff --git a/itk/clitkLabelImageOverlapMeasureFilter.txx b/itk/clitkLabelImageOverlapMeasureFilter.txx index 57516bb..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,8 +129,25 @@ GenerateData() statFilter->Update(); int in2 = statFilter->GetCount(GetLabel1()); - std::cout << in1 << " " << in2 << " " << inter << " " << u << " " - << 2.0*(double)inter/(double)(in1+in2) << std::endl; + 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; } //--------------------------------------------------------------------