org.shapelogic.imageprocessing
Class ColorParticleAnalyzer

java.lang.Object
  extended by org.shapelogic.imageutil.BaseImageOperation
      extended by org.shapelogic.imageprocessing.BaseParticleCounter
          extended by org.shapelogic.imageprocessing.ColorParticleAnalyzer
All Implemented Interfaces:
java.lang.Runnable, RecursiveContext, IParticleCounter, ImageOperation
Direct Known Subclasses:
ColorParticleAnalyzerIJ

public class ColorParticleAnalyzer
extends BaseParticleCounter

Analyzes a particle image in gray or RGB and group the particles according to shape rules.
Find a place in the base class where there is a hook for this extended functionality.
Some of the methods can be moved to ColorParticleAnalyzer to remove dependency of ImageJ.

Author:
Sami Badawi

Field Summary
protected  NumberedStream<java.lang.Integer> _areaStream
           
protected  NumberedStream<java.lang.Double> _aspectRatioStream
           
protected  NumberedStream<java.lang.Integer> _curveArchCountStream
           
protected  IEdgeTracer _edgeTracer
           
protected  NumberedStream<java.lang.Integer> _grayValueStream
           
protected  NumberedStream<java.lang.Integer> _hardCornerCountStream
           
protected  NumberedStream<java.lang.Integer> _inflectionPointCountStream
           
protected  java.lang.String _neuralNetworkFile
           
protected  WrappedListStream<IColorAndVariance> _particleStream
           
protected  NumberedStream<java.lang.Double> _perimeterStream
           
protected  ListStream<Polygon> _polygonStream
           
protected  java.util.List<java.lang.String> _printListOverwrite
           
protected  ListCalcStream1<IColorAndVariance,java.lang.Boolean> _roundishStream
           
protected  BaseTableBuilder _tableBuilder
           
protected  TableDefinition _tableDefinition
           
protected  boolean _useNeuralNetwork
           
protected  NumberedStream<java.lang.Double> _xMaxStream
           
protected  NumberedStream<java.lang.Double> _xMinStream
           
protected  NumberedStream<java.lang.Double> _yMaxStream
           
protected  NumberedStream<java.lang.Double> _yMinStream
           
protected  LoadLetterStreams loadLetterStreams
           
protected  LoadParticleStreams loadParticleStreams
           
protected  LoadPolygonStreams loadPolygonStreams
           
 
Fields inherited from class org.shapelogic.imageprocessing.BaseParticleCounter
_backgroundArea, _backgroundColor, _backgroundCount, _boundingBoxArea, _categorizer, _colorHypothesis, _colorHypothesisFinder, _context, _countOnly, _displayInternalInfo, _displayTable, _errorMessage, _inputColor, _iterations, _maxDistance, _maxPixelsInArea, _minPixelsInArea, _modifying, _paintBackground, _paintForground, _parentContext, _particleCount, _particleImage, _particlesFiltered, _particlesOrig, _referenceColor, _saveArea, _segmentation, _toMask, _useReferenceAsBackground, ITERATIONS_DEFAULTS, MAX_DISTANCE_DEFAULTS, MAX_PIXELS_IN_AREA_DEFAULTS, MIN_PIXELS_IN_AREA_DEFAULTS
 
Fields inherited from class org.shapelogic.imageutil.BaseImageOperation
_arg, _guiWrapper, _image, _keyValueParser, _setupReturnValue
 
Constructor Summary
ColorParticleAnalyzer()
           
 
Method Summary
protected  void categorizeStreams()
          Analyzes particles and group them.
Not sure if I should use named streams or try to avoid it to make it more thread safe.
protected  void customStreamDefinitions()
          Define extra streams.
protected  void defaultColumnDefinitions()
          Setup all the stream and other needed things.
protected  void defaultStreamDefinitions()
          Define extra streams and also extra columns.
protected  void defineNeuralNetwork()
          Method to override if you want to define your own neural network.
The default network is very simple it is marking particles Dark or Light.
protected  void defineRules()
          Method to override if you want to define your own rule set.
The default network is very simple it is marking particles Tall, Flat based on their aspect ratio.
 java.lang.StringBuffer getInternalInfo()
           
 java.util.List getTableBuilderOutputList()
          This is only for testing the result table.
 void init()
          Setup all the needed factory methods based on what type the image has.
protected  void makeBBoxStreams()
           
protected  void populateResultsTable()
          Populate the table with the streams.
 void setNeuralNetworkFile(java.lang.String neuralNetworkFile)
           
protected  void setupTableBuilder()
           
 void setUseNeuralNetwork(boolean useNeuralNetwork)
           
 
Methods inherited from class org.shapelogic.imageprocessing.BaseParticleCounter
displayInternalInfo, displayResultsTable, findBackground, findColorHypothesis, getColorHypothesisFinder, getContext, getErrorMessage, getImageArea, getInputColor, getIterations, getMaxDistance, getMinPixelsInArea, getParentContext, getParticleCount, getParticleFiltered, getSegmentation, getStatus, globalFilter, isParticleImage, isUseReferenceAsBackground, populateResultsTableRow, populateResultsTableRowCustom, run, segment, setColorHypothesisFinder, setDisplayTable, setInputColor, setIterations, setMaxDistance, setMinPixelsInArea, setToMask, setUseReferenceAsBackground, showResultDialog
 
