Re: transparent routine using either readu or assoc for same array variable [message #10849] |
Mon, 16 February 1998 00:00  |
Evilio del Rio
Messages: 17 Registered: December 1997
|
Junior Member |
|
|
Jacobus Koster wrote:
>
> Ye of wisdom,
> I would like to write a routine to open a file and read an image stack,
> say 128x128 images, 96 of 'em. I would like to be able to pass a keyword
>
> to this routine, telling it to either read the whole file into an image
> array, or alternately associates it with such an array of the same name
> and dimensions.
> E.g.:
> ...
> Can I name an array of 96 elements in this way, each array element being
>
> a 128x128 image, or do I have to define a structure of 128x128 integer
> arrays,
> , and if so, can I use assoc and readu transparently
> with the same array structure name ?
>
> Thanks for your help,
> Sjaak Koster
Hi Jacobus,
I think it's easier than that. Just use READ or ASSOC and access the
data either as a collection of 96 images:
OPENR,1,Filename
Image = BYTARR(128L,128L,96L)
readu,1,Image
close,1
(...)
process_image,Image[*,*,i]
then you will get Image as an array of 128x128x96 (i.e. 96 128x128
images). Either with random I/O:
OPENR,1,Filename
Stack = ASSOC(1, BYTARR(128L,128L))
(...)
Image = Stack[i]
process_image,Image
here Image is just a 128x128 image. You access different images through
the assignement "Image = Stack[i]". Since it seems that you process your
images sequentally and they are not too big, I would prefer 1st solution
because all I/O is made once for all.
Hope this helps.
Cheers,
____________________________________________________________ ________
Evilio Jose del Rio Silvan Institut de Ciencies del Mar
E-mail: edelrio@icm.csic.es URL: http://www.ieec.fcr.es/~evilio/
"Anywhere you choose,/ Anyway, you're gonna lose"- Mike Oldfield
|
|
|