Re: Efficient Programing (reading multiband image) [message #4779] |
Thu, 27 July 1995 00:00 |
ian
Messages: 26 Registered: February 1992
|
Junior Member |
|
|
Word has it that Liam Gumley <liamg@ssec.wisc.edu> may have said:
> dean@phobos.cira.colostate.edu wrote:
>> I use the following code to read in an interleave (by pixel) raster image.
> (stuff deleted)
>> IImage = BYTarr(nchan,nx,ny)
>
> As long as you know the image interleave format, you can read the whole
> image in one hit. The interleave options available are
This assumes you can fit the whole image into memory. If you can, yes,
this will work, and fast. If, on the other hand, you have a huge image
(like AVIRIS data), you'll need to use the associated file format. If you
THEN want to extract only one band from the data, or even a few bands,
you're going to have to loop since the associated format only allows
access to one record (one line in the case of BIP data) at a time.
Of course, I could be wrong. If so, I'd be quite pleased to find a
faster way to read in my AVIRIS data.
+-Ian Novack (Particle Man and Comatose Reader)--------ian@gomez.jpl.nasa.gov-+
| "I can't help it! Imminent death makes me tense! Jet Propulsion Lab |
| I admit it!" -- Calvin, learning to ride a bike Pasadena, CA |
+--Disclaimer: Had this been an actual opinion, it would still be mine.-------+
|
|
|
Re: Efficient Programing (reading multiband image) [message #4782 is a reply to message #4779] |
Thu, 27 July 1995 00:00  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
dean@phobos.cira.colostate.edu wrote:
> I use the following code to read in an interleave (by pixel) raster image.
(stuff deleted)
> IImage = BYTarr(nchan,nx,ny)
As long as you know the image interleave format, you can read the whole
image in one hit. The interleave options available are
(1) Band interleaved - image dimensioned as ( pixels, lines, bands )
i.e. all pixels and lines for band 1; all pixels and lines for band 2; ....
(2) Line interleaved - image dimensioned as ( pixels, bands, lines )
i.e. all pixels for band 1, line 1; all pixels for band 2, line 1; ....
(3) Pixel interleaved - image dimensioned as ( bands, pixels, lines )
i.e. all bands for pixel 1, line 1; all bands for pixel 2, line 1; ....
(See IDL 4.0 Ref. Guide p. 1-927, paragraph 2)
You identified the image as pixel interleaved, so you can do the following:
openr, 1, 'image.dat'
image = bytarr( nchan, nx, ny )
readu, 1, image
close, 1
nchan = 0
tvscl, image( nchan, *, * )
If you are interested, I have a compound widget that lets you
interactively pick a data file and specify the data type, size, and interleave.
The data file is then read, and the contents returned in an array.
BYTE, INTEGER, LONG, and FLOAT data types are supported, and an image header offset
in bytes can be specified.
Cheers,
Liam.
liamg@ssec.wisc.edu
|
|
|