[Insight-users] Re: Finding vertices in an image of contours.

Luis Ibanez luis.ibanez at kitware.com
Sun Mar 25 19:32:04 EST 2007


Hi Quan,


Your email contains two independent questions:


1) How to get vertices out of an image with 1-pixel-wide
    contours?  :

    Unfortunately, there is not a reliable way of
    converting your image of edges into a 2D graph.

    There are a couple of things you could try, but
    they probably will get you only 80% to 90% of the
    connections that you are looking for, and then
    you will have to edit the structure in order to
    get the remaining 20%~10%.

    One of the options you can try is:


     a) run this image through the ConnectedComponents
        image filter.

     b) Run through the output image of (a) with a
        Neighborhood iterator and identify the pixels
        that are in the edges of the original edge-image
        and have neighbors in more than 2 components
        (by checking how many label values there are in
        their neigborhood).

        Pixels that are black on the edge-image and have
        only two different labels in their neighborhood
        can be labeled as "edge" pixels.

        Pixels that are black on the edge-image and have
        more than two different labels in their neighborhood
        can be labeled as "Vertex" pixels.

     c) Create a binary image that only has the edge pixels
        that you found in (b)

     d) Run the image (c) through another connected components.
        This will give you an image with specific labels for
        every "edge". This is the fragile part of the method,
        since it depends on whether you used 4 or 8 connectivity.

     e) Visit all the pixels in the image from (d) and create
        a table where the index is the label of the edge and the
        values are the pairs of labels from (b) that are touching
        the edge.

     f) Reorder the table by the labels of the regions, instead
        of by the label of the edges.

     g) Take the regions from (f) that appear 4, or 5 or 6 times
        in the table.




2) Does ITK have classes for data structures such
    as list and stacks?

    Yes. ITK has data containers, such as the
    VectorContainer and MapContainer.

    However, depending on what you want to do, it
    may be simpler to use the STL containers.




   Regards,


      Luis



-------------------------
qxue at jouy.inra.fr wrote:
> Hi, Lius:
>     I have to give you a letter for a help, for I have no idea how to finish it
> by ITK for a long time.
>     Using the ITK, I have gotten a single pixel cell wall edge, and the
> segmentated result is shown in the attachment. I want to get the intersections
> (or named polygon conners) through the whole picture, and then redraw the whole
> picture by the polygons consisted with six or five or four lines.
>     In the ITK, are there some filters can do it? are there classese for list,
> stack and other data sturctures?
> Quan
> 
> 
> ------------------------------------------------------------------------
> 


More information about the Insight-users mailing list