net.grelf.grip
Class ImProcess

java.lang.Object
  extended by net.grelf.grip.ImProcess

public class ImProcess
extends java.lang.Object

This class contains only static methods for processing images. It cannot be instantiated.


Field Summary
static boolean batchCropping
          Controls whether the user will be prompted to confirm the crop rectangle.
 
Method Summary
static void add(java.awt.image.BufferedImage bim1, java.awt.image.BufferedImage bim2)
          Add bim2 into bim1, pixel by pixel
static void add(java.awt.image.BufferedImage bim1, java.awt.image.BufferedImage bim2, double f1, double f2)
          Add bim2 into bim1, pixel by pixel, taking fraction f1 of image 1 and fraction f2 of image 2.
static void add(ImFrame imf1, ImFrame imf2)
          Add imf2 into imf1, pixel by pixel
static void add(ImFrame imf1, ImFrame imf2, double f1, double f2)
          Add imf2 into imf1, pixel by pixel, taking fraction f1 of image 1 and fraction f2 of image 2.
static java.awt.image.BufferedImage autoCrop(java.awt.image.BufferedImage srcBim)
          Automatically remove any rectangular margin of black (0, 0, 0) pixels from the image, thereby cropping it.
static void autoCrop(ImFrame imf)
          Automatically remove any rectangular margin of black (0, 0, 0) pixels from the image, thereby cropping it.
static void autoStretch(java.awt.image.BufferedImage bim, boolean allChannelsSame)
          Stretch the contrast in the image so the full range of levels is used.
static void autoStretch(java.awt.image.BufferedImage bim, boolean allChannelsSame, java.awt.Point topLeft, java.awt.Point bottomRight)
          Stretch the contrast in the image so the full range of levels is used.
static void autoStretch(ImFrame imf)
          Stretch the contrast in the image so the full range of levels is used.
static byte[][] autoThreshold(java.awt.image.BufferedImage bim)
          Threshold automatically.
static byte[][] autoThreshold(ImFrame imf)
          Threshold automatically.
static boolean averageShift(java.awt.image.BufferedImage bim, int imNo, int middleImNo, java.util.List<MatchPair> matches, BlobMeas[][] lookup, int nBrightest)
          For image imNo of a sequence, shift the image so that matched point pairs are at the same position as in middleImNo.
static void averageVertically(java.awt.image.BufferedImage bim)
          Replace every pixel of every vertical line in the image by the average of the levels along the line.
static void averageVertically(java.awt.image.BufferedImage bim, int yMin, int yMax)
          Replace every pixel of every vertical line in the image by the average of the levels along the line, within two y coordinate limits.
static void averageVertically(ImFrame imf)
          Replace every pixel of every vertical line in the image by the average levels along the line.
static java.awt.image.BufferedImage convertTo16BitsPerChannel(java.awt.image.BufferedImage srcBim)
          Convert the image to 16 bits per channel (only useful if the image was 8 bits per channel).
static void convertTo16BitsPerChannel(ImFrame imf)
          Convert the image or accumulator to 16 bits per channel.
static void convertTo32BitsPerChannel(ImFrame imf)
          Convert the image to 32 bits per channel (only useful if the image was 16 bits per channel).
static java.awt.image.BufferedImage convertTo8BitsPerChannel(java.awt.image.BufferedImage srcBim)
          Convert the image to 8 bits per channel (only useful if the image was 16 bits per channel).
static void convertTo8BitsPerChannel(ImFrame imf)
          Convert the image to 8 bits per channel (only useful if the image was 16 bits per channel).
static void convertToMonochrome(java.awt.image.BufferedImage bim)
          Convert the image to monochrome, using 0.325 x red + 0.5 * green + 0.175 * blue.
static void convertToMonochrome(java.awt.image.BufferedImage bim, double... f)
          Convert the image to monochrome, using given fractions of each channel.
static void convertToMonochrome(ImFrame imf)
          Convert the RGB image to monochrome, using 0.325 x red + 0.5 * green + 0.175 * blue.
static void convertToMonochrome(ImFrame imf, double... f)
          Convert the multi-channel image to monochrome, using the factors f to determine ratios of channels.
static void correctBackground(java.awt.image.BufferedImage im)
          Level the background of the image by dividing the image into n x n cells and using the modal values of the histogram in every cell.
static void correctBackground(ImFrame imf)
          Level the background of the image by dividing the image into n x n cells and using the modal values of the histogram in every cell.
