Re: Reading a Gzipped file in IDL? [message #7536] |
Thu, 21 November 1996 00:00 |
Ken Kump
Messages: 8 Registered: February 1996
|
Junior Member |
|
|
Phil Alvin wrote:
>
> Does anyone know of an IDL routine that can un-gzip a file?
> I realize we could span a gzip process, but we are trying to be
> platform independent and the easiest way to do this would be to
> have an IDL routine which can un-gzip the file before it is read
> with a standard reading routine.
I'm not aware of any, but here is my solution.
I've written a C-routine which I use
a call_external from IDL. Since my volume is a known size, I
define the volume in IDL, and pass this to C with the filename
which is to be uncompressed.
Here is a code segment for a 2D read:
cmdline ='zcat temp.Z';
cons=popen(cmdline,"r");
for(i=0;i<ImageYsize;i++) for(j=0;j<ImageXsize;j++)
{ fscanf(cons,"%c%c",&high,&low);
xx[i*ImageXsize + j]=low+(unsigned int)(256)*high;
}
pclose(cons);
I don't claim this to be terribly efficient...and I'd be
happy to see some improvements...but this worked.
--
Ken Kump
Department of Biomedical Engineering
Case Western Reserve University
Cleveland, Ohio 44106, USA
E-mail: ksk3@po.cwru.edu
|
|
|