[Insight-users] Newbie question: How to create polygons?

Luis Ibanez luis.ibanez at kitware.com
Sat Mar 21 12:52:56 EDT 2009


Hi Jazz,

Thanks for the clarification...

This a non-trivial problem...

but it is certainly a fun one  :-)

Do you need the polygons to be "regular polygons" ?

that is,
do their sides have to have the same length ?

---

It looks like you will have to do something like
SpatialObject to Image registration.

You create a SpatialObject with a number of points
equal to N. and register it against a DistanceMap
generated from your images.

You could create a customized SpatialObjectToImageMetric
that will penalize the edges of the polygon from touching
or crossing the circle, and that will reward the vertices
from being close to the center of mass of the polygon.

----

You better start making coffee....


    Regards,


        Luis


-------------------
Jazz Kartell wrote:
> Hi Luis,
> 
> thanks for your fast answer. I will play around with your suggestions...
> i try to specify my problem:
> 
> e.g. i have a .png with a black filled circle... (for the beginning...)
> Now ITK should find that black region (with treshold) and save it internal
> as a polygon with n vertices. and that "internal" region i want to extract.
> So for example with the circle:
> I define n=4 and ITK should create the smallest square (or polygon with 
> n edges) containing the whole circle...
> The goal is that it is possible to define how exact a requested region 
> is encircled.
> 
> Exporting that encircled region:
> at this point, it would be nice to generate a seperate .png only 
> containing the extracted polygon including the "circle"
> or to encircle the region in the .png itself. But I think that should be 
> not so hard to do, once the regions are accessible...
> 
> I hope now my problem is a bit clearer and sorry for my english ;-)
> 
> Thanks
> 
> Benjamin
> 
> 
> 
> Luis Ibanez schrieb:
> 
>>
>> Hi Benjamin,
>>
>>
>>               Welcome to ITK !
>>
>>
>> You can extract contours from a binary image (your .png file)
>> by using the filter:
>> http://www.itk.org/Insight/Doxygen/html/classitk_1_1ContourExtractor2DImageFilter.html 
>>
>>
>> ---
>>
>> However, from the description of your email, there seems to be
>> a confusion between your goals and your means:
>>
>> Is it your final purpose:
>>
>>  A) To extract the individual shapes into separate image files ?
>>
>> or is it
>>
>>  B) To identify the polygonal representation of the shapes in
>>     the input image ?
>>
>>
>> If your goal is (A), then what you need is simply a pipeline
>> with the following filters:
>>
>>     * ConnectedComponents
>>     * BinaryThreshold
>>     * RegionOfInterest
>>
>> If you goal is (B), then, you can use the ContourExtractor2D described
>> above and then you can use Fourier descriptors in order to identify
>> polygonal shapes in the output of this filter.
>>
>>
>> Please separate your real goal from the means that you have
>> planned to use, so that we can better advise you on what ITK
>> components to use.
>>
>>
>>
>>       Thanks
>>
>>
>>           Luis
>>
>>
>>
>> --------------------
>> Jazz Kartell wrote:
>>
>>> Hi to everyone,
>>>
>>> I'm completely new to ITK, so please be lenient toward me...
>>> At the moment i'm very overhelmed with all the functionality included 
>>> in ITK.
>>>
>>> So here is what i want to do:
>>>
>>> Input is a simple .png file including black filled forms on white 
>>> background.
>>> Goal is to extract these forms in seperate files (one for each form).
>>> The extracted region should be included in a polygon with predefined 
>>> amount of vertices.
>>>
>>> Could you give me an advice, how i can enclose regions in polygons?
>>>
>>> Thank you very much in advance
>>>
>>> Best regards
>>>
>>> Benjamin Kirchholtes
>>>
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> 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