net.grelf.grip
Class Convolutions

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

public class Convolutions
extends java.lang.Object

Static methods for convolution and deconvolution. Class cannot be instantiated. There is a static field of class Kernel which can be set/got independently of running a convolution. It may be loaded from a file, set as a Guassian curve or obtained by sampling the image around a given point or blob.


Method Summary
static java.awt.image.BufferedImage blurGaussian(java.awt.image.BufferedImage srcBim, int nx, int ny)
          Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical) and return the quite separate resulting new image.
static ImageDouble blurGaussian(ImageDouble srcAccum, int nx, int ny)
          Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical) and return the quite separate resulting new image.
static ImageInt blurGaussian(ImageInt srcAccum, int nx, int ny)
          Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical) and return the quite separate resulting new image.
static void blurGaussian(ImFrame imf, int nx, int ny)
          Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical).
static java.awt.image.BufferedImage convolve(java.awt.image.BufferedImage srcBim)
          Convolve the given image with the current kernel and return the quite separate resulting new image.
static ImageDouble convolve(ImageDouble srcAccum)
          Convolve the given image with the current kernel and return the quite separate resulting new image.
static ImageInt convolve(ImageInt srcAccum)
          Convolve the given image with the current kernel and return the quite separate resulting new image.
static void convolve(ImFrame imf)
          Convolve the image with the current kernel.
static void convolve(ImFrame imf, Kernel aKernel)
          Convolve the image with the given kernel, setting the kernel as the current kernel field of this class.
static java.awt.image.BufferedImage convolve1D(java.awt.image.BufferedImage srcBim, int[] horz, int[] vert)
          Convolve the given image with the given 1D arrays (horizontal and vertical - may be different) and return the quite separate resulting new image.
static ImageDouble convolve1D(ImageDouble srcAccum, double[] horz, double[] vert)
          Convolve the given image with the given 1D arrays (horizontal and vertical - may be different) and return the quite separate resulting new image.
static ImageInt convolve1D(ImageInt srcAccum, int[] horz, int[] vert)
          Convolve the given image with the given 1D arrays (horizontal and vertical - may be different) and return the quite separate resulting new image.
static java.awt.image.BufferedImage deconvolve(java.awt.image.BufferedImage orgBim)
          Deconvolve the image with the current kernel, using van Cittert's method.
static ImageDouble deconvolve(ImageDouble originalAccum, ImageDouble srcAccum, int passNo)
          Deconvolve the image with the current kernel, using van Cittert's method.
static ImageInt deconvolve(ImageInt originalAccum, ImageInt srcAccum, int passNo)
          Deconvolve the image with the current kernel, using van Cittert's method.
static void deconvolve(ImFrame imf)
          Deconvolve the image with the current kernel.
static void deconvolve(ImFrame imf, Kernel aKernel)
          Deconvolve the image with the given kernel
static void doOpInBackground(java.lang.String op, ImFrame frame, int width)
          For particularly long operations, run them on a worker thread rather than clog up swing's event dispatch thread.
static int getInitialHalfWidth()
           
static Kernel getKernel()
           
static javax.swing.ProgressMonitor getMonitor()
          For developers to be able to setProgress () and test isCanceled () periodically and then close () when done.
static int getNPasses()
          Get number of passes set for deconvolution.
static float getW()
          Get value of w parameter set for deconvolution.
static void setInitialHalfWidth(int aHalfWidth)
          For the manual and automatic (star) setting of the kernel from an image.
static void setKernel(Kernel aKernel)
           
static void setNPasses()
          Set the number of passes of deconvolution to be applied.
static void setW()
          Set the w parameter for deconvolutions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getKernel

public static Kernel getKernel()

setKernel

public static void setKernel(Kernel aKernel)

getInitialHalfWidth

public static int getInitialHalfWidth()

setInitialHalfWidth

public static void setInitialHalfWidth(int aHalfWidth)
For the manual and automatic (star) setting of the kernel from an image.


convolve

public static void convolve(ImFrame imf,
                            Kernel aKernel)
