[ITK-users] Bug in StatisticsImageFilter?
Bradley Lowekamp
blowekamp at mail.nih.gov
Tue May 13 10:13:33 EDT 2014
On May 13, 2014, at 9:50 AM, Mirco Serra <mirco9091 at hotmail.it> wrote:
> One thing is still not really clear to me though: when you say that the Sum is meant to be the sum of all pixels, what does it mean exactly?
The sum is the addition of the values stored for each pixel. The summation of the intensity values of the image.
> The images I am considering have the same sizes, so they should have the number of pixels as well, correct?
Counting is the number of pixels while summation is over the value of the pixels. The former can be seen as how big is an image or label, while the latter could loosely be considered how bright is an image or label.
> Why is c (color?) multiplied by the image I?
In Sum( c*I ) = c * Sum( I ), I in an image, and c is a constant. Was just to illustrate the distributive property of summation.
> I will have a look at LabelStatisticsImageFilter anyway!!
>
> Thank you very much,
> Mirco
>
> Subject: Re: [ITK-users] Bug in StatisticsImageFilter?
> From: blowekamp at mail.nih.gov
> Date: Tue, 13 May 2014 08:53:16 -0400
> CC: insight-users at itk.org
> To: mirco9091 at hotmail.it
>
> Hello,
>
> This is not a bug. I think the confusion comes from the concept of a binary image. This StatisticsImageFilter is does not consider you image to be binary.
>
> In the StatisticsImageFilter, the Sum is the sum of all the pixels. It's is expected that the Sum( c*I ) = c*Sum( I ), where I is the image.
>
> It seems that the LabelStatisticsImageFilter[1] may be more what you are looking for it has a GetCount[2] method which counts the number of pixels for a give label.
>
> Brad
>
> [1] http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html
> [2] http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html#a971efb0a2d7dbd0f327bfec3f483d6ba
>
>
>
> On May 13, 2014, at 6:37 AM, Mirco Serra <mirco9091 at hotmail.it> wrote:
>
> Hi all,
>
> I was trying to use the itkStatisticsImageFilter to count the number of voxels of a binary image as results of segmentation. However, the function GetSum() seems to be multiplying the number of voxels by the integer value that I'm using for the segmentation. As an example, if I decide to give a value of 2 to the voxels which are part of the segmentation, then the voxels count will be the double of what it should really be, if I give a value of 3 it will the triple and so forth...Is this normal? Is there a way to fix it (apart from dividing by the value the voxels count)?
>
> Thank you very much,
> MIrco
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140513/7cfa3056/attachment-0001.html>
More information about the Insight-users
mailing list