Re: Collection of different sized arrays [message #69516 is a reply to message #69515] |
Sun, 17 January 2010 05:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Robin Wilson writes:
> I have a suspicion that this question may have been asked before, but I
> can't seem to find the answer in the achives of this group. Possibly I'm
> not searching using the right keywords...
>
> Basically, I need to keep a collection of different sized arrays. I am
> writing an image segmentation routine, which will take an image and
> split it into segments. I need to keep track of which pixels in the
> image are in each segment. My thought is that I'll have an array for
> each segment which will contain the indices of the pixels within that
> segment. However, I can't work out how to store this collection of
> arrays in IDL, as each array will be a different length, and I won't
> know the number of segments or the lengths of the arrays at
> compile-time. Also, to add to the fun, the pixels in each segment are
> likely to change during the segmentation process...
>
> I have a suspicion the answer may involve pointers, or objects
> (possibly?) or something like that, but I'm not really sure.
Yes, use a pointer array. Each pointer in the array
can point to whatever you would like it to point to.
You can change whatever it points to whenever you like.
Here is a pointer tutorial, if you are unfamiliar with them:
http://www.dfanning.com/misc_tips/pointers.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|