de.unihalle.informatik.MiToBo.apps.neurites2D
Class NeuriteDetector2D

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

@ALDAOperator(genericExecutionMode=ALL,
              level=APPLICATION,
              allowBatchMode=false)
public class NeuriteDetector2D
extends MTBOperator

The Neurite Detector 2D application offers advanced functionality to detect neurites in 2D fluorescence microscope images of neurons. Neuron boundaries are coarsely detected and refined, using active contour models (snakes). Structural neuron parts, like soma, neurites and growth cones are identified, using an wavelet based detection. Morphology analysis of the detected neurites is performed and an collection of all measurements is visualized in the result table. Intermediate and final results are automatically saved and the results are stored in a result image and presented in a final result table. The specific algorithms can be found in the `NeuriteDetector2DAlgos` class.

Author:
Danny Misiak
See Also:
NeuriteDetector2DAlgos

Nested Class Summary
static class NeuriteDetector2D.NeuriteDetector2DMode
          Different detection modes.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  double alpha
           
private  java.util.Vector<java.lang.String> analyzedImages
          Vector with all analyzed image files.
private  double beta
           
(package private) static de.unihalle.informatik.Alida.datatypes.ALDDirectoryString currentInput
          Get initial directory from environment configuration.
private  java.util.Vector<MTBNeurite2DSet> detectedNeurites
          Vector of detected neurite sets for each image.
private  MTBTableModel detectionResultTable
           
private  NeuriteDetector2D.NeuriteDetector2DMode detectorMode
           
private  NeuriteDetector2DAlgos.DetectorExternalEnergy energy
           
private  java.util.Vector<java.lang.String> imageFiles
          Vector with all image files included in the experiment folder for detection.
private  de.unihalle.informatik.Alida.datatypes.ALDDirectoryString inputDir
          Define detector parameters.
private  int maxFragmentDistance
           
private  int maxIterations
           
private  int maxSpineLength
           
private  double motionFraction
           
protected  java.awt.Color neuriteColor
           
private  int neuriteMaskSize
           
private  java.lang.Integer[] neuronChannels
           
private  double niblackConstant
           
private  java.lang.Integer nucleiChannel
           
private  java.lang.Double nucleusRatio
           
private  java.lang.Integer nucleusSize
           
private  java.lang.String outputDir
          Directory of output results.
private  org.rosuda.JRI.Rengine rEngine
          JRI R engine to run R as a single thread.
private  int resampleConstant
           
private  double stepSize
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
NeuriteDetector2D()
          Standard constructor.
NeuriteDetector2D(java.lang.String _inputDir, java.lang.Integer _nucleiChannel, int _nucleusSize, double _nucleusRation, java.lang.Integer[] _neuronChannels, double _niblackConstant, int _maxFragmentDistance, NeuriteDetector2D.NeuriteDetector2DMode _detectorMode, NeuriteDetector2DAlgos.DetectorExternalEnergy _energy, double _alpha, double _beta, double _stepSize, double _motionFraction, int _maxIterations, int _resampleConstant, int _maxSpineLength, int _neuriteMaskSize, java.awt.Color _neuriteColor, java.lang.Boolean _verbose)
          Constructor
 
Method Summary
private  org.rosuda.JRI.Rengine createRengine()
          Method to generate a R thread inside the java application.
private  void createResultDir(java.lang.String file)
          Create directory where all results will be stored.
 double getAlpha()
          Get snake length term weight alpha.
 java.util.Vector<java.lang.String> getAnalyzedImages()
          Get vector of analyzed images.
 double getBeta()
          Get snake curvature term weight beta.