static java.awt.image.BufferedImage crop(java.awt.Point pt1, java.awt.Point pt2, java.awt.image.BufferedImage srcBim)
          Crop the image by a rectangle defined by the diagonally opposite points.
static void crop(java.awt.Point pt1, java.awt.Point pt2, ImFrame imf)
          Crop the image by a drawn rectangle.
static void crop(java.awt.Point pt1, java.awt.Point pt2, ImFrame imf, boolean promptToConfirm)
          Crop the image by a drawn rectangle and adjust any BlobMeasList it may have.
static void divideAmplitudeByN(java.awt.image.BufferedImage bim, int n)
          Divide the value of every pixel by n
static void divideAmplitudeByN(ImFrame imf, int n)
          Divide the value of every pixel by n
static void divideByFlatField(java.awt.image.BufferedImage bim1, java.awt.image.BufferedImage bim2)
          Divide bim1 by flat field bim2, pixel by pixel.
static void divideByFlatField(ImFrame imf1, ImFrame imf2)
          Divide image in imf1 by flat field in imf2, pixel by pixel
static void doOpInBackground(java.lang.String op, ImFrame frame)
          For particularly long operations, run them on a worker thread rather than clog up swing's event dispatch thread.
static java.awt.image.BufferedImage fit(java.awt.image.BufferedImage srcBim, int width, int height)
          Scale the image so it fits into the given width and height (in pixels), without changing its proportions.
static void fit(ImFrame imf, int width, int height)
          Scale the image so it fits into the given width and height (in pixels), without changing its proportions.
static void flipHorizontal(java.awt.image.BufferedImage bim)
          Flip the image horizontally.
static void flipHorizontal(ImFrame imf)
          Flip the image horizontally.
static void flipVertical(java.awt.image.BufferedImage bim)
          Flip the image vertically.
static void flipVertical(ImFrame imf)
          Flip the image vertically.
static javax.swing.ProgressMonitor getMonitor()
          For developers to be able to setProgress () and test isCanceled () periodically and then close () when done.
static void invert(java.awt.image.BufferedImage im)
          Invert the colour at every pixel in the image.
static void invert(ImFrame imf)
          Invert the colour at every pixel in the image.
static java.awt.image.BufferedImage meanFilter(java.awt.image.BufferedImage srcBim, int halfWidth)
          Replace every pixel in the image by the mean value of its n x n neighbourhood, where n = 2.halfWidth + 1.
static void meanFilter(ImFrame imf)
          Ask for neighbourhood size and replace every pixel in the image by the mean value of its neighbourhood.
static java.awt.image.BufferedImage medianFilter(java.awt.image.BufferedImage srcBim, int halfWidth)
          Replace every pixel in the image by the median value of its n x n neighbourhood, where n = 2.halfWidth + 1.
static void medianFilter(ImFrame imf)
          Ask for neighbourhood size and replace every pixel in the image by the median value of its neighbourhood.
static void multiply(java.awt.image.BufferedImage bim1, java.awt.image.BufferedImage bim2)
          Multiply bim2 into bim1, pixel by pixel
static void multiply(ImFrame imf1, ImFrame imf2)
          Multiply imf2 into imf1, pixel by pixel
static java.awt.image.BufferedImage nearestExtremeFilter(java.awt.image.BufferedImage srcBim, int halfWidth)
          Replace every pixel in the image by the nearest of the max and min of its n x n neighbourhood, where n = 2.halfWidth + 1.
static void nearestExtremeFilter(ImFrame imf)
          Ask for neighbourhood size and replace every pixel in the image by the nearest of the max and min of its neighbourhood.
static void neutraliseBackground(java.awt.image.BufferedImage bim)
          Automatically adjust colour balance by equating the modes of all channels.
static void neutraliseBackground(ImFrame imf)
          Automatically adjust colour balance by equating the modes of all channels.
static java.awt.image.BufferedImage rankFilter(java.awt.image.BufferedImage srcBim, int halfWidth)
          Replace every pixel in the image by its rank in its n x n neighbourhood, where n = 2.halfWidth + 1.
static void rankFilter(ImFrame imf)
          Replace every pixel in the image by its rank in its n x n neighbourhood, where n = 2.halfWidth + 1.
static java.awt.image.BufferedImage rotate(java.awt.image.BufferedImage srcBim, double angle)
          Rotate the image anticlockwise by the given angle (in degrees).
