DESY ACOP Beans Home

de.desy.acop.video.analysis
Class ImageAnalysisEngine

java.lang.Object
  extended by de.desy.acop.video.analysis.ImageAnalysisEngine
All Implemented Interfaces:
TineImageReceiver

public class ImageAnalysisEngine
extends java.lang.Object
implements TineImageReceiver

ImageAnalysisEngine provides AImage image analysis data. It has two modes of operation: local and remote analysis. In local analysis mode, the IMAGE arguments of the updateValue method are processed locally. In remote mode this engine reads AImage data from a video analysis server.

Author:
Tilen Kusterle, Cosylab

Field Summary
static java.lang.String PROPERTY_A_IMAGE
           
static java.lang.String PROPERTY_BACKGROUND
           
static java.lang.String PROPERTY_PRECISE_BACKGROUND
           
static java.lang.String PROPERTY_RESET
           
 
Constructor Summary
ImageAnalysisEngine(ColorDecoder decoder)
          Constructs this ImageAnalysisEngine.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener for the specified propertyName.
 AImage getAImage()
          Gets the AImage.
 de.desy.tine.types.IMAGE getBackground()
          Gets the background image used by this ImageAnalysisEngine.
 int getBackgroundWidth()
          Returns the width of the background image.
 ColorDecoder getDecoder()
          Gets the decoder used by this ImageAnalysisEngine.
 de.desy.tine.types.IMAGE getImage()
          Gets the IMAGE.
 double[] getPreciseBackground()
          Returns the double array that is used as background image.
 java.awt.Rectangle getROI()
          Returns the rectangle describing the region of interest.
 double getThreshold()
          Gets the threshold value.
 java.awt.Rectangle getThresholdROI()
          Returns the rectangle describing the region of interest used for threshold calculation.
 boolean isCalculateThreshold()
          Returns true if the threshold is calculated by this engine, or false if the user defined the threshold to be used.
 boolean isLocalAnalysisMode()
          Gets the analysis mode for this ImageAnalysisEngine.
 boolean isPerformFit()
          Returns true if fitting is performed by this engine, or false if otherwise
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener for the specified propertyName.
 void resetForReceiving()
          Resets this receiver for receiving.
 void setAnalysisParameters(double threshold, int roiX, int roiY, int roiW, int roiH, int roi2X, int roi2Y, int roi2W, int roi2H, boolean calculateThreshold, boolean performFit, boolean performSmoothing)
          Sets the analysis parameters (threshold and region of interest) and reanalyzes pixels.
 void setAnalysisParameters(int roiX, int roiY, int roiW, int roiH, int roi2X, int roi2Y, int roi2W, int roi2H, boolean calculateThreshold, boolean performFit, boolean performSmoothing)
          Sets the analysis parameters (only region of interest, threshold remains the same) and reanalyzes pixels.
 void setAnalysisServerConnectionParameters(ConnectionParameters cp)
          Sets ConnectionParameters for remote video analysis server.
 void setBackground(de.desy.tine.types.IMAGE background)
          Sets the background image to be used by this ImageAnalysisEngine.
 void setCalculateThreshold(boolean calculateThreshold)
          Sets the calculate thershold parameter.
 void setDecoder(ColorDecoder decoder)
          Sets a ColorDecoder to this ImageAnalysisEngine
 void setLocalAnalysisMode(boolean local)
          Sets the analysis mode for this ImageAnalysisEngine.
 void setPerformFit(boolean performFit)
          Sets the perform fit parameter.
 void setPerformSmoothing(boolean performSmoothing)
          Sets the perform smoothing parameter.
 void setPreciseBackground(double[] background, int width)
          Sets the precise background array.
 void setRoi(int roiX, int roiY, int roiW, int roiH)
          Sets the region of interest and reanalyzes pixels.
 void setRoi2(int roi2X, int roi2Y, int roi2W, int roi2H)
          Sets the region of interest and reanalyzes pixels.
 void setThreshold(double threshold)
          Sets the threshold value, which discards all pixels which have returned by ColorDecoder lover than threshold value.
 void startRemoteAnalysis()
          Starts connection to remote video analysis server.
 void stopRemoteAnalysis()
          Stops connection to remote video analysis server.
static java.awt.image.BufferedImage toBufferedImage(double[] image, int width)
          Transforms teh double array to a gray buffered image.
