Module ij

Interface PlugInFilter

All Known Subinterfaces:
ExtendedPlugInFilter
All Known Implementing Classes:
Analyzer, AVI_Writer, BackgroundSubtracter, Binary, Calibrator, Convolver, Duplicater, EDM, FFTCustomFilter, FFTFilter, Filler, Filters, FractalBoxCounter, GaussianBlur, ImageMath, ImageProperties, Info, LineGraphAnalyzer, LutApplier, LutViewer, MaximumFinder, ParticleAnalyzer, Printer, RankFilters, RGBStackSplitter, RoiWriter, Rotator, SaltAndPepper, ScaleDialog, Shadows, StackLabeler, ThresholdToSelection, Transformer, Translator, UnsharpMask, Writer, XYWriter

public interface PlugInFilter
ImageJ plugins that process an image should implement this interface. For filters that have a dialog asking for options or parameters as well as for filters that have a progress bar and process stacks the ExtendedPlugInFilter interface is recommended.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int CONVERT_TO_FLOAT
    Set this flag to have the ImageProcessor that is passed to the run() method converted to a FloatProcessor.
    static int DOES_16
    Set this flag if the filter handles 16-bit images.
    static int DOES_32
    Set this flag if the filter handles float images.
    static int DOES_8C
    Set this flag if the filter handles 8-bit indexed color images.
    static int DOES_8G
    Set this flag if the filter handles 8-bit grayscale images.
    static int DOES_ALL
    Set this flag if the filter handles all types of images.
    static int DOES_RGB
    Set this flag if the filter handles RGB images.
    static int DOES_STACKS
    Set this flag if the filter wants its run() method to be called for all the slices in a stack.
    static int DONE
    Set this flag if the filter does not want its run method called.
    static int FINAL_PROCESSING
    Set this flag if the setup method of the filter should be called again after the calls to the run(ip) have finished.
    static int KEEP_THRESHOLD
    Set this flag to keep the invisible binary threshold from being reset.
    static int NO_CHANGES
    Set this flag if the filter makes no changes to the pixel data and does not require undo.
    static int NO_IMAGE_REQUIRED
    Set this flag if the filter does not require that an image be open.
    static int NO_UNDO
    Set this flag if the filter does not require undo.
    static int NO_UNDO_RESET
    Set this flag to prevent Undo from being reset when processing a stack.
    static int PARALLELIZE_IMAGES
    Set this flag if images may be processed in parallel threads.
    static int PARALLELIZE_STACKS
    Set this flag if the slices of a stack may be processed in parallel threads
    static int ROI_REQUIRED
    Set this flag if the filter requires an ROI.
    static int SNAPSHOT
    Set this flag if the filter requires a snapshot (copy of the pixels array).
    static int STACK_REQUIRED
    Set this flag if the filter requires a stack.
    static int SUPPORTS_MASKING
    Set this flag if the filter wants ImageJ, for non-rectangular ROIs, to restore that part of the image that's inside the bounding rectangle but outside of the ROI.
  • Method Summary

    Modifier and Type Method Description
    void run​(ImageProcessor ip)
    Filters use this method to process the image.
    int setup​(java.lang.String arg, ImagePlus imp)
    This method is called once when the filter is loaded.
  • Field Details

    • DOES_8G

      static final int DOES_8G
      Set this flag if the filter handles 8-bit grayscale images.
      See Also:
      Constant Field Values
    • DOES_8C

      static final int DOES_8C
      Set this flag if the filter handles 8-bit indexed color images.
      See Also:
      Constant Field Values
    • DOES_16

      static final int DOES_16
      Set this flag if the filter handles 16-bit images.
      See Also:
      Constant Field Values
    • DOES_32

      static final int DOES_32
      Set this flag if the filter handles float images.
      See Also:
      Constant Field Values
    • DOES_RGB

      static final int DOES_RGB
      Set this flag if the filter handles RGB images.
      See Also:
      Constant Field Values
    • DOES_ALL

      static final int DOES_ALL
      Set this flag if the filter handles all types of images.
      See Also:
      Constant Field Values
    • DOES_STACKS

      static final int DOES_STACKS
      Set this flag if the filter wants its run() method to be called for all the slices in a stack.
      See Also:
      Constant Field Values
    • SUPPORTS_MASKING

      static final int SUPPORTS_MASKING
      Set this flag if the filter wants ImageJ, for non-rectangular ROIs, to restore that part of the image that's inside the bounding rectangle but outside of the ROI.
      See Also:
      Constant Field Values
    • NO_CHANGES

      static final int NO_CHANGES
      Set this flag if the filter makes no changes to the pixel data and does not require undo.
      See Also:
      Constant Field Values
    • NO_UNDO

      static final int NO_UNDO
      Set this flag if the filter does not require undo.
      See Also:
      Constant Field Values
    • NO_IMAGE_REQUIRED

      static final int NO_IMAGE_REQUIRED
      Set this flag if the filter does not require that an image be open.
      See Also:
      Constant Field Values
    • ROI_REQUIRED

      static final int ROI_REQUIRED
      Set this flag if the filter requires an ROI.
      See Also:
      Constant Field Values
    • STACK_REQUIRED

      static final int STACK_REQUIRED
      Set this flag if the filter requires a stack.
      See Also:
      Constant Field Values
    • DONE

      static final int DONE
      Set this flag if the filter does not want its run method called.
      See Also:
      Constant Field Values
    • CONVERT_TO_FLOAT

      static final int CONVERT_TO_FLOAT
      Set this flag to have the ImageProcessor that is passed to the run() method converted to a FloatProcessor. With RGB images, the run() method is called three times, once for each channel.
      See Also:
      Constant Field Values
    • SNAPSHOT

      static final int SNAPSHOT
      Set this flag if the filter requires a snapshot (copy of the pixels array).
      See Also:
      Constant Field Values
    • PARALLELIZE_STACKS

      static final int PARALLELIZE_STACKS
      Set this flag if the slices of a stack may be processed in parallel threads
      See Also:
      Constant Field Values
    • FINAL_PROCESSING

      static final int FINAL_PROCESSING
      Set this flag if the setup method of the filter should be called again after the calls to the run(ip) have finished. The argument arg of setup will be "final" in that case.
      See Also:
      Constant Field Values
    • KEEP_THRESHOLD

      static final int KEEP_THRESHOLD
      Set this flag to keep the invisible binary threshold from being reset.
      See Also:
      Constant Field Values
    • PARALLELIZE_IMAGES

      static final int PARALLELIZE_IMAGES
      Set this flag if images may be processed in parallel threads. Overrides PARALLELIZE_STACKS. The plugin's run() method is called in parallel threads, with the ROI rectangle of the ImageProcessor set according to the area that should be processed. Use the Edit/Options/Memory & Threads command to view or set the thread count.
      See Also:
      Constant Field Values
    • NO_UNDO_RESET

      static final int NO_UNDO_RESET
      Set this flag to prevent Undo from being reset when processing a stack.
      See Also:
      Constant Field Values
  • Method Details

    • setup

      int setup​(java.lang.String arg, ImagePlus imp)
      This method is called once when the filter is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt or in the plugins.config file of a jar archive containing the plugin. 'imp' is the currently active image. This method should return a flag word that specifies the filters capabilities.

      For Plugin-filters specifying the FINAL_PROCESSING flag, the setup method will be called again, this time with arg = "final" after all other processing is done.

    • run

      void run​(ImageProcessor ip)
      Filters use this method to process the image. If the DOES_STACKS flag was set, it is called for each slice in a stack. With CONVERT_TO_FLOAT, the filter is called with the image data converted to a FloatProcessor (3 times per image for RGB images). ImageJ will lock the image before calling this method and unlock it when the filter is finished. For PlugInFilters specifying the NO_IMAGE_REQUIRED flag and not the DONE flag, run(ip) is called once with the argument null.