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

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.NeuriteExtractor2D
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDAOperator(genericExecutionMode=NONE,
              level=STANDARD,
              allowBatchMode=false)
public class NeuriteExtractor2D
extends MTBOperator

The Neurite Extractor 2D application offers advanced functionality to extract neurite regions in 2D binary neuron images of neurons. The neurites are separated from the soma. In addition, the borderlines between the soma and the neurite shafts, as well as between the neurite shaft and their growth cone is extracted. The exact localization of neurites without the soma (cell body) region is calculated via a wavelet based detection approach from the R script "MTBNeuriteFeatureDetection.R". Neurites are returned as MTBNeurite2D objects. Note: Don't know why operator cannot run twice without restart of MiToBo. Maybe a threading problem of the R engine.

Author:
Danny Misiak
See Also:
MTBNeuriteSkelGraph, MTBNeurite2DSet

Nested Class Summary
static class NeuriteExtractor2D.NeuronColor
          Color of binary neuron image foreground.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
NeuriteExtractor2D()
          Standard constructor.
NeuriteExtractor2D(MTBImageByte _neuronImage, NeuriteExtractor2D.NeuronColor _neuronColor, int _neuriteMaskSize, int _maxSpineLength, org.rosuda.JRI.Rengine _rEngine, String _outputDir)
          Constructor to create a new neurite extraction object.
 
Method Summary
 void cleanNeurites(MTBNeurite2DSet tmpNeuriteSet)
          Method to clean up the extracted neurites, due to multiple features along a NSG path or feature shifts at the start point due to different NSG lengths.
 MTBImageByte drawLine2D(Line2D.Double line, Point2D.Double point)
          Draws a 2D line into the neuron image.
 MTBNeurite2DSet getExtractedNeurites()
          Get extracted neurites as result of the NeuriteExtraction2D operator.
 int getMaxSpineLength()
          Get maximum length of a spine (filopodia-like protrusion) in pixel.
 int getNeuriteMaskSize()
          Get neurite mask size in pixel.
 NeuriteExtractor2D.NeuronColor getNeuronColor()
          Get binary neuron color.
 MTBImageByte getNeuronImage()
          Get input image of the binary neuron.
 org.rosuda.JRI.Rengine getREngine()
          Get R engine.
protected  void operate()
           
 void setMaxSpineLength(int _maxSpineLength)
          Set maximum length of a spine (filopodia-like protrusion) in pixel.
 void setNeuronColor(NeuriteExtractor2D.NeuronColor _neuronColor)
          Set binary neuron color.
 void setNeuronImage(MTBImageByte _neuronImage)
          Set input image of the binary neuron.
 void setNuriteMaskSize(int _neuriteMaskSize)
          Set neurite mask size in pixel.
 void setREngine(org.rosuda.JRI.Rengine _rEngine)
          Set R engine.
 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
addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeuriteExtractor2D

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

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

NeuriteExtractor2D

public NeuriteExtractor2D(MTBImageByte _neuronImage,
                          NeuriteExtractor2D.NeuronColor _neuronColor,
                          int _neuriteMaskSize,
                          int _maxSpineLength,
                          org.rosuda.JRI.Rengine _rEngine,
                          String _outputDir)
                   throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor to create a new neurite extraction object.

Parameters:
_neuronImage - binary neuron image
_neuronColor - binary neuron color, e.g. 0 (black) or 255 (white)
_neuriteMaskSize - mask size of average neurite width, in pixel
_maxSpineLength - maximum length of a branch to define it as spine, in pixel
_rEngine - engine to call R scripts
_outputFile - file path for feature output
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

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

getNeuronImage

public MTBImageByte getNeuronImage()
Get input image of the binary neuron. Maybe the binary colors have changed. The default is black for background and white for foreground pixels.


setNeuronImage

public void setNeuronImage(MTBImageByte _neuronImage)
Set input image of the binary neuron.


getNeuronColor

public NeuriteExtractor2D.NeuronColor getNeuronColor()
Get binary neuron color. WHITE = 255 and BLACK = 0.


setNeuronColor

public void setNeuronColor(NeuriteExtractor2D.NeuronColor _neuronColor)
Set binary neuron color. WHITE = 255 and BLACK = 0.


getNeuriteMaskSize

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


setNuriteMaskSize

public void setNuriteMaskSize(int _neuriteMaskSize)
Set neurite mask size in pixel. This value defines the maximum average width of a neurite.


getREngine

public org.rosuda.JRI.Rengine getREngine()
Get R engine.


setREngine

public void setREngine(org.rosuda.JRI.Rengine _rEngine)
Set R engine.


getMaxSpineLength

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


setMaxSpineLength

public void setMaxSpineLength(int _maxSpineLength)
Set maximum length of a spine (filopodia-like protrusion) in pixel.


getExtractedNeurites

public MTBNeurite2DSet getExtractedNeurites()
Get extracted neurites as result of the NeuriteExtraction2D operator.

Returns:
Set of MTBNeurite2D objects.

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

drawLine2D

public MTBImageByte drawLine2D(Line2D.Double line,
                               Point2D.Double point)
Draws a 2D line into the neuron image.

This function implements the Bresenham algorithm. Code was 'stolen' from Wikipedia, http://de.wikipedia.org/wiki/Bresenham-Algorithmus, and then translated into Java (German comments where kept).

Parameters:
xstart - x-coordinate of start point.
ystart - y-coordinate of start point.
xend - x-coordinate of end point.
yend - y-coordinate of end point.
value - Color/gray-scale value of the polygon.

cleanNeurites

public void cleanNeurites(MTBNeurite2DSet tmpNeuriteSet)
Method to clean up the extracted neurites, due to multiple features along a NSG path or feature shifts at the start point due to different NSG lengths.

Parameters:
tmpNeuriteSet - current temporary neurite set


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.