de.unihalle.informatik.MiToBo.transforms
Class UndecimatedWaveletTransform

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.transforms.UndecimatedWaveletTransform
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, loci.common.StatusReporter

@ALDAOperator(genericExecutionMode=NONE)
public class UndecimatedWaveletTransform
extends MTBOperator
implements loci.common.StatusReporter

Undecimated wavelet transform (UWT) operator.

Author:
gress

Nested Class Summary
protected static class UndecimatedWaveletTransform.TransformationMode
           
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  java.lang.Boolean denoise
           
private  MTBImage img
           
private  java.lang.Integer Jmax
           
private  MTBImage[] kernels
           
private  double[] m_sigmaScales
          noise sigma scale factors for different wavelet scales
private  java.util.Vector<loci.common.StatusListener> m_statusListeners
          vector of installed StatusListeners
private  UndecimatedWaveletTransform.TransformationMode transform
           
private  MTBImageSet uwtImages
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
UndecimatedWaveletTransform()
          Constructor with default Gaussian kernel [1/16, 1/4, 3/8, 1/4, 1/16] for dimension x, y and z.
UndecimatedWaveletTransform(MTBImage img, int Jmax, boolean denoise)
          Constructor with default Gaussian kernel [1/16, 1/4, 3/8, 1/4, 1/16] for at most dimension x, y (and z if present).
UndecimatedWaveletTransform(MTBImage img, int Jmax, boolean denoise, MTBImage[] kernels)
          Constructor.
 
Method Summary
 void addStatusListener(loci.common.StatusListener statuslistener)
           
protected  MTBImage[] aTrousDWT(MTBImage img, int Jmax, MTBImage[] kernels)
          A trous DWT
protected  double[] computeSigmaScales()
          Compute scaling factors of noise sigma for wavelet scales (these scaling factors are estimated using a gaussian noise image with sigma=1 to measure noise in the wavelet scales)
protected  MTBImage conv(MTBImage img, MTBImage[] scaleOneKernels, int j)
          Convolve input image with an 'a trous' kernel (zeros inserted) given the original kernel and scale j
protected  MTBImage createGaussianNoiseImage(double mean, double sigma, double clippingFactor, int bins, int sizeX, int sizeY, int sizeZ, int sizeT, int sizeC)
          Create an image with Gaussian noise
protected  void denoise(MTBImage img, double sigma)
          Denoise wavelet coefficients using Jeffrey's noninformative prior for a given sigma of noise
protected  void denoiseDWTJeffreys(MTBImage[] dwt, double scaleOneSigma, double[] sigmaScales)
          Denoise wavelet coefficients using Jeffrey's noninformative prior [..]
protected  double get3SigClippedStdDev(MTBImage img)
          Get the standard deviation (sigma) of an image only using values clipped by 3*sigma from a first estimate of sigma
 boolean getDenoise()
          Get the denoising flag. true if denoising is activated.
 MTBImage getImg()
          Get reference to the (input) image.
 int getJmax()
          Get Jmax (maximum scale 2^Jmax - 1)
protected  MTBImage[] getKernels()
          Get smoothing kernels
protected  double getSample(double[] cdf)
          Returns a sample in the range [0, 1] from a cumulative distribution given by the array cdf
protected  double getStdDev(MTBImage img)
          Get standard deviation of the image
 MTBImageSet getUWT()
          Get the UWT coefficient images.
protected  MTBImage inverseATrousDWT(MTBImage[] dwt)
          Inverse a trous DWT
 boolean isForwardTransform()
          Test if parameter object is set to (forward) transform (image to wavelet)
 boolean isInverseTransform()
          Test if parameter object is set to Inverse Transform (wavelet to image)
 void notifyListeners(loci.common.StatusEvent e)
           
protected  void operate()
           
 void removeStatusListener(loci.common.StatusListener statuslistener)
           
