Hubble Space Telescope NICMOS images often show quadrants with a slight mismatch in DC offset levels after the calibration process. The cause of these residual offsets is still not fully understood, but the images can be empirically fixed by adding arbitrary DC constants to three arbitrarily chosen quadrants in order to bring them to the same DC level of the fourth, ``reference'' quadrant.
Thus the basic problem in fixing these images is to find the set of three numerical constants that will ``fix'' the image. But the definition of what is a ``fixed'' image is arbitrary, and a number of solutions have been proposed. They are all based on some sort of background estimation in each quadrant, using fits to the background histogram, medians, modes, etc. The problem with these procedures is that they are sensitive to image structure and content, and particularly to low-frequency background gradients. And no matter what the procedure is, the quality of the final solution must be evaluated by eye.
The procedure described here avoids the dependency on human observers, as well as decreases the sensitivity on image content and gradients, typical of other methods. It works by directly building, with an objective criterion, the solution that mostly pleases the human eye. When looking into an image with quadrant DC offsets, the visual system is mostly responsive to the edges between quadrants. The visual system is actually very sensitive to the amount of Fourier power in the highest spatial frequencies associated with the edges. Thus, the eye will pick up as the best among several ``fixed'' images, the one that has the minimum Fourier power at the quadrant edges.
Based on that idea, a simple algorithm can be implemented that minimizes the Fourier power in the highest frequencies at the quadrant edges, as a function of the three sought DC offsets. Since the algorithm is based only on information of local nature, it can be very robust against large-scale image structure and background gradients. Since only the few pixels along the (internal) quadrant edges must be examined, the algorithm can be potentially very fast as well.
The algorithm basically builds an estimate of the high-frequency Fourier power along the edges between quadrants, and uses a minimization code to get the best set of DC offsets that minimize that power.
The Fourier power is proportional to the squared differences between intensities extracted at each side of an edge. Intensities are extracted from within a band with given width. The exact position where the edge sits (128) is ignored. For the vertical edge, at a single image line, pixels sitting at the left side of the edge, within the band, are averaged into a1. Pixels sitting at the right side are averaged into a2. The Fourier power contribution from that image line is just (a1 - a2)2. Contributions from all 256 image lines along the vertical edge are added together. The same procedure is applied to the horizontal edge, resulting in a single scalar quantity that estimates the global Fourier power along the edges. The exact Fourier frequency which is measured is a function of the band size. A very narrow band will include power from the highest frequencies only, but the resulting power measure will be more sensitive to noise. Good results were attained with band widths of 3-5 pixels to each side of the edge.
The implemented algorithm also looks for the data quality information from each pixel and can exclude pixels with selected anomalies. It can also exclude pixels above a certain threshold, and can exclude the largest differences when computing the power estimator.
The algorithm then uses the ``amoeba'' (downhill simplex) minimization method to search for the set of DC offsets that minimize the power estimator. The upper-left quadrant is used as a reference, and the three others are varied until the method converges.
The algorithm, which depends only on a minimal set of parameters, was implemented as a C function that can be easily included into other software. This C function was used as the core of an IRAF task that automatically removes the quadrant DC offsets of any number of NICMOS files.