One way to process several files in a UNIX C-shell is using
a foreach loop. For example, if you wanted to add a constant
to all the files matching the wildcard run1??.sdf you might:
% foreach f ( run1??.sdf ) ? icadd $f:r 5.6 $f:r ? end
If you wanted the resulting output files to have the same root name but with some string appended, for example image.sdf to become image_db.sdf, then the above would change to:
% foreach f ( run1??.sdf ) ? icadd $f:r 5.6 $f:r_db ? end
Similarly, you might like to store the commands in a script (lets call it icmadd) instead of having to type them each time:
% icmadd 5.6 run1??.sdf
The basic icmadd script would look like this:
#!/bin/csh
figaro # Loads Figaro commands.
set c = $1 # Gets constant to be added from first arg.
shift # Throws away constant from list of args.
foreach f ( $* ) # Processes list of files.
icadd $f:r $f:r_db
end
If you use `isubset' to remove unwanted parts of an image the output file produced remains approximately the same size as the input file. This is the case even if you select only a very small part of the input dataset.
Using NDF sections, this effect can be eliminated, resulting in output files of the expected size. For example, if you wanted to take a 100x100-pixel subset from an image, and would normally use:
% isubset im=inimage ys=200 ye=299 xs=250 xe=349 out=outimage
(note the use of abbreviated parameter names, see notes for 5.1-3), the same subset can be obtained by:
% isubset im=inimage'(200:299,250:349)' ys=min ye=max \
xs=min xe=max out=outimage
The difference being that the file produced by this command will be smaller. If your dataset does not contain n-dimensional axis centres then the KAPPA command NDFCOPY is more succinct.
% ndfcopy inimage'(200:299,250:349)' outimage
Sometimes you may want, for example, to take the median obtained using `istat' and use this value as the FACTOR in an `icsub' command. This can be done as follows:
% istat im=image median % icsub im=image fac=@$ADAM_USER/istat.median out=outimage
This assumes that the environment variable ADAM_USER points to the
directory where your parameter files are stored; this is by default
the directory adam in your home directory (~/adam).
If you wish to access a data file which has the same root name as an NDF you must give the full file name to explicitly select that file. For example, if you have two files image.sdf (an NDF) and image.dst (a DST) in the same directory then
% figaro % convert % icsub image 4 output
will select the NDF, assuming you have not altered the default precedence used (see notes for 5.1-3), and
% figaro % convert % icsub image.dst 4 output
will select the DST file explicitly.
The environment variable FIGARO_FORMATS is no longer used.
FIGARO A general data reduction system