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

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

@ALDAOperator(genericExecutionMode=ALL)
public class NucleusDetector2D
extends MTBOperator

Operator for segmenting cell nuclei in 2D images.

Author:
moeller

Nested Class Summary
static class NucleusDetector2D.NuclDetectMode
          Available modes for nuclei segmentation in 2D images.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  LocallyAdaptiveContrastEnhancement contrastEnhancer
           
private  boolean doFillHoles
          Flag to enable hole filling.
private  boolean doMorphOps
          Flag to enable/disable morphological pre-/postprocessing.
private  boolean doNucleiSeparation
          Flag to enable separation of merged nuclei regions.
private  MTBImageShort inImg
          Reference to original image, for internal use only
private  MTBImage inImgOrig
          Input image to process.
private  SegResultEnums.MeasureUnit measureUnits
          Units to be used for measurements.
private  int minNucleusSize
          Minimal size of valid nuclei regions.
private  int morphMaskSize
          Mask size to be used in morphological pre-/postprocessing.
private  ImgThreshNiblack niblackOperator
          Niblack operator, required if mode is 'NIBLACK'.
private  NucleusSeparator2D nucleusSepOp
          Operator to be applied for nuclei separation.
private  NucleusDetector2D.NuclDetectMode opMode
          Detection mode.
private  SegResult_Nuclei resultData
          Result data object containing quantitative data and label images.
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
NucleusDetector2D()
          Default constructor.
NucleusDetector2D(MTBImage img, NucleusDetector2D.NuclDetectMode opmode, ImgThreshNiblack niblackOp, boolean doMorph, int msize, int minSize, boolean fillHoles)
          Constructor.
 
Method Summary
protected  MTBImageByte detectWithLocalContrastEnhancement()
          Detect nuclei by first improving image contrast.
protected  MTBImageByte detectWithNiblack()
          Detects nuclei based on Niblack thresholding.
protected  MTBImageByte detectWithOtsu_erodedilate()
          Detects nuclei based on Otsu thresholding and a combination of erosion/ dilation.
protected  MTBImageByte detectWithOtsu_openclose()
          Detects nuclei based on Otsu thresholding and a combination of opening and closing.
 SegResult_Nuclei getResultData()
          Get the result data, i.e. mask and related quantitative data.
 MTBImage getResultImage()
          Get the result label image.
protected  void operate()
           
 void setInputImage(MTBImage img)
          Specify input image.
 void setMeasureUnits(SegResultEnums.MeasureUnit mu)
          Specify units in which to measure areas.
 
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

contrastEnhancer

@Parameter(label="Operator for local contrast improvement",
           required=false,
           dataIOOrder=1,
           direction=IN,
           description="Applied in mode CONTRAST_ANALYSIS.")
private LocallyAdaptiveContrastEnhancement contrastEnhancer

doFillHoles

@Parameter(label="Fill holes",
           required=false,
           dataIOOrder=-6,
           direction=IN,
           description="Fill holes in regions.")
private boolean doFillHoles
Flag to enable hole filling.


doMorphOps

@Parameter(label="Apply morphological operations",
           required=false,
           direction=IN,
           description="Apply morphological operations.",
           dataIOOrder=-9)
private boolean doMorphOps
Flag to enable/disable morphological pre-/postprocessing.

Flag is only active if mode is not 'NIBLACK'.


doNucleiSeparation

@Parameter(label="Try Nuclei Separation",
           required=false,
           dataIOOrder=2,
           direction=IN,
           description="Apply nuclei separator to split merged regions.")
private boolean doNucleiSeparation
Flag to enable separation of merged nuclei regions.


inImg

private transient MTBImageShort inImg
Reference to original image, for internal use only


inImgOrig

@Parameter(label="Input image",
           required=true,
           direction=IN,
           description="Input image.",
           dataIOOrder=-10)
private transient MTBImage inImgOrig
Input image to process.


measureUnits

@Parameter(label="Units",
           required=false,
           mode=ADVANCED,
           direction=IN,
           dataIOOrder=100,
           description="Units for area measurements.")
private SegResultEnums.MeasureUnit measureUnits
Units to be used for measurements.


minNucleusSize

@Parameter(label="Min. nuclei size",
           required=false,
           dataIOOrder=-11,
           direction=IN,
           description="Minimum size of valid nuclei.")
private int minNucleusSize
Minimal size of valid nuclei regions.


morphMaskSize

@Parameter(label="Masksize",
           required=false,
           dataIOOrder=-8,
           direction=IN,
           description="Structuring element size.")
private int morphMaskSize
Mask size to be used in morphological pre-/postprocessing.


niblackOperator

@Parameter(label="Niblack operator",
           required=false,
           dataIOOrder=-1,
           direction=IN,
           description="Niblack thresholder.")
private ImgThreshNiblack niblackOperator
Niblack operator, required if mode is 'NIBLACK'.


nucleusSepOp

@Parameter(label="Nuclei Separator",
           required=false,
           dataIOOrder=4,
           direction=IN,
           description="Operator for nuclei region splitting.")
private NucleusSeparator2D nucleusSepOp
Operator to be applied for nuclei separation.


opMode

@Parameter(label="Operator mode",
           required=true,
           dataIOOrder=-9,
           direction=IN,
           description="Operator detection mode.")
private NucleusDetector2D.NuclDetectMode opMode
Detection mode.


resultData

@Parameter(label="Result statistics",
           direction=OUT,
           description="Quantitative result data.")
private transient SegResult_Nuclei resultData
Result data object containing quantitative data and label images.

Constructor Detail

NucleusDetector2D

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

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

NucleusDetector2D

public NucleusDetector2D(MTBImage img,
                         NucleusDetector2D.NuclDetectMode opmode,
                         ImgThreshNiblack niblackOp,
                         boolean doMorph,
                         int msize,
                         int minSize,
                         boolean fillHoles)
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor.

Parameters:
img - Image to be processed.
opmode - Detection mode.
niblackOp - Optional Niblack operator for mode 'NIBLACK'.
doMorph - Flag to enable/disable morphological processing.
msize - Size of structuring element in pre-/postprocessing.
minSize - Minimum size of valid nuclei.
fillHoles - Flag to enable/disable hole filling.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

detectWithLocalContrastEnhancement

protected MTBImageByte detectWithLocalContrastEnhancement()
                                                   throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                                          de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Detect nuclei by first improving image contrast.

Returns:
Label image with detected nuclei.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

detectWithNiblack

protected MTBImageByte detectWithNiblack()
                                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                         de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Detects nuclei based on Niblack thresholding.

Returns:
Label image with detected nuclei.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

detectWithOtsu_erodedilate

protected MTBImageByte detectWithOtsu_erodedilate()
                                           throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                                  de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Detects nuclei based on Otsu thresholding and a combination of erosion/ dilation.

This routine has been developed by Jochen Luechtrath for nuclei/cytoplasm segmentation.

Returns:
Label image with detected nuclei.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

detectWithOtsu_openclose

protected MTBImageByte detectWithOtsu_openclose()
                                         throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                                de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Detects nuclei based on Otsu thresholding and a combination of opening and closing.

Returns:
Label image with detected nuclei.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

getResultData

public SegResult_Nuclei getResultData()
Get the result data, i.e. mask and related quantitative data.

Returns:
Result data object.

getResultImage

public MTBImage getResultImage()
Get the result label image.

Returns:
Reference to result label image, might be null.

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

setInputImage

public void setInputImage(MTBImage img)
Specify input image.


setMeasureUnits

public void setMeasureUnits(SegResultEnums.MeasureUnit mu)
Specify units in which to measure areas.