[Insight-users] Quickly get the Number of points of ConnectedThresholdImageFilter's output

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jun 6 08:58:43 EDT 2013


Hello,

I appears that you are using WrapITK perhaps in JAVA?

You are not going to get good ITK iterator performance in that wrapped environment to perform efficient small operations per pixel. You should try to used existing algorithms and filters.


You could use the LabelStatisticsImageFilter:

http://www.itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html

You can use the StatisticsImageFilter:

http://www.itk.org/Doxygen/html/classitk_1_1StatisticsImageFilter.html

Or the BinaryImageToStatisticsLabelMapFilter:

http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToStatisticsLabelMapFilter.html



On Jun 6, 2013, at 5:19 AM, jerry z <65104355 at qq.com> wrote:

> Hi all,
> I need to know the number of points ConnectedThresholdImageFilter's output
> contains.
> 
> I am trying to get that from:
> 
>            itk.itkImageRegionIterator_ISS3 iterator = new
> itkImageRegionIterator_ISS3(
>                connectedThresholdOutput,
>                connectedThresholdOutput.LargestPossibleRegion);
> 
>            int count = 0;
>            for (iterator.GoToBegin(); !iterator.IsAtEnd; iterator++)
>            {
>                short value = iterator.Get().ValueAsSS;
>                if (value == 1)
>                {
>                    count++;
>                }
>            }
> 
> But it tooks 2 seconds while ConnectedThresholdImageFilter.GetOutput only
> took 153ms.
> Is there a faster way?
> 
> Regards,
> 
> Jerry
> 
> 
> 
> --
> View this message in context: http://itk-users.7.n7.nabble.com/Quickly-get-the-Number-of-points-of-ConnectedThresholdImageFilter-s-output-tp31646.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
> _____________________________________
> 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



More information about the Insight-users mailing list