[ITK-users] Filling the region inside a closed contour
Bradley Lowekamp
blowekamp at mail.nih.gov
Wed Mar 4 09:28:44 EST 2015
Hello,
The turn-key solution would the to use the BinaryFillholeImageFilter[1]. There may be a solution which uses connected components and the LabelMap framework to determine the regions separated by the contour. Then there are a variety of conditional flood fill conditional iterators that could be used [2].
Lastly if I could make the assumption that the contour didn't touch the boarder, I'd write a threaded filter which uses a scan-line iterator which would alternate between an inside and outside state based on encountering the input contour and wrote the output image accordingly.
You have options. The "best" or most "efficient" or most "robust" method can only be determine with experimentation and quantification for your problem.
Brad
[1] http://www.itk.org/Doxygen/html/classitk_1_1BinaryFillholeImageFilter.html
[2] http://www.itk.org/Doxygen/html/classitk_1_1ShapedFloodFilledFunctionConditionalConstIterator.html
On Mar 4, 2015, at 5:25 AM, Zein Salah <zeinsalah at gmail.com> wrote:
> Hi,
>
> I want to fill the region surrounded by a closed contour in a 2d
> itk image. I have been doing this using a reverse flood-filling procedure.
> I am wondering is itk has a more efficient/robust mechanism for
> doing this.
>
> BTW, 2d-coordinates of the point on the contour are also stored in a
> vector if this helps.
>
> thanks,
> Zeno
> _____________________________________
> 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://public.kitware.com/mailman/listinfo/insight-users
More information about the Insight-users
mailing list