Convolve the image with the given kernel, setting the kernel as the current kernel field of this class.


convolve

public static void convolve(ImFrame imf)
Convolve the image with the current kernel.


convolve

public static java.awt.image.BufferedImage convolve(java.awt.image.BufferedImage srcBim)
Convolve the given image with the current kernel and return the quite separate resulting new image. Returns null if no kernel is set.


convolve

public static ImageInt convolve(ImageInt srcAccum)
Convolve the given image with the current kernel and return the quite separate resulting new image. Returns null if no kernel is set.


convolve

public static ImageDouble convolve(ImageDouble srcAccum)
Convolve the given image with the current kernel and return the quite separate resulting new image. Returns null if no kernel is set.


blurGaussian

public static void blurGaussian(ImFrame imf,
                                int nx,
                                int ny)
Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical).


blurGaussian

public static java.awt.image.BufferedImage blurGaussian(java.awt.image.BufferedImage srcBim,
                                                        int nx,
                                                        int ny)
Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical) and return the quite separate resulting new image.


blurGaussian

public static ImageInt blurGaussian(ImageInt srcAccum,
                                    int nx,
                                    int ny)
Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical) and return the quite separate resulting new image.


blurGaussian

public static ImageDouble blurGaussian(ImageDouble srcAccum,
                                       int nx,
                                       int ny)
Do Gaussian blurring of the given image with 1D profiles of width nx (horizontal) and ny (vertical) and return the quite separate resulting new image.


convolve1D

public static java.awt.image.BufferedImage convolve1D(java.awt.image.BufferedImage srcBim,
                                                      int[] horz,
                                                      int[] vert)
Convolve the given image with the given 1D arrays (horizontal and vertical - may be different) and return the quite separate resulting new image. All channels are convolved the same. If either array is null the convolution in that direction is skipped. This method is intended as a quicker way of doing certain useful convolutions, such as Gaussian blurring.


convolve1D

public static ImageInt convolve1D(ImageInt srcAccum,
                                  int[] horz,
                                  int[] vert)
Convolve the given image with the given 1D arrays (horizontal and vertical - may be different) and return the quite separate resulting new image. All channels are convolved the same. If either array is null the convolution in that direction is skipped. This method is intended as a quicker way of doing certain useful convolutions, such as Gaussian blurring.


convolve1D

public static ImageDouble convolve1D(ImageDouble srcAccum,
                                     double[] horz,
                                     double[] vert)
Convolve the given image with the given 1D arrays (horizontal and vertical - may be different) and return the quite separate resulting new image. All channels are convolved the same. If either array is null the convolution in that direction is skipped. This method is intended as a quicker way of doing certain useful convolutions, such as Gaussian blurring.


getNPasses

public static int getNPasses()
Get number of passes set for deconvolution.


getW

public static float getW()
Get value of w parameter set for deconvolution.


setW

public static void setW()
Set the w parameter for deconvolutions.


setNPasses

public static void setNPasses()
Set the number of passes of deconvolution to be applied.


deconvolve

public static void deconvolve(ImFrame imf,
                              Kernel aKernel)
Deconvolve the image with the given kernel


deconvolve

public static void deconvolve(ImFrame imf)
Deconvolve the image with the current kernel. Uses van Cittert's method.


deconvolve

public static java.awt.image.BufferedImage deconvolve(java.awt.image.BufferedImage orgBim)
Deconvolve the image with the current kernel, using van Cittert's method.


deconvolve

public static ImageInt deconvolve(ImageInt originalAccum,
                                  ImageInt srcAccum,
                                  int passNo)
Deconvolve the image with the current kernel, using van Cittert's method.


deconvolve

public static ImageDouble deconvolve(ImageDouble originalAccum,
                                     ImageDouble srcAccum,
                                     int passNo)
Deconvolve the image with the current kernel, using van Cittert's method.


doOpInBackground

public static void doOpInBackground(java.lang.String op,
                                    ImFrame frame,
                                    int width)
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 "convolve" and "deconvolve".


getMonitor

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