On Jan 30, 2013, at 12:04 PM, M.Gbarin wrote:
> Hallo everyone,
>
> I wrote a program to select a stack and to find an image, which I need.
> Now I want to work on this image only!
>
> has someone an idea how to get it in a separately??
Here is Java code that, on a duplicate of the active image, runs Median and Variance filters, converts to binary, and inverts the pixels of the second image in the stack.
ImagePlus imp = IJ.getImage();
ImagePlus bimp = imp.duplicate();
bimp.setTitle("bimp");
IJ.run(bimp, "Median...", "sigma=3 stack");
IJ.run(bimp, "Variance...", "radius=3 stack");
IJ.run(bimp, "Convert to Mask", "calculate black");
ImageStack bstack = bimp.getStack();
ImageProcessor ip = bstack.getProcessor(2);
for (int i=0; i<ip.getPixelCount(); i++)
ip.setf(i, 255-ip.getf(i));
bimp.setStack(bstack);
bimp.show();
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html