de.unihalle.informatik.MiToBo.apps.particles2D
Class ParticleDetectorUWT2D

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.apps.particles2D.ParticleDetector
              extended by de.unihalle.informatik.MiToBo.apps.particles2D.ParticleDetectorUWT2D
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, loci.common.StatusReporter

@ALDAOperator(genericExecutionMode=ALL,
              level=STANDARD)
@ALDDerivedClass
public class ParticleDetectorUWT2D
extends ParticleDetector
implements loci.common.StatusReporter

Detector for spotlike structures (bright on dark background) in 2D based on the undecimated wavelet transform. The undecimated wavelet transform produces wavelet coefficient images that correspond to the results of filtering the original image with a bank of filters. There is one lowpass-filtered image, one highpass-filtered image and several bandpass filtered images, depending on the parameter Jmax. The different bands/filtered images are referenced by the 'scale'. The parameters Jmin and Jmax determine the lower and upper scale limit and thus control the range of wavelet images that are taken into account for particle detection. Scale 1 corresponds to the highpass filtered image and increasing scales correspond to decreasing frequency bands.
The scaleIntervalSize parameter determines, how many wavelet images of adjacent scales are used to compute a wavelet correlation image, which is the multiplication of wavelet coefficients over adjacent scales at each pixel.
A short example: Jmin=2, Jmax=4, scaleIntervalSize=2. That means that the bandpass filtered images of scale 2 and 3 are multiplied for one correlation image, and the bandpass filtered images of scale 3 and 4 for another.
Correlation images are then thresholded by corrThreshold to yield hypotheses of particle detections. Because multiple hypotheses can exist at the same location due to multiple correlation images, a kind of hypothesis testing is used to determine the more likely detection at a certain location.
The resulting particle detections can be extracted from the particle detector as a set of regions. The input image may be transformed if it contains Poisson noise to simulate Gaussian noise For further details refer to: O. Gress, B. Möller, N. Stöhr, S. Hüttelmaier, S. Posch, "Scale-adaptive wavelet-based particle detection in microscopy images". In Proc. Bildverarbeitung für die Medizin (BVM 2010), pages 266-270, March 2010, Springer

Author:
Oliver Gress

Nested Class Summary
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  java.lang.Double corrThreshold
           
private  MTBImageByte excludeMask
          Optional mask to exclude particles in certain regions.
private  MTBImage inputImage
           
private  java.lang.Integer Jmax
           
private  java.lang.Integer Jmin
           
protected  java.util.Vector<loci.common.StatusListener> m_statusListeners
          vector of installed StatusListeners
private  int minRegionSize
           
private  boolean poisson2gauss
           
private  MTBRegion2DSet resultingRegions
           
private  java.lang.Integer scaleIntervalSize
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
ParticleDetectorUWT2D()
          Constructor
ParticleDetectorUWT2D(MTBImage img, int Jmin, int Jmax, double corrThreshold, int scaleIntervalSize, int minRegionSize)
          Constructor that sets the poisson2gauss flag to true
ParticleDetectorUWT2D(MTBImage img, int Jmin, int Jmax, double corrThreshold, int scaleIntervalSize, int minRegionSize, boolean poisson2gauss)
          Constructor
 
Method Summary
 void addStatusListener(loci.common.StatusListener statuslistener)
           
protected  MTBImage fillHoles(MTBImage img)
           
protected  MTBImage gauss2poisson(MTBImage img)
          Transforms image with gaussian noise to image with poisson noise J.
 MTBImage[] getCorrelationImages()
          Compute the correlation images as specified by the parameter object
 java.lang.Double getCorrelationThreshold()
          Get threshold for thresholding wavelet correlation images
 MTBImage getInputImage()
          Get input image
 java.lang.Integer getJmax()
          Get Jmax
 java.lang.Integer getJmin()
          Get Jmin
protected  java.lang.Integer getLabelMostInRegion(MTBRegion2D reg, MTBImage img)
           
protected  java.util.Vector<java.lang.Integer> getLabelsInRegion(MTBRegion2D reg, MTBImage img)
           
protected  MTBImage getMaskFromNuclei(MTBImage nucleiImg)
           
 int getMinRegionSize()
          Get the minimum size of detected regions.
