The extractor program allows you to display an image, and interactively extract regions of interest (ROI's) from it. The region of interest shapes supported include rectangle, line, polyline, signal, circle, curve, ellipse, and freehand. The region of interest extracted may be defined by the region inside the shape, by the region outside the shape, or by the outline of the shape. When a region of interest is extracted, it may be written to an output file, displayed in a separate window, or both.
When running extractor, you must provide an input image. If desired, you may specify the shape to be used in ROI extraction using the [-shape] argument. The [-disp] argument may be used to specify whether the extracted ROI is automatically displayed in a separate window. The [-o] argument may be used to specify an output file. Note that the extracted ROI may be displayed in a separate window, written to an output file, or both. The ROI Extraction Policy dictates whether the region of interest is to be specified by the area inside the shape, by the area outside the shape, or by the outline of the shape; this can be specified using the [-policy] argument.
For all ROI extraction, you will first indicate the desired region of interest by drawing the desired shape in the input image. For all ROI shapes except signal (for which it does not apply) a mask is employed to obscure the pixels which are not inside the region of interest before the ROI is written to disk or displayed. How the mask is applied depends on the ROI Extraction Policy. ROI's may be defined by the area inside the shape drawn, the area outside the shape drawn, or by the outline of the shape drawn.
Once the input image is displayed, the desired ROI shape is specified, the desired ROI Extraction Policy is given, and an optional output filename is entered (all of which can be done using the arguments to extractor) you may immediately begin the ROI extraction process. The procedure used to specify the region of interest in the input image will differ depending on the ROI shape being used. The following is a summary of the available ROI shapes and the procedure used for the extraction of each.
Rectangle The region of interest will be defined by a simple rectangle. For an ROI Extraction policy of "Inside Shape", the subimage defined by the rectangle is extracted. For an ROI Extraction policy of "Shape Outline", the bounding box of the rectangle is calculated, and all pixel values inside the bounding box but not on the outline of the rectangle are masked out. For an ROI Extraction policy of "Outside Shape", the pixel values within the rectangle are masked out, while the remainder of the image is preserved.
To extract a rectangular region of interest, rubberband the rectangle surrounding the region of interest in the input image. To rubberband the rectangle, click the mouse button on a corner of the desired region of interest. Holding the mouse button down, move the mouse to the opposite corner of the desired rectangle. The rectangle will refreshed as the mouse moves, or "rubberbanded" after the mouse.
Line The region of interest will be defined by a line. For ROI Extraction Policies of "Inside Shape" and "Shape Outline", the bounding box is calculated from the endpoints of the line and all pixel values within the bounding box but not on the line are masked out. For an ROI Extraction Policy of "Outside Shape", all pixels on the line itself are masked out, while the rest of the image is preserved.
To extract a line region of interest, rubberband the line defining the region of interest in the input image. To rubberband the line, click the mouse button on one endpoint of the desired region of interest. Holding the mouse button down, move the mouse to the other endpoint of the line.
Signal The region of interest will be defined by a line; however, rather than computing the bounding box of the line and masking out all unwanted pixels, the pixel values on the line are written out alone to the output image. Thus, the extraction of signal ROI's is a useful way of creating VIFF images containing single lines of image data that can be used in a 2D plot. The ROI Extraction Policy does not apply to the signal ROI.
Extraction of a signal is identical to extraction of a line (see above).
Polyline The region of interest will be defined by a polyline. For ROI Extraction Policy of "Inside Shape", the bounding box is calculated from the vertices of the polyline and all pixel values within the bounding box but not inside the polygon are masked out. For an ROI Extraction policy of "Shape Outline", the bounding box is calculated from the vertices of the polyline and all pixel values not on the polyline itself are masked out. For ROI Extraction policy of "Outside Shape", all pixels within the polyline are masked out, while the rest of the image is preserved.
To extract a polyline region of interest, begin by clicking the mouse on one vertex of the desired polyline. As you move the mouse, a line will be rubberbanded after it. Continue to button click on each successive vertex, until the polyline appears as desired; double click to end the polyline. The first and last vertices of the polyline will be joined in order to define a closed region of interest.
Circle The region of interest will be defined by a circle. For ROI Extraction Policy of "Inside Shape", the bounding box is calculated from the dimensions of the circle and all pixel values within the bounding box but not inside the circle are masked out. For an ROI Extraction policy of "Shape Outline", the bounding box is calculated from the vertices of the polyline and all pixel values not on the circle itself are masked out. For ROI Extraction policy of "Outside Shape", all pixels within the circle are masked out, while the rest of the image is preserved.
To extract a circular region of interest, rubberband the circle defining the region of interest in the input image. To rubberband the circle, click the mouse button on the center of the desired region of interest. Holding the mouse button down, move the mouse until the circle has the desired radius.
Ellipse The ellipse region of interest works similarly to that of a circle (see above). To extract an ellipsoid region of interest, rubberband the ellipse defining the region of interest in the input image. Rubberbanding an ellipse is similar to rubberbanding a circle, except that the width and height of the ellipse will be changed with horizontal and vertical mouse movement.
% extractor -i image:mandril