protected  void setDenoise(boolean denoise)
          Set the denoising flag. true to activate denoising.
 void setForwardTransform()
          Toggle computation of the (forward) transform (image to wavelet)
 void setImg(MTBImage img)
          Set the image domain image
 void setInverseTransform()
          Set computation of the inverse transform (wavelet to image)
protected  void setJmax(int Jmax)
          Set Jmax (maximum scale 2^Jmax - 1)
protected  void setKernels(MTBImage[] kernels)
          Set smoothing kernels
 void setUWT(MTBImageSet uwtImages)
          Set UWT coefficient images
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
readResolve
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

denoise

@Parameter(label="Denoise",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=3,
           description="Specifies whether the wavelet coefficients will be denoised using Jeffrey\'s noninformative prior")
private java.lang.Boolean denoise

img

@Parameter(label=" image",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=1,
           description="Input image")
private MTBImage img

Jmax

@Parameter(label="Jmax",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=2,
           description="Maximum scale index (decimal > 0)")
private java.lang.Integer Jmax

kernels

@Parameter(label="Kernels",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=1,
           description="A set of lowpass kernels interpreted as parts of a separable kernel")
private MTBImage[] kernels

m_sigmaScales

private final double[] m_sigmaScales
noise sigma scale factors for different wavelet scales


m_statusListeners

private java.util.Vector<loci.common.StatusListener> m_statusListeners
vector of installed StatusListeners


transform

@Parameter(label="Type of transform",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=4,
           description="Specifies if forward or backward transform is computed")
private UndecimatedWaveletTransform.TransformationMode transform

uwtImages

@Parameter(label="UWT coefficient images",
           required=true,
           direction=OUT,
           mode=STANDARD,
           dataIOOrder=1,
           description="Images with UWT coefficients of the different scales")
private MTBImageSet uwtImages
Constructor Detail

UndecimatedWaveletTransform

public UndecimatedWaveletTransform()
                            throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with default Gaussian kernel [1/16, 1/4, 3/8, 1/4, 1/16] for dimension x, y and z.

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

UndecimatedWaveletTransform

public UndecimatedWaveletTransform(MTBImage img,
                                   int Jmax,
                                   boolean denoise)
                            throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with default Gaussian kernel [1/16, 1/4, 3/8, 1/4, 1/16] for at most dimension x, y (and z if present).

Parameters:
img - input image
Jmax - maximum scale (2^Jmax - 1)
denoise - reduction of gaussian noise
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

UndecimatedWaveletTransform

public UndecimatedWaveletTransform(MTBImage img,
                                   int Jmax,
                                   boolean denoise,
                                   MTBImage[] kernels)
                            throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor. Separable lowpass kernels are expected (i.e. Gaussian).

Parameters:
img - input image
Jmax - maximum scale (2^Jmax - 1)
denoise - reduction of gaussian noise
kernels - an array of kernels, which are inflated for each scale and used to convolve the image consecutively, because a separable filter is expected to be specified by this array
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

addStatusListener

public void addStatusListener(loci.common.StatusListener statuslistener)
Specified by:
addStatusListener in interface loci.common.StatusReporter

aTrousDWT

protected MTBImage[] aTrousDWT(MTBImage img,
                               int Jmax,
                               MTBImage[] kernels)
                        throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                               de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
A trous DWT

Returns:
DWT-coefficient images ([0] lowpass coeffs, [1] highpass coeffs, [2] highest bandpass coeffs, ..., [Jmax] lowest bandpass coeffs)
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

computeSigmaScales

protected double[] computeSigmaScales()
                               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                      de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Compute scaling factors of noise sigma for wavelet scales (these scaling factors are estimated using a gaussian noise image with sigma=1 to measure noise in the wavelet scales)

Parameters:
p - DWT configuration (only Jmax is important here)
Returns:
scaling factor of noise sigma for wavelet scale 1 to Jmax
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

conv

protected MTBImage conv(MTBImage img,
                        MTBImage[] scaleOneKernels,
                        int j)
                 throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                        de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Convolve input image with an 'a trous' kernel (zeros inserted) given the original kernel and scale j

