Login  Register

Re: Alpha-Channel-PlugIn as Macro

Posted by Marie Rasta on Sep 05, 2014; 2:15pm
URL: http://imagej.273.s1.nabble.com/Alpha-Channel-PlugIn-as-Macro-tp5009498p5009524.html

Dear Michael,

Thank you so much, now it works!I just didn't know the command IJ.run(ImagePlus, String, String). I could minimize my method now.

Here is the final method I use in my littl PlugIn:
/**
         * Make transparent
         *
         */
        public static ImagePlus TransparentOverlay(ImagePlus imp, ImagePlus imp2) {
                IJ.run(imp2,"RGB Color",null);
                IJ.run(imp,"RGB Color",null);
                ImagePlus imp9 = new Duplicator().run(imp);
                imp9.show();
                IJ.run(imp9,"8-bit Color", "number=256");

                for (int i = 1; i <= imp.getStackSize(); i++) {
                        imp.setSlice(i); //PET
                        imp.copy();
                        imp2.setSlice(i);
                        imp9.setSlice(i);
                        imp2.paste();
                        IJ.run(imp2,"Alpha Channel",
                                        "alpha=DUP_forground range=50 enlarge=0 smooth=2.0");
                        imp2.updateImage();
                }
                return imp2;
        }


Greetings,
Marie