static java.awt.image.BufferedImage toBufferedImage(de.desy.tine.types.IMAGE image)
          Transforms the IMAGE to BufferedImage using the appropriate algorithm for the given image.
static de.desy.tine.types.IMAGE toImage(double[] image, int width)
          Transforms the double array to a Gray image.
 void updateValue(de.desy.tine.types.IMAGE newImage)
          Updates this receiver's IMAGE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_A_IMAGE

public static final java.lang.String PROPERTY_A_IMAGE
See Also:
Constant Field Values

PROPERTY_BACKGROUND

public static final java.lang.String PROPERTY_BACKGROUND
See Also:
Constant Field Values

PROPERTY_PRECISE_BACKGROUND

public static final java.lang.String PROPERTY_PRECISE_BACKGROUND
See Also:
Constant Field Values

PROPERTY_RESET

public static final java.lang.String PROPERTY_RESET
See Also:
Constant Field Values
Constructor Detail

ImageAnalysisEngine

public ImageAnalysisEngine(ColorDecoder decoder)
Constructs this ImageAnalysisEngine.

Parameters:
decoder - the ColorDecoder to be used with this ImageAnalysisEngine
Method Detail

resetForReceiving

public void resetForReceiving()
Description copied from interface: TineImageReceiver
Resets this receiver for receiving.

Specified by:
resetForReceiving in interface TineImageReceiver

updateValue

public void updateValue(de.desy.tine.types.IMAGE newImage)
Description copied from interface: TineImageReceiver
Updates this receiver's IMAGE.

Specified by:
updateValue in interface TineImageReceiver
Parameters:
newImage - the new IMAGE

setPreciseBackground

public void setPreciseBackground(double[] background,
                                 int width)
Sets the precise background array. This is the array that holds values per pixels for whole background image, but instead of int values, pixel values are given as luminosity doubles. Negative values are permitted and will be taken into account during analysis, but forced to 0, when real image is constructed.

Parameters:
background - the pixel value array
width - the width of the image

getPreciseBackground

public double[] getPreciseBackground()
Returns the double array that is used as background image.

Returns:
the double array image
See Also:
#setPreciseBackground(double[], boolean)

getBackgroundWidth

public int getBackgroundWidth()
Returns the width of the background image.

Returns:
the width

toImage

public static de.desy.tine.types.IMAGE toImage(double[] image,
                                               int width)
Transforms the double array to a Gray image.

Parameters:
image - the image to transform
width - the width of the image
Returns:
generated IMAGE

toBufferedImage

public static java.awt.image.BufferedImage toBufferedImage(double[] image,
                                                           int width)
Transforms teh double array to a gray buffered image.

Parameters:
image - the double image array
width - the width of the image
Returns:
buffered image

getBackground

public de.desy.tine.types.IMAGE getBackground()
Gets the background image used by this ImageAnalysisEngine.

Returns:
the background image

setBackground

public void setBackground(de.desy.tine.types.IMAGE background)
Sets the background image to be used by this ImageAnalysisEngine.

Parameters:
background - the image to set

setRoi

public void setRoi(int roiX,
                   int roiY,
                   int roiW,
                   int roiH)
Sets the region of interest and reanalyzes pixels.

Parameters:
roiX - the starting x coordinate
roiY - the starting y coordinate
roiW - the width of the region
roiH - the height of the region

setRoi2

public void setRoi2(int roi2X,
                    int roi2Y,
                    int roi2W,
                    int roi2H)
Sets the region of interest and reanalyzes pixels.

Parameters:
roiX - the starting x coordinate
roiY - the starting y coordinate
roiW - the width of the region
roiH - the height of the region

getImage

public de.desy.tine.types.IMAGE getImage()
Gets the IMAGE.

Returns:
the IMAGE

getAImage

public AImage getAImage()
Gets the AImage.

Returns:
the AImage

getROI

public java.awt.Rectangle getROI()
Returns the rectangle describing the region of interest.

Returns:
the region of intereset

getThresholdROI

public java.awt.Rectangle getThresholdROI()
Returns the rectangle describing the region of interest used for threshold calculation.

Returns:
the threshold region of interest

getThreshold

public double getThreshold()
Gets the threshold value.

Returns:
the threshold value
See Also:
setThreshold(double)

setThreshold

public void setThreshold(double threshold)
Sets the threshold value, which discards all pixels which have returned by ColorDecoder lover than threshold value. Threshold value has effect only between values Const2D and Amplitude2D as described by AImage.