private  java.lang.String getDate()
          Get current date for result dirs.
 java.util.Vector<MTBNeurite2DSet> getDetectedNeurites()
          Get vector of detected neurite sets for each image.
 NeuriteDetector2D.NeuriteDetector2DMode getDetectorMode()
          Get current detector mode.
 NeuriteDetector2DAlgos.DetectorExternalEnergy getEnergy()
          Get external snake energy label.
 java.util.Vector<java.lang.String> getImageFiles()
          Get vector of all image files included in the experiment folder for detection.
 de.unihalle.informatik.Alida.datatypes.ALDDirectoryString getInputDir()
          Get directory of input images.
 int getMaxFragmentDistance()
          Get maximum neuron fragment distance in pixel.
 int getMaxIterations()
          Get maximum number of iterations to stop detection.
 int getMaxSpineLength()
          Get maximum length of a spine (filopodia-like protrusion) in pixel.
 double getMotionFraction()
          Get minimum fraction of point motion to stop detection.
 java.awt.Color getNeuriteColor()
          Get neurite region color (RGB) for result image.
 int getNeuriteMaskSize()
          Get neurite mask size in pixel.
 java.lang.Integer[] getNeuronChannles()
          Get neuron channels, used for detection.
 double getNiblackConstant()
          Get niblack constant.
 java.lang.Integer getNucleiChannel()
          Get image channel of nuclei.
 double getNucleusRatio()
          Get ratio of nucleus pixels which should be included in an intact neuron region
 int getNucleusSize()
          Get minimum nucleus size of nuclei regions
 java.lang.String getOutputDir()
          Get directory of output results.
 org.rosuda.JRI.Rengine getREngine()
          Get JRI R engine to run R as a single thread.
 int getResampleConstant()
          Get snake point resampling constant.
 MTBTableModel getResultTable()
          Get the result table of the detected neurites.
 double getStepSize()
          Get step size of snake movement.
private  void init()
          Initialization method.
private  MTBTableModel makeTable()
          Create the result table and include the specific table header.
protected  void operate()
           
private  boolean startDetectionMode()
          Method to start neurite detection mode with presegmentation, active contours and wavelet based neuron component detection.
 void validateCustom()
          Custom validation of some input parameters.
 
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, 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

alpha

@Parameter(label="Alpha",
           required=true,
           direction=IN,
           description="Weighting factor for snake length term.",
           mode=ADVANCED,
           dataIOOrder=11)
private double alpha

analyzedImages

private transient java.util.Vector<java.lang.String> analyzedImages
Vector with all analyzed image files.


beta

@Parameter(label="Beta",
           required=true,
           direction=IN,
           description="Weighting factor for snake curvature term.",
           mode=ADVANCED,
           dataIOOrder=12)
private double beta

currentInput

static de.unihalle.informatik.Alida.datatypes.ALDDirectoryString currentInput
Get initial directory from environment configuration.


detectedNeurites

private transient java.util.Vector<MTBNeurite2DSet> detectedNeurites
Vector of detected neurite sets for each image.


detectionResultTable

@Parameter(label="Detection Result Table",
           direction=OUT,
           required=true,
           description="Table of detection results.")
private transient MTBTableModel detectionResultTable

detectorMode

@Parameter(label="Detector Mode",
           required=true,
           direction=IN,
           description="Mode of neurite detector.",
           mode=ADVANCED,
           dataIOOrder=9)
private NeuriteDetector2D.NeuriteDetector2DMode detectorMode

energy

@Parameter(label="External Energy",
           direction=IN,
           required=true,
           description="External energy label for detection.",
           mode=ADVANCED,
           dataIOOrder=10)
private NeuriteDetector2DAlgos.DetectorExternalEnergy energy

imageFiles

private transient java.util.Vector<java.lang.String> imageFiles
Vector with all image files included in the experiment folder for detection.


inputDir

@Parameter(label="Input Directory",
           direction=IN,
           required=true,
           description="Directory of input images.",
           mode=STANDARD,
           dataIOOrder=0)
private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString inputDir
Define detector parameters.


maxFragmentDistance

@Parameter(label="Maximum Fragment Distance",
           required=true,
           direction=IN,
           description="Maximum distance of neuron frgaments in pixel.",
           mode=ADVANCED,
           dataIOOrder=7)
private int maxFragmentDistance

maxIterations

@Parameter(label="Maximum Iterations",
           required=true,
           direction=IN,
           description="Maximum iteration count to stop optimization.",
           mode=ADVANCED,
           dataIOOrder=16)
private int maxIterations

maxSpineLength

