transparent routine using either readu or assoc for same array variable [message #10854] |
Sun, 15 February 1998 00:00 |
Jacobus Koster
Messages: 3 Registered: February 1998
|
Junior Member |
|
|
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.:
Procedure getimage_stack,filename,image,open=open
If keyword_set(open) then begin
?which commands to declare image as an array of 96 images of 128x128
integers?
Openr,1,filename
For I=0,95 do Readu,lun,image[I]
Endif else begin
Openr,1,filename
image=Assoc(1,intarr(128,128))
Endelse
End ; of getimage
pro process_image
getimage_stack,filename,image,open=(either 1 or 0)
image=intarr(128,128)
for i=0,95 do
image=image_stack(i)
do something with image
endfor
close_image (won't include here)
end
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
|
|
|