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

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

@ALDAOperator(genericExecutionMode=ALL)
@ALDDerivedClass
public class NucleusSeparator2DBeamCut
extends NucleusSeparator2DAlgos

Class provides routines for separating conglomerates of cell nuclei in 2D.

This operator is not supposed to be directly executed in a generic fashion. Use the operator NucleusSeparator2D instead.

Author:
posch

Nested Class Summary
static class NucleusSeparator2DBeamCut.NuclSeparateMode
          Available modes for nuclei separation 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  int debug
           
private  boolean doErosion
           
private  int erodeSize
           
private  int minSize
           
private  double minSizeFraction
           
private  NucleusSeparator2DBeamCut.NuclSeparateMode opMode
          Operation mode of this separator.
private  int sizeDilation
           
private  int sizeOpening
           
private  int sizeTH
           
private  double thresTH
           
(package private)  MTBImage tmpImg
          temp. binary image
 
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
NucleusSeparator2DBeamCut()
          Default constructor
NucleusSeparator2DBeamCut(MTBImage labelImg)
          Constructor.
NucleusSeparator2DBeamCut(MTBImage labelImg, NucleusSeparator2DBeamCut.NuclSeparateMode opMode)
          Constructor.
 
Method Summary
private  double[] dilate1D(double[] x, int size)
           
private  double[] erode1D(double[] x, int size)
           
private  void erodeComponent(int label, int size)
          erode one component with given label
private  int[] estimateMean(int label)
          Suche nach bestem Mittelpunkt des Embryos: ueberpruefe kreisfoermige Raster (8 Punkte +Mittelpunkt des Bildes) um Bildmittelpunkt aus Kriterium: max. min.
private  double euklidDist(double x1, double y1, double x2, double y2)
          Hilfsmethode zur Bestimmung der euklidischen Distanz zw. 2 Punkten
private  double[] getCentroid(MTBImage img, int label)
          auxiliary method to determine the centroid (x,y) and width/heigth of compoment with label in a double array of length 4 (should go in class/record)
 int getDebug()
          Get value of debug.
 boolean getDoErosion()
          Get value of doErosion.
 int getErodeSize()
          Get value of erodeSize.
 MTBImage getLabelImg()
          Get value of labelImg.
 int getMinSize()
          Get value of minSize.
 double getMinSizeFraction()
          Get value of minSizeFraction.
 NucleusSeparator2DBeamCut.NuclSeparateMode getOpMode()
          Get value of opMode.
private  int getSize(int label)
           
 int getSizeDilation()
          Get value of sizeDilation.
 int getSizeOpening()
          Get value of sizeOpening.
 int getSizeTH()
          Get value of sizeTH.
 double getThresTH()
          Get value of thresTH.
private  void keepLargestCC(MTBImage img, int label)
          remove all but the largest connected component with label
private  double[] open1D(double[] x, int size)
           
protected  void operate()
           
private  int resetLabel(int fromLabel, int toLabel)
           
private  int separate(int label, int nextLabel)
          try to separate component with label 2.
 void setDebug(int value)
          Set value of debug.
 void setDoErosion(boolean value)
          Set value of doErosion.
 void setErodeSize(int value)
          Set value of erodeSize.
 void setLabelImg(MTBImage value)
          Set value of labelImg.
 void setMinSize(int value)
          Set value of minSize.
 void setMinSizeFraction(double value)
          Set value of minSizeFraction.
 void setOpMode(NucleusSeparator2DBeamCut.NuclSeparateMode value)
          Set value of opMode.
 void setSizeDilation(int value)
          Set value of sizeDilation.
 void setSizeOpening(int value)
          Set value of sizeOpening.
 void setSizeTH(int value)
          Set value of sizeTH.
 void setThresTH(double value)
          Set value of thresTH.
private  double[] topHat1D(double[] x, int size)
           
 
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

debug

