comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: gziped files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: gziped files [message #11380] Thu, 09 April 1998 00:00
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Gordon Waiter wrote:
>
> Is there a way to access a directory containing gzipped files (images in this case), unzip those files,
> read them into an array (which I can already do when unzipped manually from the system prompt) and then re-zip the files, all within a .pro.

One can easily write a short program or script to do this.
You can use DIALOG_PICKFILE() to select a directory, then use
SPAWN to unzip the files if you're on a UNIX system. How you read
them depends on what kind of files they are. You might use
one of the READ_BMP, READ_GIF, etc. routines. If the images are
in raw bitmap format (8- or 16-bit) and are either 64x64, 128x128,
256x256, or 512x512, and perhaps include an initial file header,
then you can use my READ_IMG.PRO which you can download via
anonymous ftp:

bial8.ucsd.edu pub/software/idl/share

Hope this helps.

Dave

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: gziped files [message #11386 is a reply to message #11380] Thu, 09 April 1998 00:00 Go to previous message
dlhopols is currently offline  dlhopols
Messages: 10
Registered: April 1998
Junior Member
In article <6gi5lk$ah8$1@info.abdn.ac.uk>,
mph406@biomed.abdn.ac.uk wrote:
>
> Is there a way to access a directory containing gzipped files (images in
this case), unzip those files,
> read them into an array (which I can already do when unzipped manually from
the system prompt) and then re-zip the files, all within a .pro.


I just did this a while ago, I have rather a complicated directory
pathname but the FINDFILE command finds all matching files and puts them
into a string array. All that you really need to know is the command
and SPAWN lines. The SPAWN command unzips the file without affecting it
in any way.
There is no need to re-zip it, and it can be write protectd. The data is
piped into a unit number which can be read with: readu,lun,dataimage
or whatever read command you use. (Check out Esrg-3.2 libraries
referenced on the IDL pages, idl-fortran contains some example
code.)
>>>> code:
file_string = data_path
print,file_string
filename_array=FINDFILE(data_path+wildcard,COUNT=number_of_f iles)
print,'Information about Matching Files:'
help,filename_array
; Prints out names of data files found
print,'Name of file found:',filename_array

IF (number_of_files GT 0) THEN BEGIN
FOR i = 0, number_of_files-1 DO BEGIN

command = 'zcat '+filename_array(i)
SPAWN,command,unit = lun
print,'..Reading output from command ',command
...
dataimage=intarr(pif_c,pif_l)
readu,lun,dataimage
...
free_lun,lun
return
end


I hope I didn't forget anything. Good luck!

Rose

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Astronaut design proposed for new USA $1 coin
Next Topic: Re: Volume Size

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 02:12:26 PDT 2025

Total time taken to generate the page: 0.87780 seconds