Blend Images

Author: Michael Schmid (schmid at
History: 2007/04/04: First version
2008/11/24: Added "Preview" option
Requires: ImageJ 1.38n or later
Installation: Copy Blend_Images.class to the plugins folder and restart ImageJ.
Description: This sample ImageJ plugin filter blends an image with another one, i.e., it adds another image with user-specified weight.

A few things to note:

  1. Filter plugins must implement the PlugInFilter interface.
  2. User plugins do not use the package statement;
  3. Plugins residing in the "plugins" folder, and with at least one underscore in their name, are automatically installed in the PlugIns menu.
  4. Plugins can be installed in other menus by packaging them as JAR files.
  5. The class name ("Blend_Images") and file name ("") must be the same.
  6. An ImagePlus is, roughly speaking, an image or stack that has a name and usually its own window. An ImageProcessor (ip) carries image data for a single image (grayscale or color), e.g. the image displayed in the window of an ImagePlus, or a single slice of a stack. Depending on the image type, an ImageProcesor can be a ByteProcessor (8 bit), ShortProcessor (16 bit), FloatProcessor (32 bit) or ColorProcessor (RGB).
  7. This filter works with selections, including non-rectangular selections. It is the programmer's responsibility to modify only the pixels within the ip.getRoi() rectangle; with the flag SUPPORTS_MASKING ImageJ takes care of out-of-roi pixels in that rectangle (for non-rectangular rois).
  8. The run method of a PlugInFilter will be called repeatedly to process all the slices in a stack if requested by the user.
  9. It supports Undo for single images. ImageJ takes care of this.
  10. This filter uses the following methods of the ImageProcessor class: ip.toFloat(i, fp), ip.setPixels(i, fp) and ip.getNChannels(), simplifying code that does float operations on grayscale images of any type or on the channels of color images. See the run(ip) method. These methods were added in ImageJ 1.38n.

|Plugins | Home |