de.unihalle.informatik.MiToBo.segmentation.evaluation
Class CalcStructureStatistics

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

public class CalcStructureStatistics
extends MTBOperator

Extracts statistics from cell and structure segmentation results.

For each structure region a corresponding region in the given cell segmentation result is detected and the structure region assigned to it. Note that structure regions along image borders are ignored. In addition, optionally also regions in given nuclei regions might be excluded if a mask with detected nuclei regions is available.

In parts the code of this file has been copied from Oliver's tool 'EvalParticleDetection'. However, this class is more generic in the sense that only a single cell segmentation result and a single structure segmentation result are processed on call of this tool.

Author:
moeller

Nested Class Summary
static class CalcStructureStatistics.StructureCountMode
          Mode how to assign structures to cell regions.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  MTBImageByte cellLabelImg
          Label image of cell areas.
private  CalcStructureStatistics.StructureCountMode countMode
          Mode for assigning structures to regions.
private  java.util.HashMap<java.lang.Integer,MTBRegion2DSet> cparticles
           
private  int height
           
private  boolean ignoreStructsAtBorder
          Flag to ignore structures along border.
private  boolean ignoreStructsInNuclei
           
private  int minStructureSize
          Minimal size of structure regions to be considered.
private  MTBImageByte nucleiMask
          Nuclei mask.
private  java.util.HashMap<java.lang.Integer,java.lang.Double> resultDataAreaFractions
          Result data: area fractions.
private  java.util.HashMap<java.lang.Integer,java.lang.Double> resultDataAvgSize
          Result data: average size.
private  java.util.HashMap<java.lang.Integer,java.lang.Integer> resultDataCellSizes
          Result data: cell sizes.
private  java.util.HashMap<java.lang.Integer,java.lang.Integer> resultDataCounts
          Result data: counts.
private  java.util.HashMap<java.lang.Integer,java.lang.Integer> resultDataTotalSize
          Result data: total structure size per cell.
private  MTBImageByte structureMask
          Structure mask.
private  int width
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
protected CalcStructureStatistics()
          Default constructor.
  CalcStructureStatistics(MTBImageByte sMask, MTBImageByte nMask, MTBImageByte labelImg)
          Default constructor.
  CalcStructureStatistics(MTBImageByte sMask, MTBImageByte nMask, MTBImageByte labelImg, boolean ignoreNuclei)
          Deprecated. 
 
Method Summary
private  void assignStructsToCell_com(MTBRegion2DSet regs)
          Assigns the given set of structure regions to individual cells.
private  void assignStructsToCell_overlap(MTBRegion2DSet regions)
          Assigns the given set of structure regions to individual cells.
 java.util.HashMap<java.lang.Integer,java.lang.Double> getResultDataAreaFractions()
          Returns result data object with area fractions per cell.
 java.util.HashMap<java.lang.Integer,java.lang.Double> getResultDataAvgSize()
          Returns result data object with average size per cell.
 java.util.HashMap<java.lang.Integer,java.lang.Integer> getResultDataCellSizes()
          Returns result data object with areas per cell.
 java.util.HashMap<java.lang.Integer,java.lang.Integer> getResultDataCounts()
          Returns result data object with counts per cell.
 java.util.HashMap<java.lang.Integer,java.lang.Integer> getResultDataTotalSize()
          Returns result data object with total structure size per cell.
protected  void operate()
           
 void setCountMode(CalcStructureStatistics.StructureCountMode m)
          Specify mode how to assign structures to cells.
 void setIgnoreBorderFlag(boolean f)
          Set flag to include/ignore structures along image border.
 void setMinimalRegionSize(int minsize)
          Specify minimal size of regions considered.
 
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

cellLabelImg

@Parameter(label="cellLabelImg",
           required=true,
           direction=IN,
           description="Label image of cell areas.")
private MTBImageByte cellLabelImg
Label image of cell areas.


countMode

@Parameter(label="countMode",
           required=false,
           direction=IN,
           description="Mode for assigning structures to regions.")
private CalcStructureStatistics.StructureCountMode countMode
Mode for assigning structures to regions.


cparticles

private java.util.HashMap<java.lang.Integer,MTBRegion2DSet> cparticles

height

private int height

ignoreStructsAtBorder

@Parameter(label="ignoreStructsAtBorder",
           required=false,
           direction=IN,
           description="Flag for ignoring structures along image border.")
private boolean ignoreStructsAtBorder
Flag to ignore structures along border.


ignoreStructsInNuclei

private boolean ignoreStructsInNuclei

minStructureSize

