STScI Logo

hafton plot



hafton -- draw a half tone picture of an image


hafton image


Two dimensional image or image section to be plotted.
z= 0.0, z2 = 0.0
The minimum (z1) and maximum (z2) intensities to be mapped. If left at the default values of 0.0, the full intensity range will be mapped.
nlevels = 0
The number of intensities levels to be shown. If nlevels = 0 or 1 , the maximum of 16 levels is used.
mapping_function = "linear"
A string specifying the image intensity to half tone mapping function. The default is linear mapping between z1 and z2 . For other choices, see the description section below.
contrast = 0.25
Positive or negative contrast. Negative constrast is indicated by setting contrast to a negative number. The magnitude of contrast is not important unless mapping_function = crtpict .
perimeter = yes
Should a crtpict perimeter with labelled tickmarks be drawn around the plot?
Output device for plot.
title = "imtitle"
The title to be centered above the plot. By default, the title string from the image header is used.
xres = 64, yres = 64
The input image is block averaged or subsampled to this resolution.
preserve = yes
If preserve = yes, the aspect ratio of the image is preserved when achieving the resolution specified by xres and yres .
subsample = no
Should the image be subsampled (as opposed to block averaged) to achieve the specified resolution?
vx= 0.0, vx2 = 0.0, vy1 = 0.0, vy2 = 0.0
The device viewport, in normalized device coordinates (from 0.0 to 1.0 inclusive). If not specified by the user, the plot is centered on the viewport.
fill = no
Should the plot fill the viewport regardless of the device aspect ratio?
append = no
Append to an existing plot?


Task hafton draws a half tone picture of an IRAF image, where varying intensities in the image are represented by areas of varying darkness on the plot. Six different mapping functions are available; the desired mapping function is selected with the mapping_function string. The types of mapping are:

   exponential - emphasizes high intensity values.
   logarithmic - emphasizes low intensity values.
   sinusoidal  - emphasizes mid-range values.
   arcsine     - extreme values emphasized at the expense of mid-range.
   crtpict     - linear mapping centered on median intensity.  The slope of
		 the function is modified by \fBcontrast\fR.
To speed up the plotting, the resolution of the input image can be decreased to xres by yres . When preserve = yes, hafton automatically reduces the image in both directions by the same factor, which is the larger of [ncolumns / xres or nlines / yres]. If the aspect ratio is not being preserved, the x and y dimensions are independently reduced to the specified resolution. No reduction is done if xres and yres = 0, if the input image is an image section, or if the image is smaller than xres by yres .

If the device viewport is not set by the user, hafton automatically sets a viewport centered on the output device. The default value of fill=no means the viewport will be adjusted so that equal numbers of image pixels in x and y will occupy equal lengths when plotted. That is, when fill=no , a unity aspect ratio is enforced, and square images are represented as square plots regardless of the device aspect ratio. On devices with non square full device viewports (e.g., the vt640), a square image will appear extended when fill=yes .


1. Image "crab.6563" is plotted in negative contrast, with linear mapping between the minimum and maximum image pixel.

cl> hafton crab.6563 contrast=-1

2. The image is plotted in negative contrast using the same mapping function as used by the crtpict task. The resulting plot is in negative contrast.

cl> hafton crab.6563 mapping_fun=crt contrast =-0.25


To produce a hafton plot on the terminal takes just under 9 cpu minutes. If the output device is the imagen or versatec (or another nspp device) the total cp time is about an hour.


A large number of plotter instructions ( > 100,000 polylines) is generated per frame for square images.

Source Code · Search Form · STSDAS