protected  MTBImageHistogram getNormalizedCumulativeHistogram(MTBImage img, int bins)
          Create a normalized cumulative histogram from an image
 boolean getPoisson2Gauss()
          Get flag if input image with poisson noise is to be transformed to image with gaussian noise following J.
protected  MTBTree getRegionsTree(MTBImage[] binaryImages)
          Build a tree of regions from binarized images.
 MTBRegion2DSet getResults()
          Get resulting regions (each detetection corresponds to a region)
protected  double getSample(double[] cdf)
          Returns a sample in the range [0, 1] from a cumulative distribution given by the array cdf
 java.lang.Integer getScaleIntervalSize()
          Get the size of the scale interval for correlation images
protected  MTBImage inverseATrousDWT(MTBImage[] dwt)
           
protected  MTBImage labelImage(MTBImage img, MTBRegion2DSet regs)
           
protected  double logPofRegion(MTBRegion2D reg, MTBImage img, MTBImageHistogram cumHist)
           
protected  java.util.Vector<MTBTreeNode> meaningfulNodes(MTBTreeNode treeNode, MTBImage[] corrImgs, MTBImageHistogram[] hists, int mode)
          Get the most meaningful regions from a (sub)tree.
protected  double meanOfRegion(MTBRegion2D reg, MTBImage img)
           
 void notifyListeners(loci.common.StatusEvent e)
           
protected  void operate()
           
protected  MTBImage poisson2gauss(MTBImage img)
          Transforms image with poisson noise to image with gaussian noise J.
protected  MTBImage processedRegionsToBinImage(MTBImage img, MTBRegion2DSet regs, int minRegionSize)
          Create a binary image from given regions, which are processed before: regions smaller than minRegionSize are rejected.
protected  MTBImage regionsToBinImage(MTBImage img, MTBImage mask, java.util.Vector<MTBRegion2D> regs)
          Create binary image from a set of regions.
 void removeStatusListener(loci.common.StatusListener statuslistener)
           
 void setCorrelationThreshold(double corrThresh)
          Set threshold for thresholding wavelet correlation images
 void setExcludeMask(MTBImageByte mask)
          Specify exclude mask.
 void setInputImage(MTBImage img)
          Set input image
 void setJmax(int Jmax)
          Set Jmax
 void setJmin(int Jmin)
          Set Jmin
 void setMinRegionSize(int minRegionSize)
          Set the minimum size of detected regions.
 void setPoisson2Gauss(boolean poisson2gauss)
          Set flag if input image with poisson noise is to be transformed to image with gaussian noise following J.
protected  void setResults(MTBRegion2DSet detectedRegions)
          Set detected regions
 void setScaleIntervalSize(int scaleIntervalSize)
          Set the size of the scale interval for correlation images
protected  void threshDWTCoeffs(MTBImage img, double sigma)
           
protected  void threshDWTJeffreys(MTBImage[] dwt, double scaleOneSigma, double[] sigmaScales)
           
protected  MTBImage threshImage(MTBImage img, double thresh)
           
protected  MTBImage threshImgNiblack(MTBImage img, double k, int winsize)
           
 void validateCustom()
           
 
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, 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

corrThreshold

@Parameter(label="Correlation threshold",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=5,
           description="Threshold for wavelet correlation images")
private java.lang.Double corrThreshold

excludeMask

@Parameter(label="Exclude mask",
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=8,
           required=false,
           description="Exclude mask.")
private transient MTBImageByte excludeMask
Optional mask to exclude particles in certain regions.

Particles in masked regions are ignored if mask is non-null.


inputImage

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

Jmax

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

Jmin

@Parameter(label="Jmin",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=2,
           description="Minimum scale index")
private java.lang.Integer Jmin

m_statusListeners

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


minRegionSize

@Parameter(label="Minimum region size",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=6,
           description="Minimum area of detected regions")
private int minRegionSize

poisson2gauss

@Parameter(label="Poisson- to Gaussian noise transform",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=7,
           description="Transform input image with poisson noise to image with Gaussian noise (J.-L. Starck et al)")
private boolean poisson2gauss

