Script doapp.csh
allows you to apply an application to a series of compressed files. It is useful if
disk space is scarce. The files are assumed to have been compressed with the Unix utility
compress
. Each file is, in turn, decompressed, processed and recompressed. In the script
provided application histpeak
in ESP is used to determine the median value of the image
and this value is output to a text file. This effect is achieved by writing histpeak
’s output
to a temporary file and then using the Unix utilities grep
and awk
to extract the details
required.
It is relatively straightforward to change doapp.csh
to perform some other processing. For example,
script dostats.csh
is a modified version which uses KAPPA application stats
to find the mean of
each image. Using the Unix command diff
on scripts doapp.csh
and dostats.csh
will show the
lines that need to be changed to produce a modified script which performs some other
processing.
The input for either script consists of the names of one or more files to be processed (wild-cards are permitted) and the name of the output text file.
The compressed files retain their original name but have the additional file type ‘.Z
’.
File ngc2336_r_2.sdf.Z
will be decompressed, examined, and recompressed. The result will be
written to file result.txt
.
Here the results are written to file results.txt
.
dostats.csh
is similar. Type:
and the results will be written to file stats.txt
.
Obviously you would omit this stage if you were using the scripts ‘for real’ and disk space was scarce.