Re: IDL/PV-Wave - Can they strip headers in binary files? [message #1237] |
Fri, 18 June 1993 13:26  |
ft
Messages: 4 Registered: May 1993
|
Junior Member |
|
|
In article <9306171303.AA03092@tigermoth.aero.gla.ac.uk.gla.ac.uk> gnaa38@aero.gla.ac.uk (Paul Porcelli) writes:
> Could someone tell me how IDL or PV-Wave copes with dislaying data from a
> binary file which has a a header of various types (ie int,float,string) and
> which also defines the number of records in the file.
> Would the header have to be stripped first by another program?
> I am specifically interested in how easy it is to read from a file of
> this type and ouput the data in a graphical format(ie plot etc).
> Are any of the two products more suited to this task?
> Any help will be greatly appreciated.
In PV-Wave (and maybe IDL too, I haven't used it) you can use the assoc()
command to associate a binary file with a variable, including parsing of the
binary data into array structures, and skipping of header data. Eg:
avar=assoc(lun,bytarr(512,512),1024B)
Where lun is the unit number of an opened file, the byte array is the
desired parsing format of the data, and 1024B skips 1024 bytes of header in
the file. Then, you can access chunks of the file as:
image1=avar(0) ; first 512x512 byte image
image2=avar(1) ; second...
The data is not read from the file until the associated variable is assigned
to something else (which can be done in a command, like: "tv,avar(0)". As I
understand it, the offset and the array structure can be specified as any
data type (byte, int, long, float, etc), so you can parse the file as you
like.
Then, you can use any of the image commands (tv,tvscl,rot,fft,etc) on the
array structure (if it's an image).
PV-Wave also has precut commands for reading various graphics formats (in
version 4.1 - I understand there will be more of these in 4.2 in a few
months):
dc_read_8_bit(filename) ; read 8 bit raster file
dc_read_24_bit(filename) ; read 24 bit raster file
dc_read_tiff(filename) ; read TIFF format image (no jpg support tho)
> Paul Porcelli
> Technical Programmer
> Dept of Aerospace Engineering
> University of Glasgow
> Tel: 041-339-8855 (x4345)
--
Fred True
AT&T
ft@maxwell.ccs.att.com
ftrue@attmail.com
|
|
|