Book Image

Image Processing with ImageJ

Book Image

Image Processing with ImageJ

Overview of this book

Digital image processing is an increasingly important field across a vast array of scientific disciplines. ImageJ's long history and ever-growing user base makes it a perfect candidate for solving daily tasks involving all kinds of image analysis processes. Image Processing with ImageJ is a practical book that will guide you from the most basic analysis techniques to the fine details of implementing new functionalities through the ImageJ plugin system, all of it through the use of examples and practical cases. ImageJ is an excellent public domain imaging analysis platform that can be very easily used for almost all your image processing needs. Image Processing with ImageJ will start by showing you how to open a number of different images, become familiar with the different options, and perform simple analysis operations using the provided image samples. You will also learn how to make modifications through ImageJ filters and how to make local measurements using the selections system. You will also find the instructions necessary to record all the steps you perform so they can be saved and re-run on the same image to ensure analysis reproducibility. Finally, you will get to know some different ImageJ plugins and will learn how to implement your own.
Table of Contents (13 chapters)
Image Processing with ImageJ
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

The PlugInFilter interface


As we said before, the PlugInFilter interface is the one you need to implement if you want to code a plugin that performs operations on an image that is already open (similar to what macros do). This interface provides an extra method (setup) for you to implement that checks whether the image to be acted upon is of the type expected by the plugin and then proceeds to execute the run method. The following plugin offers an example and will also serve to explain additional functions:

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;

public class Example_Filter_Plugin implements PlugInFilter {

    ImagePlus imp;

    public int setup(String arg, ImagePlus imp) {
      boolean wrong_version = IJ.versionLessThan("1.46r");
      if (wrong_version)
        return DONE;

      this.imp = imp;
      return DOES_8G;
    }

    public void run(ImageProcessor ip) {
   	   IJ.showStatus("Start processing...");
   	   IJ.wait(2000...