[Insight-users] Transform the contour from image to chaincode
Luis Ibanez
luis.ibanez at kitware.com
Thu Jul 22 11:11:49 EDT 2004
Hi Jiang,
Please do the following:
1) Identify the pixel were your algorithm is
stopping prematurely
2) Go to the same index in the original image,
where you have the contour in 0 and 100 values.
(e.g. the image as it is before you set any
of the contour points to zero).
3) Take a 7x7 neighbor centered on this pixel
and post all the values of this neighbor
(arranged in a matrix) to the users-list.
Thanks
Luis
---------------------
Jiang wrote:
> Hi, all,
>
> By some filters of itk, I get one closed contour as one image. This
> image is one binary image that
>
> the pixel value is 100 when is pixel is in the contour, otherwise it is 0.
>
> Now I want to convert this contour to ChainCode. My pseudocode is as follow:
>
>
>
> Search the image from the first pixel to find the first point in the
> contour;
>
> Add this point to ChainCode list, and set its value to 0;
>
> Search the immediate neighbors of of this point to check if it is on
> contour;
>
> If this point’s value==100;
>
> { Add it to ChainCode, and set its value to 0;
>
> Loop searching
>
> }
>
> else
>
> Stop searching;
>
> Finish the ChainCode;
>
>
>
> // The order of checking neighbors. Assume the current points is at “0”.
>
> // ------------------------
>
> // | 5 | 3 | 8 |
>
> // |-------------------------|
>
> // | 1 | 0 | 2 |
>
> // |-------------------------|
>
> // | 7 | 4 | 6 |
>
> // -----------------------
>
>
>
> This searching method works, but not always. Sometime, it stops at
> somewhere, but the contour is
>
> not completed. And the stopped point is not different as other found
> points. I even enlarge the
>
> neighbourhood to a bigger circle. But it is still not stable.
>
>
>
> Maybe my question is beyond the range of this itk maillist. I’m really
> upset with this problem.
>
> Who can give me some suggestions?
>
>
>
> Thanks a lot!
>
>
>
>
>
> Jiang
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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