DS9

CXC Science Data Systems

Special file formats

Raw binary array

Raw data arrays are supported. To load an array, the user must provide the dimensions, pixel depth, and optional header size and architecture type. This may be done by specifying a 'qualified filename' of the form

filename[xdim=n1,ydim=n2,zdim=n3,bitpix=m,endian=native$|$little$|$big,skip=N].

where

Examples:

ds9 -array foo.data[xdim=512,ydim=512,zdim=1,bitpix=16] # load 512x512 short
ds9 -array foo.data[dim=256,bitpix=-32,skip=4] # load 256x256 float with 4 byte head
ds9 -array foo.data[dim=512,bitpix=32,arch=little] # load 512x512 long, intel

An alternate supported syntax for the qualified filename is

filename[array([type][dim]:[skip][endian]]

where

Examples:

ds9 -array bar.arr[array(s512)]   # load 512x512 short
ds9 -array bar.arr[array(r256:4)] # load 256x256 float with 4 byte head
ds9 -array bar.arr[array(i512l)]  # load 512x512 long, intel

You can also use the environment variable DS9_ARRAY to specify the qualification string, example:

export DS9_ARRAY='[dim=256,bitpix=-32]'
ds9 -array foo.arr # load 256x256 float

Command:array [filename][opts]
Menu:File - Import - Array
Description:Directly load in a raw binary data array.The options (in the Import Array dialog ) describe the array dimensions and the data type: [xdim=n1,ydim=n2,zdim=n3,bitpix=m,endian=native|little|big,skip=N].Example: ds9 -array foo.arr[dim=512,bitpix=-32,endian=little].The skip option allows you to skip the first N bytes. The option 'array new [filename]' loads into a new frame.

Command:export array [filename] big|little|native
Menu:File - Export - Array
Description:Exports the image to a raw binary data array, specitying the endianness.

Command:array mask [filename]
Menu:Analysis - Mask Parameters - File - Import - Array
Description:Loads a raw binary data array as a mask.

Shared memory data

DS9 has the ability to load a shared memory segment into the current frame.

Command:shm key [n]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm key 102.

Command:shm shmid [n] [name]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm shmid 102 foo.

Command:shm fits key [n] [name]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm fits key 100 foo.

Command:shm mosaicimage iraf key [n] [name]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm iraf key 100 foo.

Command:shm mosaicimage wcs key [n] [name]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm mosaicimage wcs key 100 foo.

Command:shm mosaic wcs key [n] [name]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm mosaic wcs key 100 foo.

Command:shm rgbcube|rgbimage|rgbarray key [n] [name]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm rgbcube key 100 foo.

Command:shm array key|shmid [n] [xdim=x,ydim=y,bitpix=b,skip=s]
Menu:-
Description:Load shared memory segment. Example: xpaset -p ds9 shm array shimid 102 [dim=32,bitpix=-32]

JPEG

DS9 can read JPEG images. For a normal frame, the average of the luminosity (the average of R, G, B) is used. For an RGB frame, the file is loaded directly to the separate channels.

Command:export jpeg [filename] [value]
Menu:File - Export - JPEG
Description:Save image data to a JPEG file, choosing the JPEG quality factor (0 to 100).Export saves the image with whatever scaling/limits/colorbar/contrast/bias/etcapplied. It does not include any regions, illustrations. The outputis the same raw/original dimensions as the image read in, ignoring any zoom performed.

Command:jpeg [filename]
Menu:File - Import - JPEG
Description:Load a JPEG image into DS9. Only the IMAGE coordinate ssytem is available.

Command:saveimage [filename].jpeg [value]
Menu:File - Save Image- JPEG
Description:Create a JPEG of a screen capture of the current main window, as zoomed etc,, including colorbar and overlays such as regions.

Command:jpeg new [filename]
Menu:-
Description:Load a JPEG image into a new frame. Only the IMAGE coordinate ssytem is available.

Command:jpeg slice [filename]
Menu:File - Import - Slice - JPEG
Description:Load a JPEG image into the current slice.

GIF

DS9 can read GIF images. For a normal frame, the average of the luminosity (the average of R, G, B) is used. For an RGB frame, the file is loaded directly to the separate channels.

Command:export gif [filename]
Menu:File - Export - GIF
Description:Save current image as a GIF file.Export saves the image with whatever scaling/limits/colorbar/contrast/bias/etcapplied. It does not include any regions, illustrations. The outputis the same raw/original dimensions as the image read in, ignoring any zoom performed.

Command:gif [filename]
Menu:File - Import - GIF
Description:Load a GIF image into DS9. Only the IMAGE coordinate ssytem is available.

Command:saveimage gif [filename]
Menu:File - Save Image - GIF
Description:Create a GIF of a screen grab of the current main window, including colorbar and overlays such as regions.

Command:gif new [filename]
Menu:-
Description:Load a GIF image to a new frame

Command:gif slice [filename]
Menu:File - Import - Slice - GIF
Description:Load a GIF image into the current slice.

PNG

DS9 can read PNG images. For a normal frame, the average of the luminosity (the average of R, G, B) is used. For an RGB frame, the file is loaded directly to the separate channels.

Command:export png [filename]
Menu:File - Export - PNG
Description:Save current image as a PNG file.Export saves the image with whatever scaling/limits/colorbar/contrast/bias/etcapplied. It does not include any regions, illustrations. The outputis the same raw/original dimensions as the image read in, ignoring any zoom performed.

Command:png [filename]
Menu:File - Import - PNG
Description:Load a PNG image into DS9. Only the IMAGE coordinate ssytem is available.

Command:saveimage png [filename]
Menu:File - Save Image - PNG
Description:Create a PNG of a screen grab of the current main window, including colorbar and overlays such as regions.

Command:png new [filename]
Menu:-
Description:Load a PNG image to a new frame

Command:png slice [filename]
Menu:File - Import - Slice - PNG
Description:Load a PNG image to the current slice.

EPS

Command:saveimage eps [filename]
Menu:File - Save Image - EPS
Description:Create an EPS file of a screen grab of the current main window, including colorbar and overlays such as regions.

TIFF

DS9 can read TIFF images. For a normal frame, the average of the luminosity (the average of R, G, B) is used. For an RGB frame, the file is loaded directly to the separate channels.

Command:export tiff [filename] [compression]
Menu:File - Export - TIFF
Description:Save current image as a TIFF file. Specify the compression option.Options are none, jpeg, packbits, and deflate.Export saves the image with whatever scaling/limits/colorbar/contrast/bias/etcapplied. It does not include any regions, illustrations. The outputis the same raw/original dimensions as the image read in, ignoring any zoom performed.

Command:tiff [filename]
Menu:File - Import - TIFF
Description:Load a TIFF image into DS9. Only the IMAGE coordinate ssytem is available.

Command:saveimage [filename].tiff [compression]
Menu:File - Save Image - TIFF
Description:Create a TIFF of a screen grab of the current main window, including colorbar and overlays such as regions. Specify compression to use.

Command:tiff new [filename]
Menu:-
Description:Load a TIFF image to a new frame

Command:tiff slice [filename]
Menu:File - Import - Slice - TIFF
Description:Load a TIFF image to the current slice.

ENVI

ENVI is the NV5 Environment for Visualizing Images, used for geospatial applications. BIL, BIP and BSQ encodings are supported.

Command:envi [new] [header][filename]
Menu:File - Import - ENVI
Description:Load an ENVI header and file.Example:xpaset -p ds9 envi foo.hdr foo.bsqxpaset -p ds9 envi new bar.hdr

Command:export envi e.hdr e.bsq [big|little|native]
Menu:File - Export- ENVI
Description:Export the current image to an ENVI format header and file. Use the endianness specified.

NRRD

NRRD (Nearly Raw Raster Data) is a file format for N-dimensional images. DS9 supports the raw and gzip encodings.

Command:export nrrd [filename] [big|little|native]
Menu:File - Export- NRRD
Description:Export the current image to an NRRD format file. Use the endianness specified.

Command:nrrd [filename]
Menu:File - Import- NRRD
Description:Load an NRRD file. The filename may have a '[sect]' qualification

Command:nrrd new [filename]
Menu:-
Description:Load an NRRD file in a new frame.

Command:nrrd mask [filename]
Menu:Analysis - Mask Parameters - File - Import - NRRD
Description:Loads a mask from an NRRD format file.

Used-defined file formats

DS9 supports external file formats via an ASCII description file. The format description file (FDF) is called .ds9.filin and is looked for in the the local directory and then the user home directory.

The FDF consists of a sequence of file format descriptions separated by blank lines and optional comment lines starting with #. Each format description has four lines:

An example FDF defining an IRAF IMH file:

For Example:
# File access descriptions:
#       help explanation
#       file template
#       file type
#       access command
IRAF IMH files
*.imh
IMH
i2f -s $filename

The user would then read a file foo.imh in this format into DS9 with

ds9 -i2f -s foo.imh

DS9 assumes that the output of the user command (i2f in this case) is a streamed FITS file with the image data, sent to standard output. DS9 then sucks in that data from standard input, equivalently to

cat foo.fits | xpaset ds9 fits