Login  Register

Alpha-Channel-PlugIn as Macro

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

Dear all,
By using the Alpha_Channel_Plugin as PlugIn it works perfectly.
But I got Problems by using the PlugIn Alpha Channel
(http://imagejdocu.tudor.lu/doku.php?id=plugin:utilities:alpha_channel:start)
in my own PlugIn. There is no error-message, exception...but it seems the
plugIn can't change the fresh copied forground image, but he think he can
Some ideas, experience?
Here my method:

         /**
         * Make transparent
         *
         */
        public static ImagePlus TransparentOverlay(ImagePlus imp, ImagePlus imp2) {
                IJ.selectWindow("background");
                IJ.run("RGB Color");
                //IJ.run("8-bit Color", "number=256");
                IJ.run("32-bit");
                IJ.selectWindow("forground");
                IJ.run("RGB Color");
                IJ.run("8-bit Color", "number=256");

                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.run("Alpha Channel",
                                        "alpha=forground range=50 enlarge=0 smooth=2.0");

                        imp2.updateAndRepaintWindow();

                }

                return imp2;
        }


Greetings and thank you in advance
 Marie

 --
 --

 Dipl. Ing. (FH) Marie-Alexandra Rastädter
 Institut für Medizinische Physik und Strahlenschutz
 Technische Hochschule Mittelhessen

 Arbeitsgruppe: Biomedizinische Bildverarbeitung

 Büro: Q 0.02
 Gutfleischstr. 3, 35390 Gießen
 Telefon: 0641 309 2568

 www.thm.de/imps

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