[Insight-users] iterate over a segmented image
Luis Ibanez
luis.ibanez at kitware.com
Thu Sep 14 11:09:09 EDT 2006
Hi Yann,
There is no easy way to avoid going through all the image pixels
in order to find the ones that belong to a particular label.
However, such walk is quite easy to perform, and shouldn't take
too much time. You just need a while loop on the iterator.
About your question regarding: shape/topology criteria
1) Number of regions is reported by the ConnectedComponentsImageFilter
2) Currently there are no methods for computing number of holes
3) Centroids could be computed with the ImageMomentsCalculator.
4) Currently there are no methods for computing largest axis.
You could implement (2) and (3) by using iterators that walk through
the boundary of a segmented region. You will find such iterators in
the following paper by Zach Pincus in the Insight Journal:
http://insight-journal.org/dspace/handle/1926/165
"ContourExtractor2DImageFilter:
A subpixel-precision image isocontour extraction filter."
If you write the classes for computing largest axis and number of
holes, you should consider submitting them as contributions to
the Insight Journal.
Regards,
Luis
==================
yann gavet wrote:
> Hello all,
> I want to get the regions segmented by a ConnectedComponentImageFilter
> followed by a RelabelComponentImageFilter.
> My goal is to be able to iterate over the pixels of each segmented
> region. Is there a way to avoid going through all the pixels of the
> image and testing if the pixel belongs to the region I need to extract.
>
> More generally, how can I compute some shape/topology criteria on such
> segmented regions, like number of holes, largest axis, centroid, etc...
>
> Thank you for your time
> Yann
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list