Replace blocks of bad image data
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.)
- 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.
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.
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.
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.
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.
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.
An error was encountered during the creation of the history file. The image data is probably valid.
The minmax file could not be created. The image data is probably valid.
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.
The block defined by <XXXXXX> lies outside of the image. Please redefine the <XXXXXX> parameter.
Only one band can be specified in the input image. Use the band option to specify only one input band.
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).
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.
The <XXXXXX> image file could not be opened and processing is terminated. Verify that the image named in the <XXXXXX> parameter exists.
Two different blocks specified by INWIND(x) cannot have overlaping lines. Please respecify the INWIND(x) parameter.