User's Guide

FIXLIN

Replace blocks of bad image data

Function:

Allows the user to generate replacement blocks of image data to be substituted for bad image data. Each replacement block is contrast enhanced to match the brightness values of the bad band. The band used for the replacement should correlate highly to the band requiring the fix. For example, Landsat bands 6 and 7 are highly correlated, but bands 4 and 7 are not. Up to ten blocks can be specified within the image to be replaced in one execution run. Restrictions are: (1) all of the replacement lines for each execution run are required to be from the same image and (2) two blocks of bad image data cannot have the same line range. (Refer to User Notes.)

Parameters:

IN
Input images. The input image IN(1) contains bad data lines which are to be replaced by image lines of IN(2). The images of IN(1) and IN(2) do not have to be of the same size nor of the same data type. If the window option is used, the resulting output file of the image will be the same size as the window specification of IN(1).

When the window option is used, caution must be used to make sure the window defined by INWIND(x) is within the window specification of image IN(1). For example, if the user made the following assignment:

      IN="IN.DAT(25,20,30,40)" "REPLACE.DAT" +
      OUT=OUT.DAT INWIND1=(30,15,1,10),

a window specification error results because the starting sample of 15 is not within the window specification. The window of the image file has a starting sample of 20.

This parameter expects only one image band; therefore, if IN(1) is assigned to a multi-band image, the band option must be used to select only one of the bands.

OUT
Output image. This is the name of the output image containing the image data of parameter IN(1) with the bad lines being replaced with lines of the replacement image IN(2). The data type of the output image is the same as IN(1), the image being fixed.

INWIND1(0,0,0,0)
Window specification. This is the window specification (SL,SS,NL,NS) defining the blocks of bad image data of IN(1) that is to be replaced. Each block is replaced by the corresponding block defined by values of SUWIND(x).

INWIND(x) each have four values which define up to ten blocks of bad image data to be replaced in IN(1). Each INWIND(x) contains four values: the starting line, starting sample, number of lines, and number of samples to be replaced.

The number of blocks defined by INWIND(x) must be equal to the number of blocks defined by SUWIND(x) or the default value for SUWIND(x) must be used.

INWIND2(0,0,0,0)
See parameter description for INWIND1.

INWIND3(0,0,0,0)
See parameter description for INWIND1.

INWIND4(0,0,0,0)
See parameter description for INWIND1.

INWIND5(0,0,0,0)
See parameter description for INWIND1.

INWIND6(0,0,0,0)
See parameter description for INWIND1.

INWIND7(0,0,0,0)
See parameter description for INWIND1.

INWIND8(0,0,0,0)
See parameter description for INWIND1.

INWIND9(0,0,0,0)
See parameter description for INWIND1.

INWIND10(0,0,0,0)
See parameter description for INWIND1.

SUWIND1(--)
Substitution window. This is the window specification (SL,SS) defining the replacement blocks of IN(2) to be used to fix the bad image data of IN(1). The default is to use the same window specifications as used in the block definition of INWIND(x). If the default values are not used, the number of blocks defined in SUWIND(x) must be equal to the number of blocks defined by INWIND(x).

SUWIND(x) has two values each defining up to ten blocks of replacement data in IN(2) to fix the image of IN(1). Each SUWIND(x) contains two values--the starting line and starting sample. The size of the block, i.e., number of lines and number of samples, are not specified because the replacement block must be the same size as the block it is replacing, which is specified by parameter INWIND(x).

SUWIND2(--)
See parameter description for SUWIND1.

SUWIND3(--)
See parameter description for SUWIND1.

SUWIND4(--)
See parameter description for SUWIND1.

SUWIND5(--)
See parameter description for SUWIND1.

SUWIND6(--)
See parameter description for SUWIND1.

SUWIND7(--)
See parameter description for SUWIND1.

SUWIND8(--)
See parameter description for SUWIND1.

SUWIND9(--)
See parameter description for SUWIND1.

SUWIND10(--)
See parameter description for SUWIND1.

