AW: [Insight-users] Transform the contour from image to chaincode
Jiang
jiang at TI.Uni-Trier.DE
Fri Jul 23 06:45:59 EDT 2004
Hi Luis,
I tried one contour image and the searching always stops at one point
prematurely. I paste the 7*7 neighbor of this point at the original
contour image. The center point "100" is the stop point. And it above
"100" and right three "100" are found points. It left two "100" are not
found points.
End Point is at 138 160
0 100 0 0 100 0 0
0 0 100 0 100 0 0
0 0 0 100 100 0 0
0 0 0 100 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
And the contour image is as the attachment. Now I find out why it stops.
It is good method to find out the problem. Thank you. But I still
struggle to figure it out.
Best regards,
Jiang
-----Ursprüngliche Nachricht-----
Von: insight-users-bounces at itk.org
[mailto:insight-users-bounces at itk.org] Im Auftrag von Luis Ibanez
Gesendet: Donnerstag, 22. Juli 2004 17:12
An: Jiang
Cc: ITK
Betreff: Re: [Insight-users] Transform the contour from image to
chaincode
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 points 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. Im 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
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newcontour.png
Type: image/png
Size: 412 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20040723/a517bd28/newcontour.png
More information about the Insight-users
mailing list