User's Guide

SEGMREPR

Repairs lines or segments in a given image with a constant or by averaging

Function:

Provides a means of replacing rectangular groups of pixels (repair windows) within an image. The inserted values may be either weighted averages of the pixels surrounding the repair window or a user-specified constant. The maximum number of repair windows that may be specified is 10. SEGMREPR handles images with single or multiple bands and any data type.

When an output image is supplied SEGMREPR calls COPY to copy all of the input images to this file and then modifies the new output image. If no output image is supplied, then SEGMREPR modifies the original image.

Parameters:

IN
Input image. Specifies the input image(s) to be corrected. IN may of any data type and may be windowed or subbanded. When updating the input image a combination of images cannot be used (ie. "IMG1 + IMG2").

OUT
Output image. Specifies the output image that is to contain the corrected data. The output image is of the same size, data type, and number of bands as the input image. If a combination of input images is specified then the output image will have the same data type as the first input image. If OUT is set to NULL (--) then the input image is modified.

REPLOPT(AVER)
Replacement option. Indicates whether the user wants to replace the pixels within each repair window with a constant or an average of the neighboring pixels.

  = AVER :  Use both horizontal and
	    vertical averaging
  = CONS :  Replace by PIXVAL
  = HORI :  Use horizontal averaging only
  = VERT :  Use vertical averaging only

PIXVAL(0,0,0,0,0,0,0,0,0,0)
Pixel value. The value used for replacement pixels if REPLOPT = CONS. The replacement value must lie within the range of the image data type.

Each element within PIXVAL corresponds to the same window, i.e., PIXVAL(1) corresponds to INWIND1, PIXVAL(8) corresponds to INWIND8, etc.

INWIND1
Window specification. INWIND1 through INWIND10 specify the repair windows to be fixed. Each is of the form (SL, SS, NL, NS) where

   SL = starting line
   SS = starting sample
   NL = number of lines
   NS = number of samples

You may specify at most 10 repair windows. When specifying repair windows you must not skip any of the parameters. For example, when specifying one window, use INWIND1; when specifying three windows, use INWIND1, INWIND2, and INWIND3; etc. When SEGMREPR encounters a repair window with a null value, it ignores all of the remaining INWIND parameters.

The repair windows specified should not overlap nor should their boundaries touch. Such cases may produce misleading results and are NOT guarded against by SEGMREPR.

INWIND2(--)
See parameter description for INWIND1.

INWIND3(--)
See parameter description for INWIND1.

INWIND4(--)
See parameter description for INWIND1.

INWIND5(--)
See parameter description for INWIND1.

INWIND6(--)
See parameter description for INWIND1.

INWIND7(--)
See parameter description for INWIND1.

INWIND8(--)
See parameter description for INWIND1.

INWIND9(--)
See parameter description for INWIND1.

INWIND10(--)
See parameter description for INWIND1.

Examples:

  1. LAS> segmrepr in=test out=new replopt=cons inwind1=(20,20,50,50)

    SEGMREPR copies the input image TEST to the output image NEW and then replaces the region INWIND1 with zeroes in the image NEW.

  2. LAS> segmrepr in=test out=new inwind1=(20,20,50,50) inwind2=(75,75,50,50)

    SEGMREPR copies the input image TEST to the output image NEW and then replaces the regions INWIND1 and INWIND2 of image NEW with averages of their borders.

  3. LAS> segmrepr in=test out=-- replopt=vert inwind1=(1,1,100,350)

    SEGMREPR modifies the input image TEST by replacing the region INWIND1 with the average of the lines above and below the region. Since there is no line that lies above the starting line of INWIND1, the line just below the window is used for this line.

  4. LAS> segmrepr in="test + old" out=new replopt=hori inwind1=(10,10,1024,4)

    COPY copies the input images TEST and OLD to the output image NEW and then SEGMREPR replaces the region INWIND1 with the average of the pixels to the left and right of the region.

  5. LAS> segmrepr in="test(100 100 50 50)" out=-- replopt=cons inwind1=(10,10,2,20)

    SEGMREPR replaces the region INWIND1 of image TEST with zeroes.

    Note that INWIND1 is relative to the input image window. Therefore lines 109 and 110 from sample 109 to sample 128 are replaced with zeroes.

  6. LAS> segmrepr in="test(100 100 50 50)" out=new replopt=cons inwind1=(10,10,2,20)

    SEGMREPR copies the windowed portion of the input image TEST to the output image NEW and then replaces the region INWIND1 of image NEW with zeroes.

    Note that INWIND1 is relative to the input image window. Therefore lines 10 and 11 from sample 10 to sample 29 are set to zero in image NEW. This corresponds to lines 109 and 110 in image TEST from sample 109 to sample 128.

Description/Algorithm:

If the user requests constant replacements (REPLOPT=CONS), the value of PIXVAL is used to fill the given repair window(s).

For weighted averaging (REPLOPT=AVER), the following applies:

For (REPLOPT=VERT), the following description holds true:

For (REPLOPT=HORI), the following description holds true:

Note that if a given repair window prevents formation of the boundary on one or two sides, ie. a repair window edge overlaps an image edge, the replacement value is computed based on the remaining boundary pixels.

Nonfatal Error Message:

  1. [segmrepr-warn] Nonfatal error encountered

    An error occurred during processing of associated files. The image is saved and presumed to be accurate.

Fatal Error Messages:

  1. [segmrepr-alloc] Error allocating dynamic memory

    An error occurred when attempting to allocate enough memory to process the image. See system manager.

  2. [segmrepr-comb] Combinations of images are not allowed when updating

    When updating the input image a combination of images cannot be specified. Run SEGMREPR once for each of the images specified.

  3. [segmrepr-entire] Repair window equals entire image

    The repair window must be a subset of the entire image area for all replacement options except CONS. Respecify the repair window.

  4. [segmrepr-fatal] Fatal error encountered

    A fatal error was encountered during processing. Processing is terminated. The error message that is displayed immediately preceding this message is the specific error that was encountered.

  5. [segmrepr-hori] Repair window spans entire image horizontally

    The repair window cannot span the entire image in the horizontal direction when the parameter REPLOPT is set to HORI or AVER. Respecify the repair window or change the replacement option.

  6. [segmrepr-range] PIXVAL is out of range for the input image data type

    Specify a value that is within the range of the image's data type.

  7. [segmrepr-relative] Repair window extends outside input image

    The repair window lies partially outside of the specified image or windowed image. Respecify the repair window so that it is relative to the image or it's window and it is contained entirely within the image or it's window.

  8. [segmrepr-size] Input images do not have the same window sizes

    The input images are of different sizes. Make sure the input images have the same number of lines and samples or specify windows for the images.

  9. [segmrepr-vert] Repair window spans entire image vertically

    The repair window cannot span the entire image in the vertical direction when the parameter REPLOPT is set to VERT or AVER. Respecify the repair window or change the replacement option.

User Notes:

  1. To keep track of what is actually happening, it is much easier to run this program several times than to try repairing everything at once.

  2. See LINEOFF, LINEREPR, FIXLIN, and SEGMOFF for alternative image correction functions.