resultingRegions

@Parameter(label="Resulting regions",
           required=true,
           direction=OUT,
           mode=STANDARD,
           dataIOOrder=1,
           description="Resulting (detected) regions")
private transient MTBRegion2DSet resultingRegions

scaleIntervalSize

@Parameter(label="Scale-interval size",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=4,
           description="Size of scale interval for wavelet correlation images")
private java.lang.Integer scaleIntervalSize
Constructor Detail

ParticleDetectorUWT2D

public ParticleDetectorUWT2D()
                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor

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

ParticleDetectorUWT2D

public ParticleDetectorUWT2D(MTBImage img,
                             int Jmin,
                             int Jmax,
                             double corrThreshold,
                             int scaleIntervalSize,
                             int minRegionSize)
                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor that sets the poisson2gauss flag to true

Parameters:
img - input image with bright granules on dark background
Jmin - lowest scale index to be used for correlation image computations (scale is reciprocal to frequency properties)
Jmax - highest scale index to be used for correlation image computations (scale is reciprocal to frequency properties)
corrThreshold - threshold for wavelet correlation images to obtain detected region hypotheses
scaleIntervalSize - size of the interval of scales that are used to compute wavelet correlation images
minRegionSize - minimum size of a region to be chosen as detection
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

ParticleDetectorUWT2D

public ParticleDetectorUWT2D(MTBImage img,
                             int Jmin,
                             int Jmax,
                             double corrThreshold,
                             int scaleIntervalSize,
                             int minRegionSize,
                             boolean poisson2gauss)
                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor

Parameters:
img - input image with bright granules on dark background
Jmin - lowest scale index to be used for correlation image computations (scale is reciprocal to frequency properties)
Jmax - highest scale index to be used for correlation image computations (scale is reciprocal to frequency properties)
corrThreshold - threshold for wavelet correlation images to obtain detected region hypotheses
scaleIntervalSize - size of the interval of scales that are used to compute wavelet correlation images
minRegionSize - minimum size of a region to be chosen as detection
poisson2gauss - flag if image with poisson noise is transformed to simulate gaussian noise
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

fillHoles

protected MTBImage fillHoles(MTBImage img)
                      throws java.lang.IllegalArgumentException,
                             de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                             de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Throws:
java.lang.IllegalArgumentException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

gauss2poisson

protected MTBImage gauss2poisson(MTBImage img)
                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Transforms image with gaussian noise to image with poisson noise J.-L. Starck et al., Multiresolution Support Applied to Image Filtering and Restoration

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

getCorrelationImages

public MTBImage[] getCorrelationImages()
                                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                       de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Compute the correlation images as specified by the parameter object

Parameters:
p - parameter object
Returns:
array of correlation images starting from the lowest scale interval (highest frequency interval)
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

getCorrelationThreshold

public java.lang.Double getCorrelationThreshold()
Get threshold for thresholding wavelet correlation images


getInputImage

public MTBImage getInputImage()
Get input image


getJmax

public java.lang.Integer getJmax()
Get Jmax


getJmin

public java.lang.Integer getJmin()
Get Jmin


getLabelMostInRegion

protected java.lang.Integer getLabelMostInRegion(MTBRegion2D reg,
                                                 MTBImage img)

getLabelsInRegion

protected java.util.Vector<java.lang.Integer> getLabelsInRegion(MTBRegion2D reg,
                                                                MTBImage img)

getMaskFromNuclei

protected MTBImage getMaskFromNuclei(MTBImage nucleiImg)
                              throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                     de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

getMinRegionSize

public int getMinRegionSize()
Get the minimum size of detected regions. All regions smaller than this size are rejected


getNormalizedCumulativeHistogram

protected MTBImageHistogram getNormalizedCumulativeHistogram(MTBImage img,
                                                             int bins)
Create a normalized cumulative histogram from an image

Parameters:
img - input image
bins - number of histogram bins
Returns:
normalized cumulative histogram

getPoisson2Gauss

public boolean getPoisson2Gauss()
Get flag if input image with poisson noise is to be transformed to image with gaussian noise following J.-L. Starck et al., Multiresolution Support Applied to Image Filtering and Restoration


