Re: Using ASSOC function [message #12131 is a reply to message #12130] |
Thu, 02 July 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Bernard Puc (puc@gsfc.nasa.gov) writes:
> Using ASSOC, I can access an image array stored in a datafile. Is it
> possible to instead select a subimage of that array? I'm looking to
> optimize the file access speed by not having to read the entire file or
> array into a variable. Thanks in advance.
If you are asking if you can do this:
file = FilePath(SubDir=['examples', 'data'], 'cereb.dat')
OpenR, lun, file, /Get_Lun
images = Assoc(lun, BytArr(512, 512))
thisPartImage = (images(0))[0:255,256:512]
Help, thisPartImage
TV, thisPartImage
Then the answer, amazingly enough, is yes.
I can't quite believe this, because I would have thought
it mattered how the data was laid out in the file (i.e,
in row order) as to whether you get what you think you
are going to get, but apparently it doesn't. I've tried
all kinds of subscripts. They all work.
Don't you just LOVE IDL! :-)
Cheers,
David
P.S. As to whether this is faster or not, I can't tell.
This is image is read so fast on my 400 MHz machine I
can't separate the time meaningfully from zero.
--
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|