Re: Joining Multiple Vectors from the Thin Function [message #61951] |
Tue, 12 August 2008 11:53  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
mzagursk@gmail.com wrote:
> Hi All,
>
> This problem is a bit complex so I'll try to spell it out as best I
> can. IDL's THIN() function finds the medial axis of a shape. In my
> case, this medial axis is akin to the ridge of a mountain. The output
> of the THIN function is an array of the same dimensions as the image
> with all values set to 0 except: If the point is on the medial axis,
> it has a value of '3'. If the point is on the medial axis and is an
> endpoint, it has a value of 2. I need to find a way to extract (in
> order) the ridge data. This task is further complicated because the
> THIN function does not output just one medial axis. Instead, it
> outputs 'segments' if there is a kink in the shape. So, you end up
> with a complex structure of line segments. What I need to do is put
> these segments in order from one endpoint to the other endpoint of the
> ridge. Any ideas?
>
> Hope I explained well enough!
Hi,
several ideas come to mind...
1) use label_region
2) use search_2D ,starting with points of value 2. Then break the
indices at the location of the points of value 2.
3) depending on the size of your image, find the relative coordinates of
the cells in the Moore neighborhood of cells 0;0 (that is, neighb =
central cell idx - sizeX -1 ; central idx - sizeX, central idx - sizeX +
1; central idx -1; central idx +1 etc). Then, on your own, start
(repetitively), from each point of value 2 and look for adjacent cells
of value 3.
Jean
|
|
|
Re: Joining Multiple Vectors from the Thin Function [message #61952 is a reply to message #61951] |
Tue, 12 August 2008 11:55  |
Bob[3]
Messages: 60 Registered: December 2006
|
Member |
|
|
On Aug 12, 2:47 pm, "mzagu...@gmail.com" <mzagu...@gmail.com> wrote:
> On Aug 12, 11:35 am, David Fanning <n...@dfanning.com> wrote:
>
>
>
>
>
>> mzagu...@gmail.com writes:
>>> Thanks for the reply. Making the segments shouldn't be a problem, my
>>> problem is after I get these segments I need to create a "master"
>>> array of all of the segments in order. Any ideas on that?
>
>> What does "order" mean? I'm taking a perl class today.
>> I'd use perl to sort on segment length and call it good. :-)
>
>> Cheers,
>
>> David
>
>> P.S. I'd probably use a pointer array in IDL, since each
>> segment will be a different length.
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming (www.dfanning.com)
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> Order as in: there are multiple segments with gaps between them...I
> need to connect the segments in the order they are along the ridge.- Hide quoted text -
>
> - Show quoted text -
How about, once you reach an endpoint of a segment search for the next
nearest unexamined endpoint, connect the two endpoints then continue
as above?
Determining the "master" endpoint to begin with may be a bit of a
problem - depending on what you know about your ridgeline.
|
|
|
Re: Joining Multiple Vectors from the Thin Function [message #61953 is a reply to message #61951] |
Tue, 12 August 2008 11:47  |
mzagursk@gmail.com
Messages: 9 Registered: June 2008
|
Junior Member |
|
|
On Aug 12, 11:35 am, David Fanning <n...@dfanning.com> wrote:
> mzagu...@gmail.com writes:
>> Thanks for the reply. Making the segments shouldn't be a problem, my
>> problem is after I get these segments I need to create a "master"
>> array of all of the segments in order. Any ideas on that?
>
> What does "order" mean? I'm taking a perl class today.
> I'd use perl to sort on segment length and call it good. :-)
>
> Cheers,
>
> David
>
> P.S. I'd probably use a pointer array in IDL, since each
> segment will be a different length.
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Order as in: there are multiple segments with gaps between them...I
need to connect the segments in the order they are along the ridge.
|
|
|
Re: Joining Multiple Vectors from the Thin Function [message #61954 is a reply to message #61953] |
Tue, 12 August 2008 11:35  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mzagursk@gmail.com writes:
> Thanks for the reply. Making the segments shouldn't be a problem, my
> problem is after I get these segments I need to create a "master"
> array of all of the segments in order. Any ideas on that?
What does "order" mean? I'm taking a perl class today.
I'd use perl to sort on segment length and call it good. :-)
Cheers,
David
P.S. I'd probably use a pointer array in IDL, since each
segment will be a different length.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Joining Multiple Vectors from the Thin Function [message #61955 is a reply to message #61954] |
Tue, 12 August 2008 11:28  |
mzagursk@gmail.com
Messages: 9 Registered: June 2008
|
Junior Member |
|
|
On Aug 12, 11:25 am, David Fanning <n...@dfanning.com> wrote:
> mzagu...@gmail.com writes:
>> This problem is a bit complex so I'll try to spell it out as best I
>> can. IDL's THIN() function finds the medial axis of a shape. In my
>> case, this medial axis is akin to the ridge of a mountain. The output
>> of the THIN function is an array of the same dimensions as the image
>> with all values set to 0 except: If the point is on the medial axis,
>> it has a value of '3'. If the point is on the medial axis and is an
>> endpoint, it has a value of 2. I need to find a way to extract (in
>> order) the ridge data. This task is further complicated because the
>> THIN function does not output just one medial axis. Instead, it
>> outputs 'segments' if there is a kink in the shape. So, you end up
>> with a complex structure of line segments. What I need to do is put
>> these segments in order from one endpoint to the other endpoint of the
>> ridge. Any ideas?
>
> Get a list of end points and make arrays to keep track of any
> end points and ridge points you have already examined. Start with
> any unexamined endpoint. Mark it as "examined". Look at its eight
> neighbors for an unexamined ridge point. Mark this ridge point
> as "examined". Keep doing this until you find another end point.
> That's a segment.
>
> Do this until you have no more unexamined end points.
>
> Cheers,
>
> David
>
> P.S. Consider doing this in C. :-)
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks for the reply. Making the segments shouldn't be a problem, my
problem is after I get these segments I need to create a "master"
array of all of the segments in order. Any ideas on that?
|
|
|
Re: Joining Multiple Vectors from the Thin Function [message #61956 is a reply to message #61955] |
Tue, 12 August 2008 11:25  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mzagursk@gmail.com writes:
> This problem is a bit complex so I'll try to spell it out as best I
> can. IDL's THIN() function finds the medial axis of a shape. In my
> case, this medial axis is akin to the ridge of a mountain. The output
> of the THIN function is an array of the same dimensions as the image
> with all values set to 0 except: If the point is on the medial axis,
> it has a value of '3'. If the point is on the medial axis and is an
> endpoint, it has a value of 2. I need to find a way to extract (in
> order) the ridge data. This task is further complicated because the
> THIN function does not output just one medial axis. Instead, it
> outputs 'segments' if there is a kink in the shape. So, you end up
> with a complex structure of line segments. What I need to do is put
> these segments in order from one endpoint to the other endpoint of the
> ridge. Any ideas?
Get a list of end points and make arrays to keep track of any
end points and ridge points you have already examined. Start with
any unexamined endpoint. Mark it as "examined". Look at its eight
neighbors for an unexamined ridge point. Mark this ridge point
as "examined". Keep doing this until you find another end point.
That's a segment.
Do this until you have no more unexamined end points.
Cheers,
David
P.S. Consider doing this in C. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|