Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/RD/saotng/adding_scales.html
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 01:05:21 2012
Кодировка:

Поисковые слова: южная атлантическая аномалия
Adding New Scaling Algorithms

Adding New Scaling Algorithms

SAOtng supports the following scale algorithms internally:

See Binning Pixel Values by Scaling for more information.

Support for other scaling algorithms can be added to SAOtng by writing a program that takes a FITS image as input and generates a scaled (8-bit) FIT image as output. When activated, a scale command line macro-expanded to fill in user-defined arguments and then is executed externally using the system() function (see Macro expansion in SAOtng.

The ASCII file that defines new scaling algorithms consists of one or more scale descriptors, each of which has the following format:

Note that blank lines separate the file descriptions and should not be used as part of a description. Also, the '#' character is a comment character.

For example, the default image access file currently contains the following:

#
# Data scaling descriptions:
#	help line
#	name of scale
#	type (always "scale")
#	scale command

Linear scaling
linear
scale
$data | linear min=$scalemin max=$scalemax ncolors=$ncolors edge=$edge checkNaN=$donan 2>$errorlog

Log scaling
log
scale
$data | log log=10 min=$scalemin max=$scalemax ncolors=$ncolors edge=$edge checkNaN=$donan 2>$errorlog

Square root scaling
sqrt
scale
$data | pow pow=2.0 min=$scalemin max=$scalemax ncolors=$ncolors edge=$edge checkNaN=$donan 2>$errorlog

Wrapped linear scaling
wrap
scale
$data | wrap min=$scalemin max=$scalemax ncolors=$ncolors edge=$edge checkNaN=$donan 2>$errorlog

No data scaling
none
scale
$data | none 2>$errorlog

Histogram Equalization
histeq
scale
$data | histeq min=$scalemin max=$scalemax ncolors=$ncolors edge=$edge checkNaN=$donan 2>$errorlog

Each scale program command line takes $data as stdin and writes the scaled FITS image to stdout. When the scale algorithm is executed, $data will be replaced by a command to retrieve the unscaled data, which then is passed to the scale program. The output scaled FITS image will be sent back to SAOtng for display using XPA.

The scale programs shown above are written so that the program itself takes FITS data into its stdin and write scaled FITS data to stdout. This need not be the case. For example, consider a scale program that read and wrote FITS disk files instead of stdin and stdout:

    scaleit -i [unscaled_fits] -o [scaled_fits]
This program could use the following command line to scale data in SAOtng:
    $data > /tmp/foo; scaleit -i /tmp/foo -o /tmp/goo; cat /tmp/goo
SAOtng will replace $data with an XPA command to retrieve the unscaled data and also add the appropriate commands to send the output back for display. Of course, it clearly is more efficient to read and write to stdin/stdout and avoid the overhead of disk access.
Return to Advanced Topics Page

Last Updated June 14, 1997