AnalysisWorker

public class AnalysisWorker extends Thread

This thread continuously queries either the MMCore, or the processing pipeline of the live mode for new images, and calls the analyzer’s processImage() method on them as fast as it can. Always the latest image is taken for analysis, so it is possible for images to be skipped. It also gathers some statistics for display by the GUI.

Author:Marcel Stefko

Constructors

AnalysisWorker

public AnalysisWorker(Coordinator coordinator, Studio studio, Analyzer analyzer, ImagingMode imaging_mode)

Initialize the worker.

Parameters:
  • coordinator – parent Coordinator
  • studio – for logging and image queries
  • analyzer – this Analyzer’s processImage() method is called on gathered images
  • imaging_mode

Methods

acquisitionEnded

public void acquisitionEnded(AcquisitionEndedEvent evt)

If the imaging mode is NEXT_ACQUISITION, the coordinator will asked to stop.

Parameters:
  • evt – acquisition stopped

acquisitionStarted

public void acquisitionStarted(AcquisitionStartedEvent evt)

If the imaging mode is NEXT_ACQUISITION, the NewImageWatcher will be informed.

Parameters:
  • evt – new acquisition started event

getAnalyzerShortDescription

public String getAnalyzerShortDescription()

Returns the current description of the analyzer’s output.

Returns:A string describing the analyzer’s current output.

getCurrentFPS

public int getCurrentFPS()
Returns:number of analyzed frames in the last second

getCurrentImageCount

public int getCurrentImageCount()
Returns:number of analyzed frames since last counter reset, which could be either caused by live mode start, or acquisition start.

getLastAnalysisTime

public long getLastAnalysisTime()
Returns:duration of last analysis in milliseconds

getNewImageFromCoreAndAnalyze

public void getNewImageFromCoreAndAnalyze()

Acquire the new image directly from MMCore and send for analysis.

Throws:

getNewImageFromWatcherAndAnalyze

public void getNewImageFromWatcherAndAnalyze()

Grabs new images from the Datastore associated with the NewImageWatcher, analyzes it.

Throws:

liveModeStarted

public void liveModeStarted(LiveModeEvent evt)

Called by the MMCore to signalize there is a new live mode. If the imaging mode is LIVE, the NewImageWatcher will be informed.

Parameters:
  • evt – new live mode event

queryAnalyzerForBatchOutput

public double queryAnalyzerForBatchOutput()

Analyzer’s internal state might change, and the output is passed on to the controller.

Returns:batched output of analyzer

queryAnalyzerForIntermittentOutput

public double queryAnalyzerForIntermittentOutput()

Used for GUI rendering.

Returns:intermittent output of the analyzer

requestStop

public void requestStop()

Stops the analyzer after finalizing the current analysis.

run

public void run()

setLastImageCoords

void setLastImageCoords(Coords coords)

Called by the NewImageWatcher to update last coords

Parameters:
  • coords – new Coords

setROI

public void setROI(Roi roi)

Set the ROI for Analyzer

Parameters:
  • roi – ROI to be set