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

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.NucleusSeparator2DAlgos
              extended by de.unihalle.informatik.MiToBo.apps.nuclei2D.NucleusSeparator2DPeakSearch
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator

@ALDAOperator(genericExecutionMode=ALL,
              level=STANDARD)
@ALDDerivedClass
public class NucleusSeparator2DPeakSearch
extends NucleusSeparator2DAlgos

Operator for separating merged nuclei regions in images.

This operator analyzes nuclei images and detects nuclei regions. The main focus is thereby on seperating nuclei regions which are merged by common segmentation techniques. Consequently, binary pre-segmentations of nuclei regions can be provided as input to the operator.
Anyway, if no binary image is coming along, the gray-scale input image will first be binarized by applying Otsu thresholding and some morphological post-processing steps. Indeed this a standard procedure which probably won't suit your needs - better use your own nucleus detector instead.

After binarization the resulting regions are further analyzed, i.e. the centers of present nuclei regions are determined (for details refer to Jochen's project thesis).

Given estimates for the nuclei regions snakes are initialized and run to detect the complete nuclei regions. As result extracted nuclei contours are provided as a set of polygons and overlayed to the greyscale image.

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  MTBImageByte BWImg
           
private  double gamma
          Step-size in iterative snake optimization.
private  java.lang.Double mad
           
private  NucleusSeparator2DPeakSearch_RegionSeparator nrs
           
private  java.lang.Float peakdistance
           
private  MTBImageRGB resultRGBimage
          RGB image overlay with result nuclei contours.
private  de.unihalle.informatik.Alida.datatypes.ALDDirectoryString saveSnakeLoc
          Path where to save intermediate results.
private  boolean saveSnakes
          Flag to enable/disable saving of intermediate snake results.
private  double segmentlength
          Snake segment length.
private  boolean showSnakes
          Flag to enable/disable display of snake results.
private  int snakeIterations
          Maximal number of snake iterations in iterative optimization.
private  MTBPolygon2DSet snakes
          Set of resulting contours.
private  java.lang.Integer suppressor
           
 
Fields inherited from class de.unihalle.informatik.MiToBo.apps.nuclei2D.NucleusSeparator2DAlgos
inputImg, labelImg, resultImg
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
NucleusSeparator2DPeakSearch()
          Default constructor.
NucleusSeparator2DPeakSearch(MTBImageShort grey)
          Constructor with input image.
NucleusSeparator2DPeakSearch(MTBImageShort grey, MTBImage label)
          Constructor with gray-scale and binary image.
 
Method Summary
 void configureSnakes(double g, int its, double avglength)
          Configures basic snake parameters.
 MTBImageShort getLabelImage()
          Returns gray-scale label image with nuclei regions.
 MTBRegion2DSet getNRSCandidates()
          Returns possible peak locations from NucleusRegionSeperator.
 MTBImage getNRSDistImg()
          Returns distance image calculated intermediately.
 MTBPolygon2DSet getNRSEllipsoidSnakePrimer()
          Creates and returns a set of polygons as starting regions for snake analysis based on hypothesized ellipses from nucleus information
 MTBRegion2DSet[] getNRSResultAreas()
          Returns set of result regions from region separator.
 MTBRegion2DSet getNRSResultCenters()
          Returns set of detected region centers from region separator.
 MTBPolygon2DSet getNRSVoronoidSnakePrimer()
          Creates and returns a set of polygons as starting regions for the snakes.
 MTBRegion2DSet getOtsuRegs()
          Returns set of regions resulting from Otsu thresholding.
 MTBImageRGB getResultImage()
          Returns RGB color image overlayed with nuclei contours.
 MTBPolygon2DSet getSnakes()
          Returns the result snakes.
protected  void operate()
           
 void setInImg(MTBImage inImg)
          Specify gray-scale input image.
 void setLabelImg(MTBImage label)
          Specify label input image.
 void setMad(double _mad)
          Sets maximal allowed discrepancy of direct connection to actual profile between two peaks.
 void setMax_d2c(float max_d2c)
          Sets factor to adjust maximal allowed distance from lower to upper peak.
 void setSavePath(java.lang.String path)
          Sets the path to where intermediate snake results are to be written.
 void setSaveSnakes(boolean save)
          (De)activates saving of iteration step results.
 void setShowSnakes(boolean show)
          (De)activates displaying of intermediate results during snake-iterations.
 void setSnakeIterations(int its)
          Sets number of iterations for snake optimization.
 void setSuppressor(int sup)
          Sets threshold to suppress peak analysis close to scraggy contours.
 
Methods inherited from class de.unihalle.informatik.MiToBo.apps.nuclei2D.NucleusSeparator2DAlgos
getResultImg, setInputGrayScaleImage, setInputLabelImage, setResultImg
 
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

BWImg

private transient MTBImageByte BWImg

gamma

@Parameter(label="Snake Step Size",
           required=false,
           direction=IN,
           dataIOOrder=4,
           mode=STANDARD,
           description="Step size gamma for snake gradient-descent.")
private double gamma
Step-size in iterative snake optimization.


mad

private transient java.lang.Double mad

nrs

private transient NucleusSeparator2DPeakSearch_RegionSeparator nrs

peakdistance

private transient java.lang.Float peakdistance

resultRGBimage

@Parameter(label="Result Snake Image",
           required=false,
           direction=OUT,
           description="RGB image with nuclei contour overlay.")
private transient MTBImageRGB resultRGBimage
RGB image overlay with result nuclei contours.


saveSnakeLoc

@Parameter(label="Save Results to...",
           required=false,
           direction=IN,
           dataIOOrder=-8,
           mode=ADVANCED,
           supplemental=true,
           description="Path to where intermediate results will be stored.")
private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString saveSnakeLoc
Path where to save intermediate results.


saveSnakes

@Parameter(label="Save Snakes",
           required=false,
           direction=IN,
           dataIOOrder=-9,
           mode=ADVANCED,
           supplemental=true,
           description="Flag to enable/disable saving of intermediate results.")
private boolean saveSnakes
Flag to enable/disable saving of intermediate snake results.


segmentlength

@Parameter(label="Snake Segment Length",
           required=false,
           direction=IN,
           dataIOOrder=5,
           mode=ADVANCED,
           description="Desired length of snake segments.")
private double segmentlength
Snake segment length.


showSnakes

@Parameter(label="Show Snakes",
           required=false,
           direction=IN,
           dataIOOrder=-10,
           mode=STANDARD,
           supplemental=true,
           description="Flag to enable/disable snake display.")
private boolean showSnakes
Flag to enable/disable display of snake results.


snakeIterations

@Parameter(label="Max. Snake Iterations",
           required=false,
           direction=IN,
           dataIOOrder=3,
           mode=STANDARD,
           description="Maximal number of snake iterations.")
private int snakeIterations
Maximal number of snake iterations in iterative optimization.


snakes

@Parameter(label="Result Nuclei Contours",
           required=false,
           direction=OUT,
           description="Set of resulting snakes.")
private MTBPolygon2DSet snakes
Set of resulting contours.


suppressor

private transient java.lang.Integer suppressor
Constructor Detail

NucleusSeparator2DPeakSearch

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

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

NucleusSeparator2DPeakSearch

public NucleusSeparator2DPeakSearch(MTBImageShort grey)
                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with input image.

Parameters:
grey - Original greyscale nucleus image.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

NucleusSeparator2DPeakSearch

public NucleusSeparator2DPeakSearch(MTBImageShort grey,
                                    MTBImage label)
                             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with gray-scale and binary image.

Parameters:
grey - Original greyscale nucleus image.
label - Label image of pre-segmented nuclei regions.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

configureSnakes

public void configureSnakes(double g,
                            int its,
                            double avglength)
Configures basic snake parameters.

Parameters:
g - Array of snake step-sizes.
its - Number of iterations.
avglength - Desired length of snake segments.

getLabelImage

public MTBImageShort getLabelImage()
Returns gray-scale label image with nuclei regions.

Returns:
Gray-scale image with nuclei regions.

getNRSCandidates

public MTBRegion2DSet getNRSCandidates()
Returns possible peak locations from NucleusRegionSeperator.

Returns:
Set of possible peak locations from NucleusRegionSeperator.

getNRSDistImg

public MTBImage getNRSDistImg()
Returns distance image calculated intermediately.

Returns:
Distance-transformation image as done by NucleusRegionSeparator.

getNRSEllipsoidSnakePrimer

public MTBPolygon2DSet getNRSEllipsoidSnakePrimer()
Creates and returns a set of polygons as starting regions for snake analysis based on hypothesized ellipses from nucleus information


getNRSResultAreas

public MTBRegion2DSet[] getNRSResultAreas()
Returns set of result regions from region separator.

Returns:
Splitted regions.

getNRSResultCenters

public MTBRegion2DSet getNRSResultCenters()
Returns set of detected region centers from region separator.

Returns:
Set of detected nuclei centers from NucleusRegionSeperator.

getNRSVoronoidSnakePrimer

public MTBPolygon2DSet getNRSVoronoidSnakePrimer()
                                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                                 de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Creates and returns a set of polygons as starting regions for the snakes.

The method is based on voronoi tesselation of Otsu-regions.

Returns:
Set of initial snake polygons.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getOtsuRegs

public MTBRegion2DSet getOtsuRegs()
Returns set of regions resulting from Otsu thresholding.

Returns:
Set of regions created by Otsu thresholding.

getResultImage

public MTBImageRGB getResultImage()
Returns RGB color image overlayed with nuclei contours.

Returns:
Color image with nuclei contours.

getSnakes

public MTBPolygon2DSet getSnakes()
Returns the result snakes.

Returns:
Resulting nuclei contours.

operate

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

setInImg

public void setInImg(MTBImage inImg)
Specify gray-scale input image.

Parameters:
inImg - Gray-scale input image to be processed.

setLabelImg

public void setLabelImg(MTBImage label)
Specify label input image.

Parameters:
bw - Label input image.

setMad

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

Parameters:
mad - Maximal discrepancy, default 0.11.

setMax_d2c

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

Parameters:
max_d2c - Maximal distance, default 1.5.

setSavePath

public void setSavePath(java.lang.String path)
Sets the path to where intermediate snake results are to be written.

Parameters:
Path - in filesystem, folder must exist.

setSaveSnakes

public void setSaveSnakes(boolean save)
(De)activates saving of iteration step results.

Parameters:
If - true, saving of results is enabled.

setShowSnakes

public void setShowSnakes(boolean show)
(De)activates displaying of intermediate results during snake-iterations.

Parameters:
If - true, displaying results is enabled.

setSnakeIterations

public void setSnakeIterations(int its)
Sets number of iterations for snake optimization.

Parameters:
its - Number of iterations.

setSuppressor

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

Parameters:
sup - Threshold, should be > 4.