static void rotate(ImFrame imf)
          Ask the user for an angle (in degrees), then rotate the image anticlockwise by that angle.
static void rotate(ImFrame imf, double angle)
          Rotate the image anticlockwise by the given angle (in degrees).
static java.awt.image.BufferedImage scale(java.awt.image.BufferedImage srcBim, double factor, boolean interpolating)
          Scale the image by the given factor
static void scale(ImFrame imf)
          Ask the user for a factor, then scale the image by that factor.
static void scale(ImFrame imf, double factor, boolean interpolating)
          Scale the image by the given factor
static void splitChannels(ImFrame imf)
          Create 3 new images, one containing each of the channels of the original image, displaying them as new ImFrames.
static void splitIntensity(ImFrame imf)
          Create a monochrome image in which each pixel has the value I = sum of the band levels of the current image plus a colour image in which the pixel in each band has the value maxLevel * bandLevel / I.
static void stereo(java.awt.image.BufferedImage bim1, java.awt.image.BufferedImage bim2)
          Replace bim1 by the red - green stereo version of the 2 images.
static void stereo(ImFrame imf1, ImFrame imf2)
          Use imf1 to display in red - green stereo the two images from imf1 and imf2.
static void stretch(java.awt.image.BufferedImage im, int[] minima, int[] maxima)
          Stretch the contrast in the image between limits given for each channel.
static void stretch(ImFrame imf, int[] minima, int[] maxima)
          Stretch the contrast in the image between limits given for each channel.
static void sub(java.awt.image.BufferedImage bim1, java.awt.image.BufferedImage bim2)
          Subtract bim2 from bim1, pixel by pixel, the result being about the half-way brightness level so that both negative and positive results can be seen.
static void sub(ImFrame imf1, ImFrame imf2)
          Subtract imf2 from imf1, pixel by pixel, the result being about the half-way brightness level so that both negative and positive results can be seen.
static void subToZero(java.awt.image.BufferedImage bim1, java.awt.image.BufferedImage bim2)
          Subtract bim2 from bim1, pixel by pixel, keeping only positive results, base level 0.
static void subToZero(ImFrame imf1, ImFrame imf2)
          Subtract imf2 from imf1, pixel by pixel, keeping only positive results, base level 0.
static byte[][] threshold(java.awt.image.BufferedImage bim, Threshold thresh)
          Threshold the image to detect pixels in the range(s) specified by the given threshold.
static Threshold threshold(ImFrame imf)
          Display dialogue for user to set thresholds (RGB or monochrome), then threshold the image.
9.11.26: changed to return the Threshold that was set (previously returned void).
static void threshold(ImFrame imf, Threshold thresh)
          Threshold the image to detect pixels brighter than the given thresholds.
static java.awt.image.BufferedImage translate(java.awt.image.BufferedImage srcBim, double dx, double dy)
          Displace the image content by the given offset vector.
static java.awt.image.BufferedImage translate(java.awt.image.BufferedImage srcBim, int dx, int dy)
          Displace the image content by the given offset vector.
static void translate(ImFrame imf)
          Ask the user for x and y displacements and then translate the image accordingly.
static void translate(ImFrame imf, int dx, int dy)
          Displace the image within its frame by the given offset vector.
static java.awt.image.BufferedImage varianceFilter(java.awt.image.BufferedImage srcBim, int halfWidth)
          Replace every pixel in the image by the variance of its n x n neighbourhood, where n = 2.halfWidth + 1.
static void varianceFilter(ImFrame imf)
          Ask for neighbourhood size and replace every pixel in the image by the variance of its neighbourhood.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

batchCropping

public static boolean batchCropping
Controls whether the user will be prompted to confirm the crop rectangle.

Method Detail

add

public static void add(ImFrame imf1,
                       ImFrame imf2)
Add imf2 into imf1, pixel by pixel


add

public static void add(java.awt.image.BufferedImage bim1,
                       java.awt.image.BufferedImage bim2)
Add bim2 into bim1, pixel by pixel


add

public static void add(ImFrame imf1,
                       ImFrame imf2,
                       double f1,
                       double f2)
Add imf2 into imf1, pixel by pixel, taking fraction f1 of image 1 and fraction f2 of image 2. It is assumed that f1 + f2 = 1.0, otherwise overflow will occur.


add