@Parameter(label="minStructureSize",
           required=false,
           direction=IN,
           description="Minimal size of structure regions to be considered.")
private int minStructureSize
Minimal size of structure regions to be considered.


nucleiMask

@Parameter(label="nucleiMask",
           required=false,
           direction=IN,
           description="Binary mask of nuclei.")
private MTBImageByte nucleiMask
Nuclei mask.


resultDataAreaFractions

@Parameter(label="resultDataAreaFractions",
           required=true,
           direction=OUT,
           description="Result data for area fraction per cell.")
private java.util.HashMap<java.lang.Integer,java.lang.Double> resultDataAreaFractions
Result data: area fractions.


resultDataAvgSize

@Parameter(label="resultDataAvgSize",
           required=true,
           direction=OUT,
           description="Result data for average size per cell.")
private java.util.HashMap<java.lang.Integer,java.lang.Double> resultDataAvgSize
Result data: average size.


resultDataCellSizes

@Parameter(label="resultDataCellSizes",
           required=true,
           direction=OUT,
           description="Result data for size per cell.")
private java.util.HashMap<java.lang.Integer,java.lang.Integer> resultDataCellSizes
Result data: cell sizes.


resultDataCounts

@Parameter(label="resultDataCounts",
           required=true,
           direction=OUT,
           description="Result data for counts per cell.")
private java.util.HashMap<java.lang.Integer,java.lang.Integer> resultDataCounts
Result data: counts.


resultDataTotalSize

@Parameter(label="resultDataTotalSize",
           required=true,
           direction=OUT,
           description="Result data for total structure size per cell.")
private java.util.HashMap<java.lang.Integer,java.lang.Integer> resultDataTotalSize
Result data: total structure size per cell.


structureMask

@Parameter(label="structureMask",
           required=true,
           direction=IN,
           description="Binary mask of structures.")
private MTBImageByte structureMask
Structure mask.


width

private int width
Constructor Detail

CalcStructureStatistics

protected CalcStructureStatistics()
                           throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Default constructor.

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

CalcStructureStatistics

public CalcStructureStatistics(MTBImageByte sMask,
                               MTBImageByte nMask,
                               MTBImageByte labelImg)
                        throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Default constructor.

Parameters:
sMask - Binary mask of detected structures.
nMask - Binary mask of detected nuclei.
labelImg - Label image of detected cell areas.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

CalcStructureStatistics

@Deprecated
public CalcStructureStatistics(MTBImageByte sMask,
                                          MTBImageByte nMask,
                                          MTBImageByte labelImg,
                                          boolean ignoreNuclei)
                        throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Deprecated. 

Default constructor.

Parameters:
sMask - Binary mask of detected structures.
nMask - Binary mask of detected nuclei.
labelImg - Label image of detected cell areas.
ignoreNuclei - Flag for ignoring nuclei regions.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

assignStructsToCell_com

private void assignStructsToCell_com(MTBRegion2DSet regs)
Assigns the given set of structure regions to individual cells.

For the assignment the center of mass of each region is calculated and the corresponding cell region chosen according to its location.


assignStructsToCell_overlap

private void assignStructsToCell_overlap(MTBRegion2DSet regions)
Assigns the given set of structure regions to individual cells.

For the assignment the overlap of each region to all cell regions is calculated and the cell with largest overlap is chosen as corresponding cell region.


getResultDataAreaFractions

public java.util.HashMap<java.lang.Integer,java.lang.Double> getResultDataAreaFractions()
Returns result data object with area fractions per cell.


getResultDataAvgSize

public java.util.HashMap<java.lang.Integer,java.lang.Double> getResultDataAvgSize()
Returns result data object with average size per cell.


getResultDataCellSizes

public java.util.HashMap<java.lang.Integer,java.lang.Integer> getResultDataCellSizes()
Returns result data object with areas per cell.


getResultDataCounts

public java.util.HashMap<java.lang.Integer,java.lang.Integer> getResultDataCounts()
Returns result data object with counts per cell.


getResultDataTotalSize

public java.util.HashMap<java.lang.Integer,java.lang.Integer> getResultDataTotalSize()
Returns result data object with total structure size per cell.


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

setCountMode

public void setCountMode(CalcStructureStatistics.StructureCountMode m)
Specify mode how to assign structures to cells.


setIgnoreBorderFlag

public void setIgnoreBorderFlag(boolean f)
Set flag to include/ignore structures along image border.


setMinimalRegionSize

public void setMinimalRegionSize(int minsize)
Specify minimal size of regions considered.