@Parameter(label="Debug mode.",
           required=false,
           direction=IN,
           supplemental=true,
           description="Flag for debugging output.")
private int debug

doErosion

@Parameter(label="Do erosion",
           required=false,
           direction=IN,
           description="Erode each nucleus resulting from a separation.")
private boolean doErosion

erodeSize

@Parameter(label="Erode mask size",
           required=false,
           direction=IN,
           description="Size of structuring element for eroding a nucleus from a separation.")
private int erodeSize

minSize

@Parameter(label="Minimum nuclei size",
           required=false,
           direction=IN,
           description="Minimum size of each nucleus after separation, otherwise undo separation")
private int minSize

minSizeFraction

@Parameter(label="Minimum fraction size",
           required=false,
           direction=IN,
           description="Minimum size fraction of each nucleus after separation, otherwise undo separation.")
private double minSizeFraction

opMode

@Parameter(label="Operator mode",
           required=true,
           direction=IN,
           description="Operator separation mode.")
private NucleusSeparator2DBeamCut.NuclSeparateMode opMode
Operation mode of this separator.


sizeDilation

@Parameter(label="Dilation mask size",
           required=false,
           direction=IN,
           description="Size of structuring element for dilation on cutpoint hypotheses.")
private int sizeDilation

sizeOpening

@Parameter(label="Opening mask size",
           required=false,
           direction=IN,
           description="Size of structuring element for opening on cutpoint hypotheses.")
private int sizeOpening

sizeTH

@Parameter(label="Tophat size",
           required=false,
           direction=IN,
           description="Size of structuring element for top hat on distances.")
private int sizeTH

thresTH

@Parameter(label="Tophat threshold",
           required=false,
           direction=IN,
           description="Threshold for result from top hat.")
private double thresTH

tmpImg

transient MTBImage tmpImg
temp. binary image

Constructor Detail

NucleusSeparator2DBeamCut

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

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

NucleusSeparator2DBeamCut

public NucleusSeparator2DBeamCut(MTBImage labelImg)
                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor.

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

NucleusSeparator2DBeamCut

public NucleusSeparator2DBeamCut(MTBImage labelImg,
                                 NucleusSeparator2DBeamCut.NuclSeparateMode opMode)
                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor.

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

dilate1D

private double[] dilate1D(double[] x,
                          int size)

erode1D

private double[] erode1D(double[] x,
                         int size)

erodeComponent

private void erodeComponent(int label,
                            int size)
                     throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                            de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
erode one component with given label

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

estimateMean

private int[] estimateMean(int label)
Suche nach bestem Mittelpunkt des Embryos: ueberpruefe kreisfoermige Raster (8 Punkte +Mittelpunkt des Bildes) um Bildmittelpunkt aus Kriterium: max. min. Abstand zum Embryorand

Returns:
int[]

euklidDist

private double euklidDist(double x1,
                          double y1,
                          double x2,
                          double y2)
Hilfsmethode zur Bestimmung der euklidischen Distanz zw. 2 Punkten

Parameters:
x1 - double
y1 - double
x2 - double
y2 - double
Returns:
double

getCentroid

private double[] getCentroid(MTBImage img,
                             int label)
auxiliary method to determine the centroid (x,y) and width/heigth of compoment with label in a double array of length 4 (should go in class/record)

Parameters:
img -
label -
Returns:
double[]

getDebug

public int getDebug()
Get value of debug. Explanation: Flag for debugging output..

Returns:
value of debug

getDoErosion

public boolean getDoErosion()
Get value of doErosion. Explanation: Erode each nucleus resulting from a separation.

Returns:
value of doErosion

getErodeSize

public int getErodeSize()
Get value of erodeSize. Explanation: Size of structuring element for eroding a nucleus from a separation.

Returns:
value of erodeSize

getLabelImg

public MTBImage getLabelImg()
Get value of labelImg. Explanation: Label input image of nuclei.

