DS9 can create and display contours as an overlay on an image. The Analysis Contours menu is used to display contours. To create, copy, paste,  and configure contours, use the Analysis Contour Parameters menu.

Contour Parameters

When creating a new contour, a dialog box appears, in which the user selects the number of contour levels, smoothness, and the distribution of the contours.

Contour Levels

Specifies the number of contour levels to be generated. A typical number is between 1 and 10. Note: large numbers of contours can take a long time to generate.

Contour Smoothness

Specifies how smooth the contours are. A smoothness level of 1 will evaluate the contour at each image pixel. A level of 2 will evaluate the contour at every other pixel. The larger the number, the quicker the contour will be generated, and the less detail will be available.

Contour Scale

Specifies the distribution of the contour levels.

Contour Method

There are two methods that are available to calculate the contour lines. The first, BLOCK, blocks down the image, by the smoothness factor, before contours are calculated. As a result, the larger the smoothness, the faster the result. The second method, SMOOTH, smooths the image before calculating contours. As a result, the larger the smoothness, the slower the result.

Contour Files

A contour file is an ASCII file containing a header, global properties, coordinate system, contour levels, and contour points.


A DS9 contour file may start with the following optional header:

# Contour file format: DS9 version 7.5

Global Properties

Global properties affect all contour levels unless a line level attribute is specified. The global keyword is first, followed by a list of keyword = value pairs. Multiple global property lines may be used within a region file.

global color=green width=1 dash=1 dashlist=8 3

Coordinate Systems

For each contour file, it is important to specify the coordinate system used to interpret the contour points, i.e., to set the context in which the positions are interpreted. For this purpose, the following keywords are recognized:

PHYSICAL                # pixel coords of original file using LTM/LTV
IMAGE                   # pixel coords of current file
FK4,B1950               # sky coordinate systems
FK5,J2000               # sky coordinate systems

ICRS                    # sky coordinate systems
GALACTIC                # sky coordinate systems

ECLIPTIC                # sky coordinate systems
WCS                     # primary WCS
WCSA                    # secondary WCS
LINEAR                  # linear primary WCS

Contour Level

Each contour level is composed of a line value, line attributes and one or more contours. Line attributes are specified at the start of a new level and only affect contours within that level .

level=15.78775 color=pink width=2 dash=yes dashlist=2 2


Each contour is composed of one or more X,Y coordinates, with a deliminator of space or comma,  starting with "(" and ending with ")". Contours are not closed.

(202.4836468 47.22380226
 202.4833538 47.2239185
 202.4831634 47.22409874
 202.4829883 47.22428858)