STScI logoSTSDAS Help Pages
imextract ctio imextract

NAME · USAGE · PARAMETERS · DESCRIPTION · EXAMPLES · BUGS · SEE_ALSO

NAME

imextract -- Extract a list of image sections from an image

USAGE

imextract image coordinates

PARAMETERS

image
Image name. The image must be at least two dimensional.
coordinates
List of sections to extract. This is a text file where each line contains the coordinates of the center of the image section, and optionally, the width and the height of it. If the width and the heigth are not specified then defaults values are taken from the width and height parameters.
width = INDEF
Default section width in pixels. This parameter is used when the section width is not specified in the coordinate file.
height = INDEF
Default section height in pixels. This parameter is used when the section height is not specified in the coordinate file.
x, y
Used internally by the task.
dx, dy
Used internally by the task.
flist
Used internally by the task.

DESCRIPTION

This task extracts a list of image sections from an image and creates one output image per section. The input image must be at least two dimensional.
The image sections are specified in a text file, one per line. Each section is defined at least by the coordinates of the center of the section, and optionally by the section width and height. Default values from the width and height parameters are used if the width and the height are not specified in the coordinate file. The section is skipped if one of its attributes is undefined. If the section is beyond the image boundaries it is truncated, and a warning message is issued to the standard output.
The ouput image names are generated by appending a three digit sequence number to the input image name, starting from one. If the output image already exists no image is created, but the sequence number is incremented.

EXAMPLES

Extract a list of sections from a two dimensional image:


ct> imhead image
image[512,512][short]: m51  B  600s
ct>
ct> type list
1.0 100.0
225.000 133.000 
INDEF 230.6
405.000 273.000 10 20		<- width and heigth specified
69.000 460.000
443.000 410.000
20.0 511.0
60.000 225.000
ct>
ct> imextract image list width=3 height=6 
Lower column out of range for coordinate 1 ...truncated
image[1:2,97:103] -> image.001.imh
image[224:226,130:136] -> image.002.imh
Undefined coordinate for line 3 ...skipped
image[400:410,263:283] -> image.003.imh
image[68:70,457:463] -> image.004.imh
image[442:444,407:413] -> image.005.imh
Upper line out of range for coordinate 6 ...truncated
image[19:21,508:512] -> image.006.imh
image[59:61,222:228] -> image.007.imh
ct>
ct> imhead image.*
image.imh[512,512][short]: m51  B  600s
image.001.imh[2,7][short]: m51  B  600s
image.002.imh[3,7][short]: m51  B  600s
image.003.imh[11,21][short]: m51  B  600s
image.004.imh[3,7][short]: m51  B  600s
image.005.imh[3,7][short]: m51  B  600s
image.006.imh[3,5][short]: m51  B  600s
image.007.imh[3,7][short]: m51  B  600s

BUGS

The user has to load the images package manually before using this task because it calls the hselect and imcopy tasks. The package is not loaded automatically.
Due to integer rounding the section width and heigth will be off by one pixel if the width and heigth are even.

SEE ALSO

hselect, imcopy


Source Code · Search Form · STSDAS

Maintained by the Science Software Group at STScI
This file last updated on 9 May 1990