Returns:
value of labelImg

getMinSize

public int getMinSize()
Get value of minSize. Explanation: Minimum size of ????.

Returns:
value of minSize

getMinSizeFraction

public double getMinSizeFraction()
Get value of minSizeFraction. Explanation: ??? Minimum size of ????.

Returns:
value of minSizeFraction

getOpMode

public NucleusSeparator2DBeamCut.NuclSeparateMode getOpMode()
Get value of opMode. Explanation: Operator sepration mode.

Returns:
value of opMode

getSize

private int getSize(int label)

getSizeDilation

public int getSizeDilation()
Get value of sizeDilation. Explanation: Size of structuring element for dilation.

Returns:
value of sizeDilation

getSizeOpening

public int getSizeOpening()
Get value of sizeOpening. Explanation: Size of structuring element for opening.

Returns:
value of sizeOpening

getSizeTH

public int getSizeTH()
Get value of sizeTH. Explanation: Size of structuring element for tophat.

Returns:
value of sizeTH

getThresTH

public double getThresTH()
Get value of thresTH. Explanation: Threshold for result from tophat.

Returns:
value of thresTH

keepLargestCC

private void keepLargestCC(MTBImage img,
                           int label)
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                           de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
remove all but the largest connected component with label
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

open1D

private double[] open1D(double[] x,
                        int size)

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

resetLabel

private int resetLabel(int fromLabel,
                       int toLabel)

separate

private int separate(int label,
                     int nextLabel)
              throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                     de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
try to separate component with label 2. Mittelpunktschaetzung: Details in Methode unten 3. kreisfoermige Abtastung des Embryos mit Strahlen und Berechnung von 360 Schnittpunkten zw. Strahl und Embryorand 4. euklid. Differenz zwischen benachbarten Schnittpunkten berechnen und daraus relevante Schnittpunkte als Abtrennpunkte erkennen 5. Fallunterscheidung je nach Anzahl der gefundenen Trennpunkte

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

setDebug

public void setDebug(int value)
Set value of debug. Explanation: Flag for debugging output..

Parameters:
value - New value of debug

setDoErosion

public void setDoErosion(boolean value)
Set value of doErosion. Explanation: Erode each nucleus resulting from a separation.

Parameters:
value - New value of doErosion

setErodeSize

public void setErodeSize(int value)
Set value of erodeSize. Explanation: Size of structuring element for eroding a nucleus from a separation.

Parameters:
value - New value of erodeSize

setLabelImg

public void setLabelImg(MTBImage value)
Set value of labelImg. Explanation: Label input image of nuclei.

Parameters:
value - New value of labelImg

setMinSize

public void setMinSize(int value)
Set value of minSize. Explanation: Minimum size of ????.

Parameters:
value - New value of minSize

setMinSizeFraction

public void setMinSizeFraction(double value)
Set value of minSizeFraction. Explanation: ??? Minimum size of ????.

Parameters:
value - New value of minSizeFraction

setOpMode

public void setOpMode(NucleusSeparator2DBeamCut.NuclSeparateMode value)
Set value of opMode. Explanation: Operator sepration mode.

Parameters:
value - New value of opMode

setSizeDilation

public void setSizeDilation(int value)
Set value of sizeDilation. Explanation: Size of structuring element for dilation.

Parameters:
value - New value of sizeDilation

setSizeOpening

public void setSizeOpening(int value)
Set value of sizeOpening. Explanation: Size of structuring element for opening.

Parameters:
value - New value of sizeOpening

setSizeTH

public void setSizeTH(int value)
Set value of sizeTH. Explanation: Size of structuring element for tophat.

Parameters:
value - New value of sizeTH

setThresTH

public void setThresTH(double value)
Set value of thresTH. Explanation: Threshold for result from tophat.

Parameters:
value - New value of thresTH

topHat1D

private double[] topHat1D(double[] x,
                          int size)