public static void add(java.awt.image.BufferedImage bim1,
                       java.awt.image.BufferedImage bim2,
                       double f1,
                       double f2)
Add bim2 into bim1, pixel by pixel, taking fraction f1 of image 1 and fraction f2 of image 2. It is assumed that f1 + f2 = 1.0, otherwise overflow will occur.


neutraliseBackground

public static void neutraliseBackground(ImFrame imf)
Automatically adjust colour balance by equating the modes of all channels. Done by scaling levels so that channels with higher modal values go down to the same as the one with the lowest mode. The maximum level in each channel is unchanged so the colours of bright objects are unchanged. Intended for night sky images, to make the sky background colourless (grey). Any pixels that would scale to below zero are clipped at zero.


neutraliseBackground

public static void neutraliseBackground(java.awt.image.BufferedImage bim)
Automatically adjust colour balance by equating the modes of all channels. Done by scaling levels so that channels with higher modal values go down to the same as the one with the lowest mode. The maximum level in each channel is unchanged so the colours of bright objects are unchanged. Intended for night sky images, to make the sky background colourless (grey). Any pixels that would scale to below zero are clipped at zero. Nov 09: Supercedes autoBalance () which shifts up to the highest mode rather than scaling down.


autoCrop

public static void autoCrop(ImFrame imf)
Automatically remove any rectangular margin of black (0, 0, 0) pixels from the image, thereby cropping it.


autoCrop

public static java.awt.image.BufferedImage autoCrop(java.awt.image.BufferedImage srcBim)
Automatically remove any rectangular margin of black (0, 0, 0) pixels from the image, thereby cropping it.


autoStretch

public static void autoStretch(ImFrame imf)
Stretch the contrast in the image so the full range of levels is used. Ask the user whether all channels are to be stretched by the same factor and offset.


autoStretch

public static void autoStretch(java.awt.image.BufferedImage bim,
                               boolean allChannelsSame)
Stretch the contrast in the image so the full range of levels is used.


autoStretch

public static void autoStretch(java.awt.image.BufferedImage bim,
                               boolean allChannelsSame,
                               java.awt.Point topLeft,
                               java.awt.Point bottomRight)
Stretch the contrast in the image so the full range of levels is used. This version only changes pixels in the rectangle defined by the two points as diagonal.


autoThreshold

public static byte[][] autoThreshold(ImFrame imf)
Threshold automatically. First gets a histogram and finds the channel means. Sets the threshold for each channel: if the mean is lower than half-way up the brightness range the background is assumed to be dark so the threshold goes from half-way up to the top. Otherwise the background is assumed to be bright so the threshold goes from 0 to half-way. Then does the thresholding to set a mask in the GlassPane, suitable for blob detection.
Not for segmenting stars: use StarSegmenter class instead.


autoThreshold

public static byte[][] autoThreshold(java.awt.image.BufferedImage bim)
Threshold automatically. First gets a histogram and finds the channel means. Sets the threshold for each channel: if the mean is lower than half-way up the brightness range the background is assumed to be dark so the threshold goes from half-way up to the top. Otherwise the background is assumed to be bright so the threshold goes from 0 to half-way. Then does the thresholding to set a mask in the GlassPane, suitable for blob detection.
Not for segmenting stars: use StarSegmenter class instead.


averageShift

public static boolean averageShift(java.awt.image.BufferedImage bim,
                                   int imNo,
                                   int middleImNo,
                                   java.util.List<MatchPair> matches,
                                   BlobMeas[][] lookup,
                                   int nBrightest)
For image imNo of a sequence, shift the image so that matched point pairs are at the same position as in middleImNo. Use the average translation vector from all matched objects.


averageVertically

public static void averageVertically(ImFrame imf)
Replace every pixel of every vertical line in the image by the average levels along the line. This is for analysing profiles (particularly for spectroscopy). First rotate and crop the image appropriately.


averageVertically

public static void averageVertically(java.awt.image.BufferedImage bim)
Replace every pixel of every vertical line in the image by the average of the levels along the line. This is for analysing profiles (particularly for spectroscopy). Rotate and crop the image appropriately before using this.


averageVertically

public static void averageVertically(java.awt.image.BufferedImage bim,
                                     int yMin,
                                     int yMax)
Replace every pixel of every vertical line in the image by the average of the levels along the line, within two y coordinate limits. This is for analysing profiles (particularly for spectroscopy). Rotate and crop the image appropriately before using this.