NHIST(1)
Number of histograms. This is a ten-value parameter representing the number of histograms to be built for each block of bad image data. NHIST is of type INTEGER with a valid range of 1 through 10. A value of 1 builds one histogram; a value of 2 builds two histograms, etc.

The rationale for building more than one histogram is based on the assumption that a data sample read from the replacement block is more closely related to a localized histogram than to one large histogram.

The user should ensure that each histogram contains a sufficient number of data samples to accurately represent the region of the image. For example, it is better to have one histogram containing 100 data samples rather than ten histograms each containing 10 data samples.

Examples:

  1. LAS> fixlin in="in.dat","replace.dat" out=out.dat inwind1=(250,25,100,10) nhist=2

    The user requests to replace a bad data block of the image IN.DAT with a data block contained in REPLACE.DAT. The resulting image is OUT.DAT with the same data type as IN.DAT. The output image contains the same image data as IN.DAT with the portion of bad image data (IN.DAT) being replaced by the same block contained in REPLACE.DAT because SUWIND1 is not defined. The block that is replaced has a starting line of 250, starting sample of 25, number of lines of 100, and number of samples of 10. The parameter NHIST is set to 2 indicating that the proximity histogram of IN.DAT and the replacement histogram of REPLACE.DAT are each split up into two subhistograms. The first set of subhistograms fixes the portion of the bad data with a starting line of 250, starting sample of 25, number of lines of 100, and number of samples of 5. The second set of subhistograms fixes the remaining portion of bad image data with a starting line of 250, starting sample of 30, number of lines of 100, and number of samples of 5.

  2. LAS> fixlin in(1)="in.dat(:3)" in(2)="replace.dat" out=out.dat inwind1=(20,25,10,15) suwind1=(148,153)

    The user requests to replace a bad data block of the image IN.DAT with a data block contained in REPLACE.DAT. The resulting image is OUT.DAT which has the same data type as the image in IN.DAT. The output image contains the same image data as IN.DAT except for the block defined with a starting line of 20, starting sample of 25, number of lines of 10, and number of samples of 15. It is replaced by the same block size in REPLACE.DAT, starting at line 148 and sample 153. NHIST is not specified; therefore, the proximity histogram of IN.DAT and the replacement histogram of REPLACE.DAT are each split up into one subhistogram.

  3. LAS> fixlin in="in.dat (25,30,50,50)","replace.dat" out=out.dat inwind1=(30,60,40,3)

    The user requests to replace a bad data block of the image IN.DAT with the same data block contained in REPLACE.DAT (same block because SUWIND1 is not defined). The window option for parameter IN(1) is used; therefore, the resulting output image, OUT.DAT, is a 50 x 50 image of the same data type as IN.DAT. The block to be replaced has a starting line of 30, starting sample of 60, number of lines of 40, and number of samples of 3 within the original image IN.DAT. NHIST is not specified; therefore, the proximity histogram of IN(1) and the replacement histogram of IN(2) will each be split up into one subhistogram.

             NOTE:  Since the output image is 50 x 50, the lines 
                    replaced within it have a starting line of 6 and
                    a starting sample of 31.  The user must be sure 
                    that the block to be replaced is within the win-
                    dow specification.
    

  4. LAS> fixlin in(1)=in.dat in(2)=replace.dat out=out.dat inwind1=(30,60,40,3) inwind2(105,5,100,10) suwind1=(180,182) suwind2(255,127) nhist=(1,3)

    The user requests to replace two bad blocks within the image IN.DAT with two blocks from the image REPLACE.DAT. The output image, OUT.DAT, consists of the same image as IN.DAT except that the two blocks defined are replaced. The first block to be replaced has a starting line of 30, starting sample of 60, number of lines of 40, and number of samples of 3. It is replaced by a block of the same size from REPLACE.DAT with a starting line of 180 and starting sample of 182. For this block, the parameter NHIST is set to 1 indicating that the proximity histogram of IN(1) and replacement histogram of IN(2) are each split up into one subhistogram.

    The second block to be replaced has a starting line of 105, starting sample of 5, number of lines of 100, and number of samples of 10. It is replaced by a block of the same size from REPLACE.DAT with a starting line of 255 and starting sample of 127. For this block the parameter NHIST is set to 3 indicating that the proximity histogram of IN(1) and replacement histogram of IN(2) are each split up into three subhistograms.

Description/Algorithm:

After reading the input parameters, FIXLIN sorts the window specifications so that the bad image blocks are in ascending order.

For each block area to be replaced, the following steps are taken. FIXLIN reads the lines of input image data and outputs the pixel values directly to the output image file until the block of bad data is reached. It then computes the subhistograms of the proximity of the bad image data of IN(1) and the replacement block and its proximity of IN(2). (Note: If the data within the proximity is bad, the resulting histogram will be incorrect.) The area above and below INWIND(x) is equal to the number of lines being replaced. For example, if ten lines are being replaced, the histogram includes ten lines above and ten lines below the bad data block and the replacement histogram of IN(2) includes ten lines above, ten lines below, and the ten lines of the replacement block defined by SUWIND(x). If the bad block is on the edge of the image and not all of these lines are defined, the histogram includes only those lines that are defined. The subhistogram for the replacement block of IN(2) is transformed by a multistretch to be equivalent to the subhistogram in the proximity of the bad image lines of IN(1). The pixel values for the replacement block are read and transformed into pixel values that correspond with the histogram of the input image. The transformed pixel values are written to the output image file.

Once the last block of bad data has been replaced, FIXLIN reads lines of image data and outputs the pixel values directly to the output image file until the end of the input image file is reached.

When the replacement pixel values are transformed to the same brightness values of the input image, their values are contrast enhanced; whereas, the rest of the image contains its original values. Therefore, the replaced values are not exactly the same as the original pixel values would have been.

If images IN(1) and IN(2) are of different data types, the output image has the same data type as IN(1), which is the image being fixed. Image IN(2) is read into the program as having the same data type as IN(1). Data samples within image IN(2) lose significant digits when IN(2) has a higher data type than IN(1). The processing is the same as if the two images are of the same data type.

Nonfatal Error Messages:

  1. [fixlin-history] History not created

    An error was encountered during the creation of the history file. The image data is probably valid.

  2. [fixlin-minmax] Error creating minmax file

    The minmax file could not be created. The image data is probably valid.

  3. [fixlin-novalue] Value is not found in look-up table

    A value of the replacement block is not contained within the look-up table of transformed pixel values. The pixel within the fixed block will have a value of the pixel before it. This error can only occur with INTEGER*4 data that contains more than 16384 different values or REAL*4 data.

Fatal Error Messages:

  1. [fixlin-badwin] Window specification error in <XXXXXX>

    The block defined by <XXXXXX> lies outside of the image. Please redefine the <XXXXXX> parameter.

  2. [fixlin-band] Too many bands specified in the input image(s)

    Only one band can be specified in the input image. Use the band option to specify only one input band.

  3. [fixlin-blocks] INWIND(x) and SUWIND(x) are not equal

    The number of blocks represented by INWIND(x) and SUWIND(x) have to be the same. SUWIND(x) can be null so that SUWIND(x) defaults to the values of INWIND(x).

  4. [fixlin-fatal] Fatal error encountered

    A fatal error was encountered during processing. The output image file is not deleted, and processing is terminated. The message that is displayed immediately preceding this error message is the specific error that was encountered.

  5. [fixlin-open] Cannot open <XXXXXX> image file

    The <XXXXXX> image file could not be opened and processing is terminated. Verify that the image named in the <XXXXXX> parameter exists.

  6. [fixlin-overlap] Blocks defined by INWIND(x) overlap

    Two different blocks specified by INWIND(x) cannot have overlaping lines. Please respecify the INWIND(x) parameter.

User Notes:

  1. Two blocks of bad image data cannot have the same line range because the program FIXLIN replaces one bad block at a time. When a bad block of image data is replaced, it is replaced line by line, processing the whole image line. Therefore, if two blocks of bad image data have the same line range, the first block would get replaced and the second block would be skipped because the common lines of image data would have already been written to the output image when the first block was replaced. If an image has two blocks of bad data within the same line range, FIXLIN will have to be run twice, once for each bad block.