| imedit | images.tv | imedit |
imedit -- examine and edit pixels in images
imedit input output
Regions of images are examined and edited. This may be done interactively using an image display and cursor or noninteractively using a list of positions and commands. There are a variety of display and editing options. A list of input images and a matching list of output images are specified. The output images are only created if the input image is modified (except by an explicit "write" command). If no output list is specified (an empty list given by "") then the modified images are written back to the input images. The images are edited in a temporary buffer image beginning with "imedit".
Commands are given via a cursor list. When the task is run interactively this will normally be the standard image cursor (stdimcur). Commands may be read from a file. The file format may be cursor values including the command keys, a simple list of positions with the default command given by the default parameter, and a regions file, as used in the task fixpix and the ccdred package, selected by the fixpix parameter.
The commands which modify the image may be written to a log file specified by parameter logfile . This file can be used as a record of the pixels modified. The format of this file is also suitable for input as a cursor list. This allows the same commands to be applied to other images. Be careful not to have the cursor input and logfile have the same name!
When the display parameter is set the command given by the parameter command is executed. Normally this command loads the image display though it could also create a contour map or other graph whose x and y coordinates are the same as the image coordinates. The image is displayed when editing interactively and the standard image cursor (which can be redefined to be the standard graphics cursor) is used to select regions to be edited. When not editing interactively the display flag should be turned off.
It is nice to see changes to the image displayed immediately. This is possible using the autodisplay option. Note that this requires the display parameter to also be set. If the autodisplay flag is set the display command is repeated after each change to the image. The drawback to this is that the full image (or image section) is reloaded and so can be slow. If not set it is still possible to explicitly give a redisplay command, r, after a number of changes have been made.
Another display option is to make surface graphs to the specified graphics device (normally the standard graphics terminal). This may be done by the commands g and s and automatically after each change if the autosurface parameter is set. The two types of surface plots are a single surface of the image at the marked position and before and after plots for a change.
Regions of the image to be examined or edited are selected by one or two cursor commands. The single cursor commands define the center of an aperture. The shape of the aperture, circular or square, is specified by the aperture parameter and the radius (or half the edge of a square) is specified by the radius parameter. The radius may be zero to select a single pixel. The keys + and - may be used to quickly increment or decrement the current radius. The two keystroke commands either define the corners of a rectangular region or the endpoints of a line.
Because it is sometimes difficult to mark cursor position precisely the defined region may be shifted so that the center is either a local maximum or minimum. This is usually desired for editing cosmicrays, bad pixels, and stars. The center pixel of the aperture is moved within a specified search radius given by parameter search . If the search radius is zero then the region defined by the cursor is not adjusted. The sign of the search radius selects whether a maximum (positive value) or a minimum (negative value) is sought. The special key t toggles between the two modes in order to quickly edit both low sensitivity bad pixels and cosmicrays and stars.
Once a region has been defined a background region may be required to estimate the background for replacement. The background region is an annulus of the same shape separated by a buffer width, given by the parameter buffer , and having a width given by the parameter width .
The replacement options are described below as is a summary of all the commands. Two commands requiring a little more description are the space and p commands. These print the statistics at the cursor position for the current aperture and background parameters. The printout gives the x and y position of the aperture center (after the search if any), the pixel value (z) at that pixel, the mean background subtracted flux in the aperture, the number of pixels in the aperture, the mean background "sky", the sigma of the background residuals from the background fit, and the number of pixels in the background region. The p key additionally prints the pixel values in the aperture. Beware of apertures with radii greater than 5 since they will wrap around in an 80 column terminal.
When done editing or examining an image exit with q or Q. The former saves the modified image in the output image (which might be the same as the input image) while the latter does not save the modified image. Note that if the image has not been modified then no output occurs. After exiting the next image in the input list is edited. One may also change input images using the ":input" command. Note that this command sets the output to be the same as the input and a subsequent ":output" command should be used to define a different output image name. A final useful colon command is ":write" which forces the current editor buffer to be written. This can be used to save partial changes.
IMEDIT CURSOR KEYSTROKE COMMANDS
? Print help : Colon commands (see below) <space> Statistics g Surface graph i Initialize (start over without saving changes) q Quit and save changes p Print box of pixel values and statistics r Redraw image display s Surface plot at cursor t Toggle between minimum and maximum search + Increase radius by one - Decrease radius by one I Interrupt task immediately Q Quit without saving changes
The following editing options are available. Rectangular and line regions are specified with two positions and aperture regions are specified by one position. The current aperture type (circular or square) is used in the latter case. The move option takes two positions, the position to move from and the position to move to.
a Background replacement (rectangle) b Background replacement (aperture) c Column interpolation (rectangle) d Constant value substitution (rectangle) e Constant value substitution (aperture) f Interpolation across line (line) j Replace with input data (rectangle) k Replace with input data (aperture) l Line interpolation (rectangle) m Copy by replacement (aperture) n Copy by addition (aperture) u Undo last change (see also 'i', 'j', and 'k')
When the image display provides a fill option then the effect of zoom and roam is provided by loading image sections. This is a temporary mechanism which will eventually be replaced by a more sophisticated image display interface.
E Exapnd image display P Pan image display R Redraw image display Z Zoom image display 0 Redraw image display with no zoom 1-9 Shift display
IMEDIT COLON COMMANDS
The colon either print the current value of a parameter when there is no value or set the parameter to the specified value.
angh [value] Horizontal viewing angle (degrees) angv [value] Vertical viewing angle (degrees) aperture [type] Aperture type (circular|square) autodisplay [yes|no] Automatic image display? autosurface [yes|no] Automatic surface plots? buffer [value] Background buffer width command [string] Display command display [yes|no] Display image? eparam Edit parameters graphics [device] Graphics device input [image] New input image to edit (output name = input) output [image] New output image name radius [value] Aperture radius search [value] Search radius sigma [value] Noise sigma (INDEF for histrogram replacement) value [value] Constant substitution value width [value] Background annulus width write [name] Write changes to name (default current output) xorder [value] X order for background fitting yorder [value] Y order for background fitting
None
1. Interactively edit an image.
cl> imedit raw002 ed002
2. Edit pixels noninteractively from an x-y list. Replace the original images by the edited images.
cl> head bad 20 32 40 91 <etc> cl> imedit raw* "" cursor=bad display-
3. It is possible to use a contour plot for image display. This is really not very satisfactory but can be used in desparation.
cl> reset stdimcur=stdgraph cl> display.command="contour $image >& dev$null" cl> imedit raw002 ed002
4. Use a "fixpix" file (without trim option).
cl> head fixpix 20 22 30 80 99 99 1 500 <etc> cl> imedit raw* %raw%ed%* cursor=fixpix fixpix+ display-
The zoom and roam features provided here are quite useful. However, they depend on a feature of the tv.display program which fills the current image display window by pixel replication or interpolation. If this is left out of the display command these features will not work. The trick is that this task displays sections of the editor buffer whose size and position is based on an internal zoom and center and the display program expands the section to fill the display.
The surface plotting is done using an imported package. The limitations of this package (actually limitations in the complexity of interfacing the application to this sophisticated package) mean that the surface plots are always scaled to the range of the data and that it is not possible to label the graph or use the graphics cursor to point at features for the task.
ccdred.instruments proto.fixpix