import ij.IJ; import ij.ImagePlus; import ij.WindowManager; import ij.gui.GenericDialog; import ij.gui.Line; import ij.gui.Roi; import ij.plugin.PlugIn; import ij.process.FloatProcessor; import ij.process.ImageProcessor; import java.util.ArrayList; import java.util.Iterator; /** Select two images with a Line ROI in each, and rotate/translate/scale one * to the other. * Stacks are not explicitly supported, but a macro can easily use this plugin * for the purpose by iterating over all slices. */ public class Align_Image implements PlugIn { private boolean isSupported(int type) { switch (type) { case ImagePlus.GRAY8: case ImagePlus.GRAY16: case ImagePlus.GRAY32: return true; } return false; } public void run(String arg) { // Find all images that have a LineRoi in them int[] ids = WindowManager.getIDList(); if (null == ids) return; // no images open ArrayList all = new ArrayList(); for (int i=0; i