Methods inherited from class org.shapelogic.imageutil.BaseImageOperation
getGuiWrapper, getImage, getKeyValueParser, getSetupReturnValue, isImageValid, setArg, setGuiWrapper, setKeyValueParser, setSetupReturnValue, setup, showAbout, showMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.shapelogic.imageutil.ImageOperation
getGuiWrapper, getImage, getKeyValueParser, getSetupReturnValue, isImageValid, setArg, setGuiWrapper, setKeyValueParser, setSetupReturnValue, setup, showAbout, showMessage
 

Field Detail

_particleStream

protected WrappedListStream<IColorAndVariance> _particleStream

_polygonStream

protected ListStream<Polygon> _polygonStream

_edgeTracer

protected IEdgeTracer _edgeTracer

_aspectRatioStream

protected NumberedStream<java.lang.Double> _aspectRatioStream

_grayValueStream

protected NumberedStream<java.lang.Integer> _grayValueStream

_hardCornerCountStream

protected NumberedStream<java.lang.Integer> _hardCornerCountStream

_roundishStream

protected ListCalcStream1<IColorAndVariance,java.lang.Boolean> _roundishStream

_inflectionPointCountStream

protected NumberedStream<java.lang.Integer> _inflectionPointCountStream

_curveArchCountStream

protected NumberedStream<java.lang.Integer> _curveArchCountStream

loadPolygonStreams

protected LoadPolygonStreams loadPolygonStreams

loadParticleStreams

protected LoadParticleStreams loadParticleStreams

loadLetterStreams

protected LoadLetterStreams loadLetterStreams

_xMinStream

protected NumberedStream<java.lang.Double> _xMinStream

_yMinStream

protected NumberedStream<java.lang.Double> _yMinStream

_xMaxStream

protected NumberedStream<java.lang.Double> _xMaxStream

_yMaxStream

protected NumberedStream<java.lang.Double> _yMaxStream

_perimeterStream

protected NumberedStream<java.lang.Double> _perimeterStream

_areaStream

protected NumberedStream<java.lang.Integer> _areaStream

_tableDefinition

protected TableDefinition _tableDefinition

_tableBuilder

protected BaseTableBuilder _tableBuilder

_useNeuralNetwork

protected boolean _useNeuralNetwork

_neuralNetworkFile

protected java.lang.String _neuralNetworkFile

_printListOverwrite

protected java.util.List<java.lang.String> _printListOverwrite
Constructor Detail

ColorParticleAnalyzer

public ColorParticleAnalyzer()
Method Detail

init

public void init()
          throws java.lang.Exception
Description copied from class: BaseParticleCounter
Setup all the needed factory methods based on what type the image has.

Overrides:
init in class BaseParticleCounter
Throws:
java.lang.Exception

defaultStreamDefinitions

protected void defaultStreamDefinitions()
Description copied from class: BaseParticleCounter
Define extra streams and also extra columns.

Overrides:
defaultStreamDefinitions in class BaseParticleCounter

makeBBoxStreams

protected void makeBBoxStreams()

categorizeStreams

protected void categorizeStreams()
Analyzes particles and group them.
Not sure if I should use named streams or try to avoid it to make it more thread safe.

Overrides:
categorizeStreams in class BaseParticleCounter

defineRules

protected void defineRules()
Method to override if you want to define your own rule set.
The default network is very simple it is marking particles Tall, Flat based on their aspect ratio.


defineNeuralNetwork

protected void defineNeuralNetwork()
Method to override if you want to define your own neural network.
The default network is very simple it is marking particles Dark or Light.


customStreamDefinitions

protected void customStreamDefinitions()
Define extra streams.

Overrides:
customStreamDefinitions in class BaseParticleCounter

defaultColumnDefinitions

protected void defaultColumnDefinitions()
Description copied from class: BaseParticleCounter
Setup all the stream and other needed things.

Overrides:
defaultColumnDefinitions in class BaseParticleCounter

populateResultsTable

protected void populateResultsTable()
Description copied from class: BaseParticleCounter
Populate the table with the streams.

Overrides:
populateResultsTable in class BaseParticleCounter

setupTableBuilder

protected void setupTableBuilder()
Overrides:
setupTableBuilder in class BaseParticleCounter

getInternalInfo

public java.lang.StringBuffer getInternalInfo()
Overrides:
getInternalInfo in class BaseParticleCounter

setNeuralNetworkFile

public void setNeuralNetworkFile(java.lang.String neuralNetworkFile)

setUseNeuralNetwork

public void setUseNeuralNetwork(boolean useNeuralNetwork)

getTableBuilderOutputList

public java.util.List getTableBuilderOutputList()
This is only for testing the result table.
This is empty when running from ColorParticleAnalyzerIJ.



Copyright © 2009. All Rights Reserved.