Login  Register

Re: Alpha-Channel-PlugIn as Macro

Posted by Marie Rasta on Sep 04, 2014; 6:03pm
URL: http://imagej.273.s1.nabble.com/Alpha-Channel-PlugIn-as-Macro-tp5009498p5009506.html

Hi Michael,

thank you for the fast reply. I used your PlugIn manually to fuse a Grayscale CT-stack with a PET-stack(where LUT is applied).
and it really works perfectly.
I followed your advice and converted the images in RGB and used a duplicate of the PET-stack (converted it to 8bit) to determine the transparency...the following
error shows up:  "No previous filter/paste operation that could be modified by an alpha channel."
 
Here is the modified code:

public static ImagePlus TransparentOverlay(ImagePlus imp, ImagePlus imp2) {

                IJ.selectWindow("background");
                IJ.run("RGB Color");
                IJ.selectWindow("forground");
                IJ.run("RGB Color");
               
                ImagePlus imp1 = new Duplicator().run(imp);
                imp1.show();
                //IJ.setPasteMode("Transparent-white");

                for (int i = 1; i <= imp.getStackSize(); i++) {
                        ImageWindow win = (ImageWindow) WindowManager
                                        .getWindow("forground");
                        imp = win.getImagePlus();
                        imp.setSlice(i);  
                        imp.setRoi(0, 0, imp.getWidth(), imp.getHeight());
                        imp.copy(true);
                        //imp.copy();
                        win = (ImageWindow) WindowManager.getWindow("background");
                        imp2 = win.getImagePlus();
                        imp2.setSlice(i);
                        imp2.paste();
                        IJ.wait(10000);
                        IJ.run("Alpha Channel",
                                        "alpha=DUP_forground range=50 enlarge=0 smooth=2.0");
                        imp2.updateImage();
                }

                return imp2;
        }

Thanks in advance for any advice

Marie

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html