How to get one image from a stack?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get one image from a stack?

M.Gbarin
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??

My regards
Mahmud
Reply | Threaded
Open this post in threaded view
|

Re: How to get one image from a stack?

Michael Schmid
M.Gbarin wrote:
> 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??

Image>Duplicate
In the dialog, you can select whether to duplicate the whole stack or only one image.

See http://rsb.info.nih.gov/ij/docs/guide/index.html

Michael

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to get one image from a stack?

dscho
In reply to this post by M.Gbarin
Hi Mahmud,

On Wed, 30 Jan 2013, M.Gbarin wrote:

> 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??

If you refer to a Java plugin by "a program", then you want to look at
this method:

http://jenkins.imagej.net/job/ImageJ1-javadoc/javadoc/ij/ImageStack.html#getProcessor%28int%29

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to get one image from a stack?

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by M.Gbarin
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