Parameters:
img - input image
scaleOneKernels - original kernel (without inserted zeros)
j - scale parameter
Returns:
filtered image
Throws:
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

createGaussianNoiseImage

protected MTBImage createGaussianNoiseImage(double mean,
                                            double sigma,
                                            double clippingFactor,
                                            int bins,
                                            int sizeX,
                                            int sizeY,
                                            int sizeZ,
                                            int sizeT,
                                            int sizeC)
Create an image with Gaussian noise

Parameters:
mean -
sigma -
clippingFactor -
bins -
sizeX -
sizeY -
sizeZ -
sizeT -
sizeC -
Returns:

denoise

protected void denoise(MTBImage img,
                       double sigma)
Denoise wavelet coefficients using Jeffrey's noninformative prior for a given sigma of noise

Parameters:
img - input image
sigma - sigma of noise

denoiseDWTJeffreys

protected void denoiseDWTJeffreys(MTBImage[] dwt,
                                  double scaleOneSigma,
                                  double[] sigmaScales)
Denoise wavelet coefficients using Jeffrey's noninformative prior [..]

Parameters:
dwt -
scaleOneSigma -
sigmaScales -

get3SigClippedStdDev

protected double get3SigClippedStdDev(MTBImage img)
Get the standard deviation (sigma) of an image only using values clipped by 3*sigma from a first estimate of sigma

Parameters:
img - input image
Returns:
3*sigma clipped std dev

getDenoise

public boolean getDenoise()
Get the denoising flag. true if denoising is activated.


getImg

public MTBImage getImg()
Get reference to the (input) image.

Returns:
Image domain image

getJmax

public int getJmax()
Get Jmax (maximum scale 2^Jmax - 1)


getKernels

protected MTBImage[] getKernels()
Get smoothing kernels


getSample

protected double getSample(double[] cdf)
Returns a sample in the range [0, 1] from a cumulative distribution given by the array cdf

Parameters:
cdf - cumulative distribution array
Returns:

getStdDev

protected double getStdDev(MTBImage img)
Get standard deviation of the image

Parameters:
img - input image
Returns:
sigma

getUWT

public MTBImageSet getUWT()
Get the UWT coefficient images. At index 0, the lowpass image stored. Indices j = 1,...,Jmax correspond to the UWT coefficients at scales 2^j - 1, meaning highpass at j=1, highest bandpass at j=2 and lowest bandpass at j=Jmax

Returns:
Reference to UWT images

inverseATrousDWT

protected MTBImage inverseATrousDWT(MTBImage[] dwt)
                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Inverse a trous DWT

Parameters:
dwt - DWT-coefficient images
Returns:
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

isForwardTransform

public boolean isForwardTransform()
Test if parameter object is set to (forward) transform (image to wavelet)

Returns:
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

isInverseTransform

public boolean isInverseTransform()
                           throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Test if parameter object is set to Inverse Transform (wavelet to image)

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

notifyListeners

public void notifyListeners(loci.common.StatusEvent e)
Specified by:
notifyListeners in interface loci.common.StatusReporter

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                       de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

removeStatusListener

public void removeStatusListener(loci.common.StatusListener statuslistener)
Specified by:
removeStatusListener in interface loci.common.StatusReporter

setDenoise

protected void setDenoise(boolean denoise)
Set the denoising flag. true to activate denoising.


setForwardTransform

public void setForwardTransform()
Toggle computation of the (forward) transform (image to wavelet)


setImg

public void setImg(MTBImage img)
Set the image domain image


setInverseTransform

public void setInverseTransform()
                         throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Set computation of the inverse transform (wavelet to image)

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setJmax

protected void setJmax(int Jmax)
Set Jmax (maximum scale 2^Jmax - 1)

Parameters:
Jmax -

setKernels

protected void setKernels(MTBImage[] kernels)
Set smoothing kernels


setUWT

public void setUWT(MTBImageSet uwtImages)
Set UWT coefficient images