Parameters:
threshold - the threshold value to set
See Also:
AImage, AImage.getAmplitude2D(), AImage.getConst2D()

setCalculateThreshold

public void setCalculateThreshold(boolean calculateThreshold)
Sets the calculate thershold parameter. When true the threshold values is calculated at each image analysis performed and the original user defined threshold is overridden with the calculated one.

Parameters:
calculateThreshold - true if the threshold should be calculated or false otherwise

isCalculateThreshold

public boolean isCalculateThreshold()
Returns true if the threshold is calculated by this engine, or false if the user defined the threshold to be used.

Returns:
true if threshold calculation is automatic

setPerformFit

public void setPerformFit(boolean performFit)
Sets the perform fit parameter. When true fitting is performed on the data. When true, the time required to perform the analysis might be significantly longer

Parameters:
performFit - true if fitting should be performed or false otherwise

setPerformSmoothing

public void setPerformSmoothing(boolean performSmoothing)
Sets the perform smoothing parameter. When true smoothing is performed on the side view data.

Parameters:
performSmoothing - true if smoothing should be performed or false otherwise

isPerformFit

public boolean isPerformFit()
Returns true if fitting is performed by this engine, or false if otherwise

Returns:
true if fitting is performed

getDecoder

public ColorDecoder getDecoder()
Gets the decoder used by this ImageAnalysisEngine.

Returns:
the ColorDecoder used

setDecoder

public void setDecoder(ColorDecoder decoder)
Sets a ColorDecoder to this ImageAnalysisEngine

Parameters:
decoder - the ColorDecoder to set

setAnalysisParameters

public void setAnalysisParameters(int roiX,
                                  int roiY,
                                  int roiW,
                                  int roiH,
                                  int roi2X,
                                  int roi2Y,
                                  int roi2W,
                                  int roi2H,
                                  boolean calculateThreshold,
                                  boolean performFit,
                                  boolean performSmoothing)
Sets the analysis parameters (only region of interest, threshold remains the same) and reanalyzes pixels.

Parameters:
roiX - the starting x coordinate
roiY - the starting y coordinate
roiW - the width of the region
roiH - the height of the region
calculateThreshold - true if the threshold is calculated by the server or false otherwise
performFit - true if the fitting should be performed or false otherwise

setAnalysisParameters

public void setAnalysisParameters(double threshold,
                                  int roiX,
                                  int roiY,
                                  int roiW,
                                  int roiH,
                                  int roi2X,
                                  int roi2Y,
                                  int roi2W,
                                  int roi2H,
                                  boolean calculateThreshold,
                                  boolean performFit,
                                  boolean performSmoothing)
Sets the analysis parameters (threshold and region of interest) and reanalyzes pixels.

Parameters:
threshold - the threshold
roiX - the starting x coordinate
roiY - the starting y coordinate
roiW - the width of the region
roiH - the height of the region

setLocalAnalysisMode

public void setLocalAnalysisMode(boolean local)
Sets the analysis mode for this ImageAnalysisEngine.

Parameters:
local - true for local analysis and false for remote analysis

isLocalAnalysisMode

public boolean isLocalAnalysisMode()
Gets the analysis mode for this ImageAnalysisEngine.

Returns:
the true if local analysis is selected and false if remote analysis is selected

startRemoteAnalysis

public void startRemoteAnalysis()
Starts connection to remote video analysis server.


stopRemoteAnalysis

public void stopRemoteAnalysis()
Stops connection to remote video analysis server.


setAnalysisServerConnectionParameters

public void setAnalysisServerConnectionParameters(ConnectionParameters cp)
Sets ConnectionParameters for remote video analysis server.

Parameters:
cp - the ConnectionParameters to set

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener for the specified propertyName.

Parameters:
propertyName - the name of the property
listener - the PropertyChangeListener to add

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for the specified propertyName.

Parameters:
propertyName - the name of the property
listener - the PropertyChangeListener to remove

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.

Parameters:
listener - the PropertyChangeListener to add

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.

Parameters:
listener - the PropertyChangeListener to remove

toBufferedImage

public static java.awt.image.BufferedImage toBufferedImage(de.desy.tine.types.IMAGE image)
Transforms the IMAGE to BufferedImage using the appropriate algorithm for the given image.

Parameters:
image - the image to transform
Returns:
transformed image


Copyright © 2010. All Rights Reserved.