convertTo16BitsPerChannel

public static void convertTo16BitsPerChannel(ImFrame imf)
Convert the image or accumulator to 16 bits per channel.


convertTo16BitsPerChannel

public static java.awt.image.BufferedImage convertTo16BitsPerChannel(java.awt.image.BufferedImage srcBim)
Convert the image to 16 bits per channel (only useful if the image was 8 bits per channel).


convertTo32BitsPerChannel

public static void convertTo32BitsPerChannel(ImFrame imf)
Convert the image to 32 bits per channel (only useful if the image was 16 bits per channel).


convertTo8BitsPerChannel

public static void convertTo8BitsPerChannel(ImFrame imf)
Convert the image to 8 bits per channel (only useful if the image was 16 bits per channel).


convertTo8BitsPerChannel

public static java.awt.image.BufferedImage convertTo8BitsPerChannel(java.awt.image.BufferedImage srcBim)
Convert the image to 8 bits per channel (only useful if the image was 16 bits per channel).


convertToMonochrome

public static void convertToMonochrome(ImFrame imf)
Convert the RGB image to monochrome, using 0.325 x red + 0.5 * green + 0.175 * blue.


convertToMonochrome

public static void convertToMonochrome(ImFrame imf,
                                       double... f)
Convert the multi-channel image to monochrome, using the factors f to determine ratios of channels.


convertToMonochrome

public static void convertToMonochrome(java.awt.image.BufferedImage bim)
Convert the image to monochrome, using 0.325 x red + 0.5 * green + 0.175 * blue.


convertToMonochrome

public static void convertToMonochrome(java.awt.image.BufferedImage bim,
                                       double... f)
Convert the image to monochrome, using given fractions of each channel. The fractions need not add up to 1.0 because the result is scaled. The number of fractions supplied must equal to the initial number of channels in the image, otherwise the user sees an error message.


correctBackground

public static void correctBackground(ImFrame imf)
Level the background of the image by dividing the image into n x n cells and using the modal values of the histogram in every cell. n is set in the Config.


correctBackground

public static void correctBackground(java.awt.image.BufferedImage im)
Level the background of the image by dividing the image into n x n cells and using the modal values of the histogram in every cell. n is set in the Config.


crop

public static void crop(java.awt.Point pt1,
                        java.awt.Point pt2,
                        ImFrame imf)
Crop the image by a drawn rectangle. Convenience version which simply calls crop (pt1, pt2, imf, true).


crop

public static void crop(java.awt.Point pt1,
                        java.awt.Point pt2,
                        ImFrame imf,
                        boolean promptToConfirm)
Crop the image by a drawn rectangle and adjust any BlobMeasList it may have.


crop

public static java.awt.image.BufferedImage crop(java.awt.Point pt1,
                                                java.awt.Point pt2,
                                                java.awt.image.BufferedImage srcBim)
Crop the image by a rectangle defined by the diagonally opposite points. Does not assume pt1 is above or to the left of pt2.


divideAmplitudeByN

public static void divideAmplitudeByN(ImFrame imf,
                                      int n)
Divide the value of every pixel by n


divideAmplitudeByN

public static void divideAmplitudeByN(java.awt.image.BufferedImage bim,
                                      int n)
Divide the value of every pixel by n


divideByFlatField

public static void divideByFlatField(ImFrame imf1,
                                     ImFrame imf2)
Divide image in imf1 by flat field in imf2, pixel by pixel


divideByFlatField

public static void divideByFlatField(java.awt.image.BufferedImage bim1,
                                     java.awt.image.BufferedImage bim2)
Divide bim1 by flat field bim2, pixel by pixel. The number of bits per channel in the two images need not necessarily be the same.


fit

public static void fit(ImFrame imf,
                       int width,
                       int height)
Scale the image so it fits into the given width and height (in pixels), without changing its proportions.


fit

public static java.awt.image.BufferedImage fit(java.awt.image.BufferedImage srcBim,
                                               int width,
                                               int height)
Scale the image so it fits into the given width and height (in pixels), without changing its proportions.


flipHorizontal

public static void flipHorizontal(ImFrame imf)
Flip the image horizontally.


flipHorizontal

public static void flipHorizontal(java.awt.image.BufferedImage bim)
Flip the image horizontally.


flipVertical

public static void flipVertical(ImFrame imf)
Flip the image vertically.


flipVertical

public static void flipVertical(java.awt.image.BufferedImage bim)
Flip the image vertically.


invert

public static void invert(ImFrame imf)
Invert the colour at every pixel in the image.


invert

public static void invert(java.awt.image.BufferedImage im)
Invert the colour at every pixel in the image.


meanFilter

public static void meanFilter(ImFrame imf)
Ask for neighbourhood size and replace every pixel in the image by the mean value of its neighbourhood.


meanFilter

public static java.awt.image.BufferedImage meanFilter(java.awt.image.BufferedImage srcBim,
                                                      int halfWidth)
Replace every pixel in the image by the mean value of its n x n neighbourhood, where n = 2.halfWidth + 1.


medianFilter

public static void medianFilter(ImFrame imf)
Ask for neighbourhood size and replace every pixel in the image by the median value of its neighbourhood.


medianFilter

public static java.awt.image.BufferedImage medianFilter(java.awt.image.BufferedImage srcBim,
                                                        int halfWidth)
Replace every pixel in the image by the median value of its n x n neighbourhood, where n = 2.halfWidth + 1.


multiply

public static void multiply(ImFrame imf1,
                            ImFrame imf2)
Multiply imf2 into imf1, pixel by pixel


multiply

public static void multiply(java.awt.image.BufferedImage bim1,
                            java.awt.image.BufferedImage bim2)
Multiply bim2 into bim1, pixel by pixel


nearestExtremeFilter

public static void nearestExtremeFilter(ImFrame imf)
Ask for neighbourhood size and replace every pixel in the image by the nearest of the max and min of its neighbourhood.


nearestExtremeFilter

public static java.awt.image.BufferedImage nearestExtremeFilter(java.awt.image.BufferedImage srcBim,
                                                                int halfWidth)
Replace every pixel in the image by the nearest of the max and min of its n x n neighbourhood, where n = 2.halfWidth + 1.


rankFilter

public static void rankFilter(ImFrame imf)
Replace every pixel in the image by its rank in its n x n neighbourhood, where n = 2.halfWidth + 1. The rank is scaled up so that its possible values span the grey level range of the image. Each channel is treated independently.


rankFilter

public static java.awt.image.BufferedImage rankFilter(java.awt.image.BufferedImage srcBim,
                                                      int halfWidth)
Replace every pixel in the image by its rank in its n x n neighbourhood, where n = 2.halfWidth + 1. The rank is scaled up so that its possible values span the grey level range of the image. Each channel is treated independently.


rotate

public static void rotate(ImFrame imf)
Ask the user for an angle (in degrees), then rotate the image anticlockwise by that angle.


rotate

public static void rotate(ImFrame imf,
                          double angle)
Rotate the image anticlockwise by the given angle (in degrees).


rotate

public static java.awt.image.BufferedImage rotate(java.awt.image.BufferedImage srcBim,
                                                  double angle)
Rotate the image anticlockwise by the given angle (in degrees).


scale

public static void scale(ImFrame imf)
Ask the user for a factor, then scale the image by that factor.


scale

public static void scale(ImFrame imf,
                         double factor,
                         boolean interpolating)
Scale the image by the given factor


scale

public static java.awt.image.BufferedImage scale(java.awt.image.BufferedImage srcBim,
                                                 double factor,
                                                 boolean interpolating)
Scale the image by the given factor


splitChannels

public static void splitChannels(ImFrame imf)
Create 3 new images, one containing each of the channels of the original image, displaying them as new ImFrames.


splitIntensity

public static void splitIntensity(ImFrame imf)
Create a monochrome image in which each pixel has the value I = sum of the band levels of the current image plus a colour image in which the pixel in each band has the value maxLevel * bandLevel / I. This enables GRIP to implement the colour preservation scheme described at http://www.allthesky.com/articles/colorpreserve.html


stereo

public static void stereo(ImFrame imf1,
                          ImFrame imf2)
Use imf1 to display in red - green stereo the two images from imf1 and imf2. Both images must have the same size, bit-depth and number of channels. They must be 8 bits per channel and either 3-channel (RGB) or 1-channel (monochrome).


stereo

public static void stereo(java.awt.image.BufferedImage bim1,
                          java.awt.image.BufferedImage bim2)
Replace bim1 by the red - green stereo version of the 2 images. If the original images are RGB each pixel is first converted to monochrome, using 0.325 x red + 0.5 * green + 0.175 * blue, but the result is still a 3-channel RGB image. If bim1 was originally monochrome it is changed to become RGB.


