Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/saord/saotng/image.html
Дата изменения: Unknown
Дата индексирования: Mon Oct 1 23:57:20 2012
Кодировка:
Loading an Image

Loading an Image

Summary:


Contents of This Section


Return to SAOtng Summary User's Guide

Image File Formats

SAOtng can display data stored in FITS image and binary table formats, IRAF image format, IRAF QPOE format, or raw data arrays. The file types generally are recognized on the basis of their file extensions (.imh for IRAF images, .qp for QPOE, and .fit or .fits for FITS). Users who wish to input images in other formats can do so provided those data can be converted to FITS image format, as discussed in SAOtng Advanced Topics.

If a full pathname is not given for the specified image file, SAOtng will search:

Thus, if commonly-used data directories are added to $IMAGE_PATH or to the search path, then the images contained in these directories can be loaded without having to specify the full path. SAOtng also will expand environment variables when processing file names.

FITS Primary Images

When an image file name is sent to SAOtng, a check is made to see if the file is a FITS primary image (i.e., if the first header/data unit contains a valid image). If it is and also if the image is of reasonable size, then the file is read into memory and displayed directly. If the file is FITS, but either is too large or is specified as an image extension or a binary table, the file automatically is processed by the external fitsextract program and displayed.

The "reasonable" size that SAOtng looks for when deciding to process an image in memory is controlled by the -maxsize command switch. This is the size in bytes of the image (a 512x512 floating point image is 512X512x4=1048576 bytes). The maximum size of an internal image can be changed using the Set Max FITS Memory Size in the Images menu.

FITS Image Extensions

SAOtng can display FITS image extensions using a simple bracket notation to specify which image extension to display. Each FITS header/data unit as a a number specified by the EXTNUM FITS keyword. The primary image is assigned a value of 0 by default. The nth image can be displayed in SAOtng by specifying:

    fitsname[n]
Thus, for example, to display the image in the 8th extension of multi.fits, use:
    multi.fits[8]	
Image extensions also can be specified using the name of the extension as contained in the EXTNAME FITS keyword in the FITS extension header. Thus, if the 8th image extension has the keyword EXTNAME="foo", it can be displayed using:
    multi.fits[foo]	
If neither the extension number or name is specified in brackets, SAOtng looks for the environment variables FITS_EXTNUM and FITS_EXTNAME to get this information. This feature allows you to specify a default value for the image extension number or name.

FITS n-D Images