@Parameter(label="Maximum Spine Length",
           required=true,
           direction=IN,
           description="Maximum length of a spine in pixel.",
           mode=STANDARD,
           dataIOOrder=5)
private int maxSpineLength

motionFraction

@Parameter(label="Motion Fraction",
           required=true,
           direction=IN,
           description="Fraction of minimum point motion to stop detection in percent.",
           mode=ADVANCED,
           dataIOOrder=15)
private double motionFraction

neuriteColor

@Parameter(label="Neurite Color",
           supplemental=true,
           direction=IN,
           description="Color of neurite regions in result image.")
protected java.awt.Color neuriteColor

neuriteMaskSize

@Parameter(label="Neurite Mask Size",
           required=true,
           direction=IN,
           description="Neurite mask size in pixel.",
           mode=ADVANCED,
           dataIOOrder=6)
private int neuriteMaskSize

neuronChannels

@Parameter(label="Neuron Channels",
           direction=IN,
           required=true,
           description="Channels which stain the neurons for detection.",
           mode=STANDARD,
           dataIOOrder=4)
private java.lang.Integer[] neuronChannels

niblackConstant

@Parameter(label="Niblack Constant",
           required=true,
           direction=IN,
           description="Niblack threshold constant.",
           mode=ADVANCED,
           dataIOOrder=8)
private double niblackConstant

nucleiChannel

@Parameter(label="Nuclei Channel",
           direction=IN,
           required=true,
           description="Image channel including nuclei (1 labels first channel).",
           mode=STANDARD,
           dataIOOrder=1)
private java.lang.Integer nucleiChannel

nucleusRatio

@Parameter(label="Nucleus Ratio",
           direction=IN,
           required=true,
           description="Ratio of nucleus pixels which should be included in an intact neuron region in percent.",
           mode=ADVANCED,
           dataIOOrder=3)
private java.lang.Double nucleusRatio

nucleusSize

@Parameter(label="Nucleus Size",
           direction=IN,
           required=true,
           description="Minimum size of nuclei regions in pixel.",
           mode=ADVANCED,
           dataIOOrder=2)
private java.lang.Integer nucleusSize

outputDir

private transient java.lang.String outputDir
Directory of output results.


rEngine

private transient org.rosuda.JRI.Rengine rEngine
JRI R engine to run R as a single thread.


resampleConstant

@Parameter(label="Resample Constant",
           required=true,
           direction=IN,
           description="Snake point resampling constant.",
           mode=ADVANCED,
           dataIOOrder=14)
private int resampleConstant

stepSize

@Parameter(label="Step Size",
           required=true,
           direction=IN,
           description="Step size of snake movement.",
           mode=ADVANCED,
           dataIOOrder=13)
private double stepSize
Constructor Detail

NeuriteDetector2D

public NeuriteDetector2D()
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Standard constructor.

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

NeuriteDetector2D

public NeuriteDetector2D(java.lang.String _inputDir,
                         java.lang.Integer _nucleiChannel,
                         int _nucleusSize,
                         double _nucleusRation,
                         java.lang.Integer[] _neuronChannels,
                         double _niblackConstant,
                         int _maxFragmentDistance,
                         NeuriteDetector2D.NeuriteDetector2DMode _detectorMode,
                         NeuriteDetector2DAlgos.DetectorExternalEnergy _energy,
                         double _alpha,
                         double _beta,
                         double _stepSize,
                         double _motionFraction,
                         int _maxIterations,
                         int _resampleConstant,
                         int _maxSpineLength,
                         int _neuriteMaskSize,
                         java.awt.Color _neuriteColor,
                         java.lang.Boolean _verbose)
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor

Parameters:
_inputDir - input directory with multichannel fluorescence images
_nucleiChannel - channel number including nuclei image
_nucleusSize - minimum size of nucleus region
_nucleusRation - ratio of nucleus pixels which should be included in an intact neuron region
_neuronChannels - channel numbers including neuron stains for detection
_niblackConstant - constant for niblack thresholding
_maxFragmentDistance - maximum distance to connect a fragment to the neuron, in pixel
_detectorMode - mode of neurite detection
_energy - label of available external energies for detection using snakes
_alpha - weighting factor for snake length term
_beta - weighting factor for snake curvature term
_stepSize - step size gamma to move snake in a optimization step
_motionFraction - minimum fraction of not moving points to stop optimization
_maxIterations - maximum iteration to stop optimization
_resampleConstant - constant for resampling snake control points
_maxSpineLength - maximum length of a branch to define it as spine, in pixel
_neuriteMaskSize - mask size of average neurite width, in pixel
_neuriteColor - color for neurite regions in result image
_verbose - flag for standard console outputs
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

createRengine

private org.rosuda.JRI.Rengine createRengine()
Method to generate a R thread inside the java application.

Returns:
Generated R engine.

createResultDir

private void createResultDir(java.lang.String file)
Create directory where all results will be stored. The directory is created in the directory where the image files are stored.

Parameters:
file - name of the current experiment (directory name where input images are stored)

getAlpha

public double getAlpha()
Get snake length term weight alpha.


getAnalyzedImages

public java.util.Vector<java.lang.String> getAnalyzedImages()
Get vector of analyzed images.

Returns:
Analyzed images.

getBeta

public double getBeta()
Get snake curvature term weight beta.


getDate

private java.lang.String getDate()
Get current date for result dirs.

Returns:
Current date.

getDetectedNeurites

public java.util.Vector<MTBNeurite2DSet> getDetectedNeurites()
Get vector of detected neurite sets for each image.

Returns:
Vector of neurite sets.

getDetectorMode

public NeuriteDetector2D.NeuriteDetector2DMode getDetectorMode()
Get current detector mode.


getEnergy

public NeuriteDetector2DAlgos.DetectorExternalEnergy getEnergy()
Get external snake energy label.


getImageFiles

public java.util.Vector<java.lang.String> getImageFiles()
Get vector of all image files included in the experiment folder for detection.

Returns:
Input images.

getInputDir

public de.unihalle.informatik.Alida.datatypes.ALDDirectoryString getInputDir()
Get directory of input images.


getMaxFragmentDistance

public int getMaxFragmentDistance()
Get maximum neuron fragment distance in pixel.


getMaxIterations

public int getMaxIterations()
Get maximum number of iterations to stop detection.


getMaxSpineLength

public int getMaxSpineLength()
Get maximum length of a spine (filopodia-like protrusion) in pixel.


getMotionFraction

public double getMotionFraction()
Get minimum fraction of point motion to stop detection.


getNeuriteColor

public java.awt.Color getNeuriteColor()
Get neurite region color (RGB) for result image.


getNeuriteMaskSize

public int getNeuriteMaskSize()
Get neurite mask size in pixel. This value defines the maximum average width of a neurite.


getNeuronChannles

public java.lang.Integer[] getNeuronChannles()
Get neuron channels, used for detection.


getNiblackConstant

public double getNiblackConstant()
Get niblack constant.


getNucleiChannel

public java.lang.Integer getNucleiChannel()
Get image channel of nuclei.


getNucleusRatio

public double getNucleusRatio()
Get ratio of nucleus pixels which should be included in an intact neuron region


getNucleusSize

public int getNucleusSize()
Get minimum nucleus size of nuclei regions


getOutputDir

public java.lang.String getOutputDir()
Get directory of output results.


getREngine

public org.rosuda.JRI.Rengine getREngine()
Get JRI R engine to run R as a single thread.


getResampleConstant

public int getResampleConstant()
Get snake point resampling constant.


getResultTable

public MTBTableModel getResultTable()
Get the result table of the detected neurites.

Returns:
Result table.

getStepSize

public double getStepSize()
Get step size of snake movement.


init

private void init()
Initialization method.


makeTable

private MTBTableModel makeTable()
Create the result table and include the specific table header.


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

startDetectionMode

private boolean startDetectionMode()
Method to start neurite detection mode with presegmentation, active contours and wavelet based neuron component detection.


validateCustom

public void validateCustom()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Custom validation of some input parameters.

Overrides:
validateCustom in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException