Class DefaultAlgoListener

java.lang.Object
inra.ijpb.algo.DefaultAlgoListener
All Implemented Interfaces:
AlgoListener

public class DefaultAlgoListener
extends java.lang.Object
implements AlgoListener
Utility class that catches algorithm events and displays them on ImageJ main Frame.

Example of use:


 // init image and process 
 ImageProcessor image = ...
 Strel strel = SquareStrel.fromDiameter(15);
 
 // Add monitoring of the process  
 DefaultAlgoListener.monitor(strel);
 
 // run process. The IJ frame will display progress
 strel.dilation(image);
 
Author:
David Legland
  • Constructor Summary

    Constructors
    Constructor Description
    DefaultAlgoListener()  
  • Method Summary

    Modifier and Type Method Description
    void algoProgressChanged​(AlgoEvent evt)
    The method devoted to manage the change in the progression of the algorithm.
    void algoStatusChanged​(AlgoEvent evt)
    The method devoted to manage the change in the status of the algorithm.
    static void monitor​(Algo algo)
    Static method that creates a new instance of DefaultAlgoListener, and add it to the given algorithm.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultAlgoListener

      public DefaultAlgoListener()
  • Method Details

    • monitor

      public static final void monitor​(Algo algo)
      Static method that creates a new instance of DefaultAlgoListener, and add it to the given algorithm.
      
       // read demo image
       String imageURL = "http://imagej.nih.gov/ij/images/NileBend.jpg";
       ImageProcessor image = IJ.openImage(imageURL).getProcessor();
       // init processor class
       Strel strel = SquareStrel.fromDiameter(15);
       // Add monitoring of the process  
       DefaultAlgoListener.monitor(strel);
       // run process. The IJ frame will display progress
       strel.dilation(image);
       
      Parameters:
      algo - the algorithm to monitor
    • algoProgressChanged

      public void algoProgressChanged​(AlgoEvent evt)
      Description copied from interface: AlgoListener
      The method devoted to manage the change in the progression of the algorithm.
      Specified by:
      algoProgressChanged in interface AlgoListener
      Parameters:
      evt - the AlgoEvent instance containing info about the algorithm.
    • algoStatusChanged

      public void algoStatusChanged​(AlgoEvent evt)
      Description copied from interface: AlgoListener
      The method devoted to manage the change in the status of the algorithm.
      Specified by:
      algoStatusChanged in interface AlgoListener
      Parameters:
      evt - the AlgoEvent instance containing info about the algorithm.