For FITS images having NAXIS>2, SAOtng supports the ability to display image planes. It is assumed that the first 2 axes are the x and y dimensions of the image, and the additional axis specify plane number (e.g., that the 3D image is stored as a stack of 2D images, a 4D image is a stack of image cubes, etc.). To specify an image plane of an n-D image, use a "plane=n3:n4:...:n7" in a bracket specification or use a second bracket specification containing [n3:n4...:n7]. (Sorry, we can't seem to decide yet which syntax is preferable. You vote will count!) For example, to display the nth image plane of a 3D image cube use:

    fitsname[i][n]
or
    fitsname[plane=n]
In the first case, i is the image extension (0 denotes primary image) and n is the image plane. Image plane numbers start a 1. Thus, to display the 5th plane in the 3rd image extension, use:
    multi.fits[3][5]
or
    multi.fits[3,plane=5]

Note that if the 2nd bracket syntax is used, the image section is required when specifying an image plane, even for FITS files containing only 1 primary image. Thus, to specify the 4th plane in a 3-d primary image, use:

    fitsname[0][4]
or
    fitsname[plane=4]
Higher dimensions are specified using the same syntax, with each successive dimension separated by a ":". For example to specify the 2nd image plane of the 4th image cube of a stack of cubes (i.e., a 4D image), use:
    fitsname[0][2:4]
or
    fitsname[plane=2:4]
FITS supports up to 7 image dimensions.

FITS Binary Tables

SAOtng supports display of photon event data contained in FITS Binary Table extensions (e.g., X-ray event lists). Because binary tables do not usually contain enough information to generate an image, we have adopted some conventions for specifying how to bin rows of events into images, based on work done by the SAO and HEASARC X-ray groups.

SAOtng will automatically recognize image extensions names "EVENTS" and "STDEVT" as binary tables with photon data and will display these extensions. If you wish to image a binary table that is not one of these common tables, then you can specify the binary table extension to be imaged in brackets using extension number or name, as with image extensions. Thus, to open the binary table names "MYEVENTS", use:

  bintab.fits[MYEVENTS]
or
  bintab.fits[7]
where the primary header is extension number 0. The environment variable FITS_EXTNAME can be used to specify the extension to open in cases where no extension is specified on the command line. This environment variable can accept a list of extension names; it will image the first extension in a file that matches one of the names in the list. The list should be separated by spaces, commas, semi-colons, or colons, e.g.:
  setenv FITS_EXTNAME "EVENTS STDEVT"

Again, if no extension name or number is specified either on the command line or in an environment variable, SAOtng will will look for an extension named "EVENTS" and "STDEVT" (two common names for X-ray event tables) before giving up.

Once the binary table is known, it is necessary to specify the two columns to be used for the 2D binning. SAOtng first looks for a "binkey=(xname,yname)" specifier in bracket syntax, and uses the column names thus specified. For example, to bin the EVENTS binary table by columns "DETX" and "DETY", use:

  bintab.fits[EVENTS,binkey=(DETX,DETY)]
or
  bintab.fits[EVENTS][binkey=(DETX,DETY)]
You can set the FITS_BINKEY environment variable as an alternative to adding the "binkey=" specifier to each file name. (Note that the two keywords must be grouped together in braces on the command line. This restriction is removed in the environment variable.)

If no keys are specified or the specified columns are not in the binary table, then SAOtng looks for columns named "X" and "Y". If these are not found, it looks for columns containing the characters "X" and "Y". Thus, you can bin on "DETX" and "DETX" columns if these are the only column names containing the "X" and "Y" characters.

Each column that is to be binned must have associated header information that specifies the length of the image axis for that column. This information is equivalent to the NAXISi information maintained for each image dimension of a primary image. SAOtng assumes that this information is contained in headers parameters named TALENi or TLMAXi, where i is the column number of the column in question. Thus, a TALENi (TLMAXi) keyword must be present for each column on which you might want to bin.

FITS binary tables can have event filtering applied to the events during image extraction. This includes filtering on columns and spatial region filtering.

Finally, the data type of the resulting 2D image must be specified. This can be done with the "bitpix=[n]" keyword in the bracket specification. For example:

  bintab.fits[EVENTS,binkey=(DETX,DETY),bitpix=-32]
will create a floating point image binned on columns DETX and DETY. If no bitpix keyword is specified, bitpix=32 is assumed. You also can use the FITS_BITPIX environment variable to set this value.

Compressed FITS Files

SAOtng can display compressed files (i.e., files having .Z and .gz extensions). When a request is made to load a compressed file, SAOtng looks for gunzip, gzcat, zcat or uncompress (in that order) and uses one of these programs to uncompress the FITS image. The uncompressed output is piped to the external fitsextract program for image extraction; results then are sent to SAOtng for display. Note that the compressed file is never de-compressed on disk. All decompression is done via pipes. One of these programs must exist on your system. Usually Unix comes with uncompress and zcat, but these programs work only on .Z files. The more flexible GNU gunzip and zcat programs, which work both on .Z and .gz files, are available for free on the Web (e.g., ftp://www.gnu.org/pub/gnu/gzip-1.2.4.tar, as of 3/98).

WWW FITS Files

SAOtng can retrieve and display FITS files that exist on the World Wide Web (i.e., files having http:// and ftp:// prefixes). When a request is made to load a WWW FITS file, SAOtng looks for the lynx program to retrieve the image. (Currently lynx is distributed as part of the saord package for all systems except Linux, where its existence is assumed.) Lynx is used to retrieve the file over the Web and store it in the SAOtng temporary directory (default is /tmp). The stored file then is processed either as a FITS file or as a compressed FITS file, depending on its extension. (We store the file in a temp dir so that image extractions can be done locally without having to retrieve the file remotely each time.) The SAOtng temporary directory can be changed using the -tmpdir switch (or the SAORD_TMPDIR environment variable) if /tmp is not an appropriate place to store WWW files on your system. These files normally are deleted at the end of the SAOtng session (but of course you can move them out of the temp directory to save them before existing SAOtng.)

Other Image Formats

If the file is not in FITS format, SAOtng checks its extension list to see if the file contains a recognized image file extension. If so, the appropriate image access programs are run to extract the desired image section for display. See Adding New File Formats for more information.

If the file is not a known type, SAOtng checks for an array specification and loads the file as an array if possible.

SAOtng also can display raw event files, that is, files containing a series of event records that are not FITS binary tables.

What Appears in the Display

SAOtng displays data in a 512x512 pixel image buffer or frame. By default, this frame is filled with data from an image section centered in the input image file. The actual dimensions, D, of the image section are determined by the input blocking factor, B, such that D = Bx512. For example, for a 4096x4096 image at B=2, the displayed image section will be centered at 2048,2048 with dimensions 1024x1024. The details of the displayed image section are listed below the color bar in the SAOtng display. The input blocking factor may be selected from the Region Pull-down Menu.

By default, the origin of the image display buffer (i.e., display pixel 1,1) is located in the lower left of the image display (standard IRAF convention). Relocating the display origin may be accomplished by selecting Flip Image By X &/or Y from the Zoom Pull-down Menu. N.B. SAOtng labels pixels starting with 1, consistent with the IRAF/FITS convention.

Displaying Different Image Sections

In addition to an image section at the center of the input image, SAOtng can display sections centered at the four quadrants, by selecting the appropriate section (e.g. Upper Right of Image) from the Images/Set Section To Load Pull-down Menu, and then selecting Redisplay Current Image from the Imagesmenu. For example, in a 2048x2048 image at a blocking factor of 1, selecting Upper Right of Image will display a 512x512 image section centered at 1536,1536. By changing the blocking factor, larger image sections centered at this location can be displayed.

SAOtng also can display the image centered on an arbitrary point by selecting the point using the Ctrl-x and the using Redisplay Current Image from the Imagesmenu.

Displaying Multiple Images

SAOtng provides multiple frames for displaying multiple images.

Using Multiple Frames

The user may display different image data in different frames. In this case, each frame may have a different color map, scaling, and zoom. Alternate frames may be selected by choosing the appropriate item (e.g. Go To Frame 2) from the Frame Pull-down Menu or by using the NxtFram/PrvFram command buttons. By default, SAOtng allocates space for 1 frame, but additional frames may be created by selecting Create New Frame in the Frame menu. SAOtng will blink frames (i.e., repeatedly display all frames in rapid succession) if the Blink Frames item in the Frame menu is selected. The first 4 frames can be displayed simultaneously using the Tile Frames option in the Frame menu.
Last Updated April 1, 1998