stretch

public static void stretch(ImFrame imf,
                           int[] minima,
                           int[] maxima)
Stretch the contrast in the image between limits given for each channel.


stretch

public static void stretch(java.awt.image.BufferedImage im,
                           int[] minima,
                           int[] maxima)
Stretch the contrast in the image between limits given for each channel.


sub

public static void sub(ImFrame imf1,
                       ImFrame imf2)
Subtract imf2 from imf1, pixel by pixel, the result being about the half-way brightness level so that both negative and positive results can be seen.


sub

public static void sub(java.awt.image.BufferedImage bim1,
                       java.awt.image.BufferedImage bim2)
Subtract bim2 from bim1, pixel by pixel, the result being about the half-way brightness level so that both negative and positive results can be seen.


subToZero

public static void subToZero(ImFrame imf1,
                             ImFrame imf2)
Subtract imf2 from imf1, pixel by pixel, keeping only positive results, base level 0.


subToZero

public static void subToZero(java.awt.image.BufferedImage bim1,
                             java.awt.image.BufferedImage bim2)
Subtract bim2 from bim1, pixel by pixel, keeping only positive results, base level 0.


threshold

public static Threshold threshold(ImFrame imf)
Display dialogue for user to set thresholds (RGB or monochrome), then threshold the image.
9.11.26: changed to return the Threshold that was set (previously returned void).


threshold

public static void threshold(ImFrame imf,
                             Threshold thresh)
Threshold the image to detect pixels brighter than the given thresholds. The image may have any number of bands.


threshold

public static byte[][] threshold(java.awt.image.BufferedImage bim,
                                 Threshold thresh)
Threshold the image to detect pixels in the range(s) specified by the given threshold. Return a binary mask (values BlobMask.MASK_CLEAR or BlobMask.MASK_SET), suitable for setting into GlassPane. The image may have any number of bands.


translate

public static void translate(ImFrame imf)
Ask the user for x and y displacements and then translate the image accordingly. Shifting an image by a very small amount and then subtracting it from itself (eg, as previously cloned from the image menu) is a way of detecting edges in the direction of the offset.


translate

public static void translate(ImFrame imf,
                             int dx,
                             int dy)
Displace the image within its frame by the given offset vector. Image size is unchanged. Margins exposed by the shift are filled with zeroes. Portions of the image shifted off the edge are lost. Shifting an image by a very small amount and then subtracting it from itself (eg, as previously cloned from the image menu) is a way of detecting edges in the direction of the offset.


translate

public static java.awt.image.BufferedImage translate(java.awt.image.BufferedImage srcBim,
                                                     int dx,
                                                     int dy)
Displace the image content by the given offset vector. Image size is unchanged. Margins exposed by the shift are filled with zeroes. Portions of the image shifted off the edge are lost. Shifting an image by a very small amount and then subtracting it from itself (eg, as previously cloned from the image menu) is a way of detecting edges in the direction of the offset.


translate

public static java.awt.image.BufferedImage translate(java.awt.image.BufferedImage srcBim,
                                                     double dx,
                                                     double dy)
Displace the image content by the given offset vector. Image size is unchanged. Margins exposed by the shift are filled with zeroes. Portions of the image shifted off the edge are lost. Shifting an image by a very small amount and then subtracting it from itself (eg, as previously cloned from the image menu) is a way of detecting edges in the direction of the offset.


varianceFilter

public static void varianceFilter(ImFrame imf)
Ask for neighbourhood size and replace every pixel in the image by the variance of its neighbourhood.


varianceFilter

public static java.awt.image.BufferedImage varianceFilter(java.awt.image.BufferedImage srcBim,
                                                          int halfWidth)
Replace every pixel in the image by the variance of its n x n neighbourhood, where n = 2.halfWidth + 1.


doOpInBackground

public static void doOpInBackground(java.lang.String op,
                                    ImFrame frame)
For particularly long operations, run them on a worker thread rather than clog up swing's event dispatch thread. Displays a javax.swing.ProgressMonitor which uses image row number (y value) as a measure of progress. Possible values for the op string are "meanFilter", "medianFilter", "nearestExtremeFilter", "rankFilter" and "varianceFilter".


getMonitor

public static javax.swing.ProgressMonitor getMonitor()
For developers to be able to setProgress () and test isCanceled () periodically and then close () when done.