NDF2GIF

Converts an NDF into a GIF file.

Description:

This Bourne-shell script converts an NDF into a 256 grey-level Graphics Interchange Format (GIF) file. One- or two-dimensional images can be handled and various methods of scaling the data are provided. The script uses the Convert utility NDF2TIFF to produce a TIFF file and then various NETPBM utilities to convert the TIFF file into a GIF file.

If the ‘high’ scaling value is less than the ‘low’ value, the output image will be a negative. Bad values are set to 0 for positives and 255 for negatives.

Error messages are converted into Starlink style (preceded by !).

Usage:

ndf2gif in [out] [scale]
low=? high=? percentiles=? [nbins=?] sigmas=?

Parameters:

IN = NDF (Read)
The name of the input NDF (the .sdf extension is not required).
OUT = FILENAME (Write)
The name of the GIF file to be generated (a .gif name extension is added if it is omitted). If OUT is omitted, the value of the IN parameter is used. Any existing file with the same name will be overwritten.

The following parameters are actually parameters of the ADAM task NDF2TIFF. Their values on the NDF2GIF command line are just passed through to NDF2TIFF, which may prompt for other required values. The output parameters SCAHIGH and SCALOW will be found in NDF2TIFF’s parameter file.

HIGH = _DOUBLE (Read)

Only required if SCALE is "Scale". The array value that scales to 255 in the TIFF file. All larger array values are set to 255 when HIGH is greater than LOW, otherwise all array values less than HIGH are set to 255. The dynamic default is the maximum data value. There is an efficiency gain when both LOW and HIGH are given on the command line, because the extreme values need not be computed. The highest data value is suggested in prompts.
LOW = _DOUBLE (Read)
Only required if SCALE is "Scale". The array value that scales to 0 in the TIFF file. All smaller array values are also set to 0 when LOW is less than HIGH, otherwise all array values greater than LOW are set to 0. The dynamic default is the minimum data value. There is an efficiency gain when both LOW and HIGH are given on the command line, because the extreme values need not be computed. The lowest data value is suggested in prompts.
MSG_FILTER = LITERAL (Read)
The output message filtering level, QUIET, NORMAL or VERBOSE. If set to verbose, the scaling limits used will be displayed. [NORMAL]
NUMBIN = _INTEGER (Read)
Only used if SCALE is "Percentiles". The number of histogram bins used to compute percentiles for scaling. (Percentiles mode) [2048]
PERCENTILES( 2 ) = _REAL (Read)
Only required if SCALE is "Percentiles". The percentiles that define the scaling limits. For example, [25,75] would scale between the quartile values.
SCALE = LITERAL (Read)
The type of scaling to be applied to the array. The options, which may be abbreviated to an unambiguous string and are case-insensitive, are described below: ["Range"]
SIGMAS( 2 ) = _REAL (Read)
Only required if SCALE is "Sigmas". The standard-deviation bounds that define the scaling limits. To obtain values either side of the mean both a negative and a positive value are required. Thus [-2,3] would scale between the mean minus two and the mean plus three standard deviations. [3,-2] would give the negative of that.

Results Parameters

SCAHIGH = _DOUBLE (Write)
The array value scaled to the maximum colour index for display.
SCALOW = _DOUBLE (Write)
The array value scaled to the minimum colour index for display.

Examples:

ndf2gif old new
This converts the NDF called old (in file old.sdf) into a GIF file new.gif.
ndf2gif horse scale=pe
This converts the NDF called horse (in file horse.sdf) into a GIF file horse.gif using percentile scaling. The user will be prompted for the percentiles to use.

Notes:

The following points should be remembered:

Related Applications

Convert: GIF2NDF, NDF2TIFF.