Author: Michael Schmid (schmid at iap.tuwien.ac.at) History: 2007/04/04: First version
2008/11/24: Added "Preview" option
Requires: ImageJ 1.38n or later Source: Blend_Images.java 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:
- Filter plugins must implement the PlugInFilter interface.
- User plugins do not use the package statement;
- Plugins residing in the "plugins" folder, and with at least one underscore in their name, are automatically installed in the PlugIns menu.
- Plugins can be installed in other menus by packaging them as JAR files.
- The class name ("Blend_Images") and file name ("Blend_Images.java") must be the same.
- 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).
- 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).
- The run method of a PlugInFilter will be called repeatedly to process all the slices in a stack if requested by the user.
- It supports Undo for single images. ImageJ takes care of this.
- 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.