getRegionsTree

protected MTBTree getRegionsTree(MTBImage[] binaryImages)
                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                 de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Build a tree of regions from binarized images. The binary images represent regions from different scales, fine scales have low indices in the array

Parameters:
binaryImages -
Returns:
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

getResults

public MTBRegion2DSet getResults()
Get resulting regions (each detetection corresponds to a region)


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:

getScaleIntervalSize

public java.lang.Integer getScaleIntervalSize()
Get the size of the scale interval for correlation images


inverseATrousDWT

protected MTBImage inverseATrousDWT(MTBImage[] dwt)
                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

labelImage

protected MTBImage labelImage(MTBImage img,
                              MTBRegion2DSet regs)

logPofRegion

protected double logPofRegion(MTBRegion2D reg,
                              MTBImage img,
                              MTBImageHistogram cumHist)

meaningfulNodes

protected java.util.Vector<MTBTreeNode> meaningfulNodes(MTBTreeNode treeNode,
                                                        MTBImage[] corrImgs,
                                                        MTBImageHistogram[] hists,
                                                        int mode)
Get the most meaningful regions from a (sub)tree. The tree of regions is assumed to contain different detections from different scales in the same image location. Detections are the regions which "explain" best this image part, the most meaningful regions.

Parameters:
treeNode - root of the (sub) tree
corrImgs - correlation images
hists - cumulative histograms
mode - 0: weighted mean, 1: unweighted mean, 2: min, 3 or else: max
Returns:

meanOfRegion

protected double meanOfRegion(MTBRegion2D reg,
                              MTBImage img)

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 ParticleDetector
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

poisson2gauss

protected MTBImage poisson2gauss(MTBImage img)
                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Transforms image with poisson noise to image with gaussian noise J.-L. Starck et al., Multiresolution Support Applied to Image Filtering and Restoration

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

processedRegionsToBinImage

protected MTBImage processedRegionsToBinImage(MTBImage img,
                                              MTBRegion2DSet regs,
                                              int minRegionSize)
Create a binary image from given regions, which are processed before: regions smaller than minRegionSize are rejected.

Parameters:
img -
regs -
minRegionSize -
Returns:

regionsToBinImage

protected MTBImage regionsToBinImage(MTBImage img,
                                     MTBImage mask,
                                     java.util.Vector<MTBRegion2D> regs)
Create binary image from a set of regions. If mask != null, pixels where mask is 0 are not considered.

Parameters:
img - only used to determine the result image size
mask -
regs -
Returns:

removeStatusListener

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

setCorrelationThreshold

public void setCorrelationThreshold(double corrThresh)
Set threshold for thresholding wavelet correlation images


setExcludeMask

public void setExcludeMask(MTBImageByte mask)
Specify exclude mask.


setInputImage

public void setInputImage(MTBImage img)
Set input image


setJmax

public void setJmax(int Jmax)
Set Jmax


setJmin

public void setJmin(int Jmin)
Set Jmin


setMinRegionSize

public void setMinRegionSize(int minRegionSize)
Set the minimum size of detected regions. All regions smaller than this size are rejected


setPoisson2Gauss

public void setPoisson2Gauss(boolean poisson2gauss)
Set flag if input image with poisson noise is to be transformed to image with gaussian noise following J.-L. Starck et al., Multiresolution Support Applied to Image Filtering and Restoration


setResults

protected void setResults(MTBRegion2DSet detectedRegions)
Set detected regions


setScaleIntervalSize

public void setScaleIntervalSize(int scaleIntervalSize)
Set the size of the scale interval for correlation images


threshDWTCoeffs

protected void threshDWTCoeffs(MTBImage img,
                               double sigma)

threshDWTJeffreys

protected void threshDWTJeffreys(MTBImage[] dwt,
                                 double scaleOneSigma,
                                 double[] sigmaScales)

threshImage

protected MTBImage threshImage(MTBImage img,
                               double thresh)
                        throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                               de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

threshImgNiblack

protected MTBImage threshImgNiblack(MTBImage img,
                                    double k,
                                    int winsize)
                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                    de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

validateCustom

public void validateCustom()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Overrides:
validateCustom in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException