de.unihalle.informatik.MiToBo.apps.nuclei2D
Class NucleusSeparator2DPeakSearch_RegionSeparator

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.nuclei2D.NucleusSeparator2DPeakSearch_RegionSeparator
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator

@ALDAOperator(genericExecutionMode=NONE)
public class NucleusSeparator2DPeakSearch_RegionSeparator
extends MTBOperator

Operator to analyze a given binary image or a set of nuclei regions.

The data will be transformed into a distance map in which the peaks are analyzed and compared to identify overlapping nuclei.

The result will be center-coordinates of all nuclei in the data. Furthermore the regions may be divided or initial regions for further analysis may be delivered.

This operator has been written as part of Jochen's project in WS 2011/12.

Author:
Jochen Luechtrath, Birgit Moeller

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  boolean[][] blacklist
           
private  MTBRegion2DSet candidates
           
private  MTBImage distImg
          Calculated distance map.
private  DistanceTransform.DistanceMetric distmet
          Metric for distance map calculation.
private  MTBImage inImg
          Binary input image to be analyzed.
private  MTBRegion2DSet inputRegions
          Optional set of pre-segmented input regions.
private  double mad
          Maximal allowed discrepancy.
private  double max_d2c
          Maximum peak distance factor.
 boolean report
           
private  int res_x
           
private  int res_y
           
private  MTBRegion2DSet[] resultAreas
           
private  MTBRegion2DSet resultCenters
          Set of detected nuclei centers.
private  MTBRegion2DSet[] resultRegCenters
          Nuclei centers sorted according to former regions.
private  double schwelle
          Threshold to suppress peak analysis close to scraggy contours.
private  boolean[][] seen
           
private  MTBPolygon2DSet snakePrimerEllipse
          Set of elliptical snake polygons.
private  MTBPolygon2DSet snakePrimerVoronoi
          Set of snake polygons based on Voronoi tesselation.
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
NucleusSeparator2DPeakSearch_RegionSeparator()
          Default constructor.
NucleusSeparator2DPeakSearch_RegionSeparator(MTBImageByte image)
          Constructor with input image.
NucleusSeparator2DPeakSearch_RegionSeparator(MTBRegion2DSet oset)
          Constructor with region set.
 
Method Summary
private  void ellipsoidSnakePrimer()
          Function to extract elliptical snake primers.
 MTBRegion2DSet getCandidates()
          Returns set of detected candidate peaks.
 MTBImage getDistImg()
          Returns calculated distance map.
 MTBPolygon2DSet getEllipsoidSnakePrimer()
          Returns set of initial snake ellipses.
 MTBRegion2DSet getInputRegs()
          Get set of input regions.
 MTBRegion2DSet[] getRegCenters()
          Returns the centers of the nuclei sorted to their original regions.
 MTBRegion2DSet[] getResultAreas()
          Returns separated regions sorted according to original regions.
 MTBRegion2DSet getResultCenters()
          Returns centers of result regions.
 MTBPolygon2DSet getVoronoidSnakePrimer()
          Returns set of snake polygons resulting from Voronoi tesselation.
private  boolean gratwanderung(int x, int y, MTBRegion2D tempreg)
          Function to travers ridges.
private  void makeline(int xstart, int ystart, int xend, int yend, java.util.Vector<java.awt.geom.Point2D.Double> line)
          Draws a line between two points.
protected  void operate()
           
private  void regionVoronoize()
          Function to perform Voronoi tesselation.
 void setDistmet(DistanceTransform.DistanceMetric _distmet)
          Specify the metric for the distance transformation.
 void setInImg(MTBImageByte _inImg)
          Specify binary input image.
 void setInputRegs(MTBRegion2DSet _inputRegions)
          Specify set of input regions.
 void setMad(double _mad)
          Sets maximal allowed discrepancy of direct connection to actual profile between two peaks.
 void setMax_d2c(double _max_d2c)
          Sets factor to adjust maximal allowed distance from lower to upper peak.
 void setSuppressor(int sup)
          Sets threshold to suppress peak analysis close to scraggy contours.
private  void voronoidSnakePrimer()
          Function to extract Voronoi primers.
 
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

blacklist

private transient boolean[][] blacklist

candidates

private transient MTBRegion2DSet candidates

distImg

@Parameter(label="Distance Map",
           required=false,
           direction=OUT,
           description="Distance Map.")
private transient MTBImage distImg
Calculated distance map.


distmet

@Parameter(label="Distance Metric",
           required=false,
           direction=IN,
           mode=ADVANCED,
           description="Distance metric.")
private DistanceTransform.DistanceMetric distmet
Metric for distance map calculation.


inImg

@Parameter(label="Input Image",
           required=true,
           direction=IN,
           dataIOOrder=1,
           mode=STANDARD,
           description="Binary input image.")
private transient MTBImage inImg
Binary input image to be analyzed.


inputRegions

@Parameter(label="Input Regions",
           required=false,
           direction=INOUT,
           dataIOOrder=1,
           mode=ADVANCED,
           description="Input nuclei regions.")
private transient MTBRegion2DSet inputRegions
Optional set of pre-segmented input regions.


mad

@Parameter(label="Maximal Allowed Discrepancy",
           required=false,
           direction=IN,
           mode=ADVANCED,
           description="Max. allowed discrepancy of direct connection to actual profile.")
private double mad
Maximal allowed discrepancy.


max_d2c

@Parameter(label="Maximum Peak Distance Factor",
           required=false,
           direction=IN,
           mode=ADVANCED,
           description="Factor to adjust maximal allowed distance from lower to upper peak.")
private double max_d2c
Maximum peak distance factor.


report

public transient boolean report

res_x

private transient int res_x

res_y

private transient int res_y

resultAreas

private transient MTBRegion2DSet[] resultAreas

resultCenters

@Parameter(label="Nuclei Centers",
           required=false,
           direction=OUT,
           description="Centers of all detected nuclei.")
private transient MTBRegion2DSet resultCenters
Set of detected nuclei centers.


resultRegCenters

@Parameter(label="Nuclei Centers of former regions",
           required=false,
           direction=OUT,
           description="Centers of detected nuclei seperated in their former regions")
private transient MTBRegion2DSet[] resultRegCenters
Nuclei centers sorted according to former regions.


schwelle

@Parameter(label="Significance Threshold for Peaks",
           required=false,
           direction=IN,
           mode=ADVANCED,
           description="Threshold to suppress peak analysis close to scraggy contours (should be >4).")
private double schwelle
Threshold to suppress peak analysis close to scraggy contours.


seen

private transient boolean[][] seen

snakePrimerEllipse

@Parameter(label="Elliptic Snake Initialisations",
           required=false,
           direction=OUT,
           description="Set of elliptical snake polygons.")
private transient MTBPolygon2DSet snakePrimerEllipse
Set of elliptical snake polygons.


snakePrimerVoronoi

@Parameter(label="Snake Initialisation by Voronoi",
           required=false,
           direction=OUT,
           description="Snake polygons from Voronoi-tesselated regions.")
private transient MTBPolygon2DSet snakePrimerVoronoi
Set of snake polygons based on Voronoi tesselation.

Constructor Detail

NucleusSeparator2DPeakSearch_RegionSeparator

public NucleusSeparator2DPeakSearch_RegionSeparator()
                                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Default constructor.

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

NucleusSeparator2DPeakSearch_RegionSeparator

public NucleusSeparator2DPeakSearch_RegionSeparator(MTBImageByte image)
                                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with input image.

Parameters:
image - Binary input image.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

NucleusSeparator2DPeakSearch_RegionSeparator

public NucleusSeparator2DPeakSearch_RegionSeparator(MTBRegion2DSet oset)
                                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with region set.

Note: the set needs correct referenced dimensions!

Parameters:
oset - Set of input regions.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

ellipsoidSnakePrimer

private void ellipsoidSnakePrimer()
Function to extract elliptical snake primers.


getCandidates

public MTBRegion2DSet getCandidates()
Returns set of detected candidate peaks.

Returns:
Set of all possible peaks.

getDistImg

public MTBImage getDistImg()
Returns calculated distance map.

Returns:
Image distance map.

getEllipsoidSnakePrimer

public MTBPolygon2DSet getEllipsoidSnakePrimer()
Returns set of initial snake ellipses.

Returns:
Elliptical snake polygons.

getInputRegs

public MTBRegion2DSet getInputRegs()
Get set of input regions.

Returns:
Set of input regions.

getRegCenters

public MTBRegion2DSet[] getRegCenters()
Returns the centers of the nuclei sorted to their original regions.

Returns:
Set of nuclei centers sorted according to their original regions.

getResultAreas

public MTBRegion2DSet[] getResultAreas()
Returns separated regions sorted according to original regions.

Returns:
Splitted regions of their actual centers.

getResultCenters

public MTBRegion2DSet getResultCenters()
Returns centers of result regions.

Returns:
Centers of all detected nuclei.

getVoronoidSnakePrimer

public MTBPolygon2DSet getVoronoidSnakePrimer()
                                       throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                              de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Returns set of snake polygons resulting from Voronoi tesselation.

Returns:
Initial snake polygons of voronoi divided regions.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

gratwanderung

private boolean gratwanderung(int x,
                              int y,
                              MTBRegion2D tempreg)
Function to travers ridges.

Parameters:
x - x-coordinate to check.
y - y-coordinate to check.
tempreg - Region to check.
Returns:
True if pixel refers to peak.

makeline

private void makeline(int xstart,
                      int ystart,
                      int xend,
                      int yend,
                      java.util.Vector<java.awt.geom.Point2D.Double> line)
Draws a line between two points.

Parameters:
xstart - Start point x-coordinate.
ystart - Start point x-coordinate.
xend - End point x-coordinate.
yend - End point y-coordinate.
line - Points in between.

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

regionVoronoize

private void regionVoronoize()
Function to perform Voronoi tesselation.


setDistmet

public void setDistmet(DistanceTransform.DistanceMetric _distmet)
Specify the metric for the distance transformation.

Parameters:
distmet - Distance metric, default is Chessboard-Distance.

setInImg

public void setInImg(MTBImageByte _inImg)
Specify binary input image.

Parameters:
inImg - Binary input image.

setInputRegs

public void setInputRegs(MTBRegion2DSet _inputRegions)
Specify set of input regions.

Parameters:
inputRegions - Set of input regions.

setMad

public void setMad(double _mad)
Sets maximal allowed discrepancy of direct connection to actual profile between two peaks.

Parameters:
mad - Max. discrepancy, default is 0.11.

setMax_d2c

public void setMax_d2c(double _max_d2c)
Sets factor to adjust maximal allowed distance from lower to upper peak.

Parameters:
max_d2c - Adjustment factor, default is 1.5.

setSuppressor

public void setSuppressor(int sup)
Sets threshold to suppress peak analysis close to scraggy contours.

Parameters:
sup - Threshold, should be >4.

voronoidSnakePrimer

private void voronoidSnakePrimer()
                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                 de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Function to extract Voronoi primers.

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