Paste and Blend only overlapping regions (MakeMontage variation)

Posted by Alan Hewat on
URL: http://imagej.273.s1.nabble.com/Paste-and-Blend-only-overlapping-regions-MakeMontage-variation-tp3692412.html

I have looked at various montage macros for creating composite mosaics
from overlapping images, and wanted to try something simpler using
"imageJ/Stacks/Make Montage". Since my image offsets required for
registration are constant, I can modify the MakeMontage.txt macro to
offset the image rectangles before pasting.

This works fine, but instead of the default "Paste Control" (Copy) I
would like to use Blend, but ***only for the overlapping regions***.
(Otherwise Blend blends the non-overlapped regions with the white or
other background).

      newImage("test", type+" black", columns*getWidth, rows*getHeight, 1);
      iw=getWidth/columns; ih=getHeight/rows;
      x[0]=0; x[1]=-25; x[2]=0; x[3]=-25; // image offsets for registration
      y[0]=0; y[1]=0; y[2]=-75; y[3]=-75; // image offsets for registration
      montage=getImageID;
      selectImage(id);
      for (i=0; i<4; i++) {
          selectImage(id);
          setSlice(i+1);
          run("Select All");
          run("Copy");
          selectImage(montage);
          makeRectangle((i%columns)*iw+x[i], floor(i/columns)*ih+y[i], sw, sh);
          run("Paste");
      }

I am relatively new to imageJ macros but am excited by the possibilities.
______________________________________________
Dr Alan Hewat, NeutronOptics, Grenoble, FRANCE
<[hidden email]> +33.476.98.41.68
        http://www.NeutronOptics.com/hewat
______________________________________________