obtaining the slice with the maximum intensity

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

obtaining the slice with the maximum intensity

Eri
Hi to everyone,

I am using imagej for my project and I have been facing some problems with what I am trying to achieve. I have a stack that contains multiple DICOM images (slices). What I am trying to do (ie. what I want imagej to do for me every time I have a stack) is find somehow the slice (sometimes it is more than one) that contains the maximum intensity and then extract it from the stack but I don't know how to do.

It would be much appreciated if someone could help me.

Thank you very much in advance.

Eri
Reply | Threaded
Open this post in threaded view
|

Re: obtaining the slice with the maximum intensity

John Soong-2
What do you mean by maximum intensity? In a certain region of interest,
obtained by summing up all the intensity values? With the highest median
intensity?

2013/7/20 Eri <[hidden email]>

> Hi to everyone,
>
> I am using imagej for my project and I have been facing some problems with
> what I am trying to achieve. I have a stack that contains multiple DICOM
> images (slices). What I am trying to do (ie. what I want imagej to do for
> me
> every time I have a stack) is find somehow the slice (sometimes it is more
> than one) that contains the maximum intensity and then extract it from the
> stack but I don't know how to do.
>
> It would be much appreciated if someone could help me.
>
> Thank you very much in advance.
>
> Eri
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/obtaining-the-slice-with-the-maximum-intensity-tp5004051.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Yanping Soong
Chemistry UVA '13
www.autonomous-aesthetic.com

"Every difference of opinion is not a difference of principle. We have
called by different names brethren of the same principle. We are all
Republicans, we are all Federalists." -- Thomas Jefferson

We want structures that serve people, not people serving structures.
(l'Odéon, mai '68)

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

Re: obtaining the slice with the maximum intensity

Eri
Every stack of images/slices that I have, always has an image (it may be two) that has the highest number of counts per pixel, not specifically a region of interest but the whole image. What I want is to somehow find this image and then extract it from the stack. I hope you understand now what I mean!
Reply | Threaded
Open this post in threaded view
|

Re: obtaining the slice with the maximum intensity

Justin Senseney
Hi Eri,

From the main ImageJ menu, try Image->Stacks->Tools...->Grouped Z
Project... and use the Maximum Intensity projection method. Though that
doesn't tell you which slice these intensity values were located at, does
that help?

-Justin Senseney


On Sat, Jul 20, 2013 at 12:12 PM, Eri <[hidden email]> wrote:

> Every stack of images/slices that I have, always has an image (it may be
> two)
> that has the highest number of counts per pixel, not specifically a region
> of interest but the whole image. What I want is to somehow find this image
> and then extract it from the stack. I hope you understand now what I mean!
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/obtaining-the-slice-with-the-maximum-intensity-tp5004051p5004053.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: obtaining the slice with the maximum intensity

Eri
Hi Justin,

I have already tried that but it does not do what I want. I don't want the maximum counts/intensity from every image in the stack but to find the image that has the maximum counts.

Anyway, thank you very much for trying to help!

Eri
Reply | Threaded
Open this post in threaded view
|

Re: obtaining the slice with the maximum intensity

John Dunsmuir
In reply to this post by Eri
Eri,

Below is the source for a simple plugin to find the the maximum brightness slice in a stack.  You will probably need to make some changes to it to make it do exactly what your want like finding multiple slices but it will get you started.  Use Compile and Run to create the .class file in your plugins folder.  When you restart imageJ the plugin should appear in the Plugins pull down menu.

John D.

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;
import ij.measure.*;

public class Get_Max_Pixel implements PlugInFilter
{
        ImagePlus imp;

        public int setup(String arg, ImagePlus imp)
        {
                this.imp = imp;
                return DOES_ALL;
        }

        public void run(ImageProcessor ip)
        {
                int i,j,k;
                double maxVal = -70000.0;
                double minVal = 70000.0;
                double data;
                long count = 0;

                ImageStack stack = imp.getStack();

                int width = stack.getWidth();
  int height = stack.getHeight();
  int depth = stack.getSize();
                int iMax =0;
                int jMax =0;
                int kMax =0;
                int iMin =0;
                int jMin =0;
                int kMin =0;


                IJ.showStatus("Finding Max Pixel");
                for(k=0;k<depth;k++)
                {
                        IJ.showProgress((double)k/(double)depth);
                        for(j=0;j<height;j++)
                        {
                                for(i=0;i<width;i++)
                                {
                                        data = stack.getVoxel(i,j,k);
                                        if(data !=0) count++;
                                        if(data>maxVal )
                                        {
                                                maxVal = data; //find the value and location of the largest value
                                                iMax=i;
                                                jMax=j;
                                                kMax=k;
                                        }
                                        if(data<minVal  && data !=0)
                                        {
                                                minVal = data; //find the value and location of the smallest value
                                                iMin=i;
                                                jMin=j;
                                                kMin=k;
                                        }
                                }
                        }
                }

                StackWindow sw = new StackWindow(imp);
                sw.showSlice(kMax+1);

                IJ.run("Specify...", "width=1 height=1 x="+iMax+" y="+jMax+" slice="+kMax);

                ResultsTable rt = new ResultsTable();

                rt = rt.getResultsTable();
                rt.incrementCounter();
                rt.addValue("Max Radius pixels",maxVal);
                rt.addValue("iMax",iMax);
                rt.addValue("jMax Val",jMax);
                rt.addValue("kMax Val",kMax+1);
       
                //rt.addValue("Min Radius pixels",minVal);
                //rt.addValue("iMin",iMin);
                //rt.addValue("jMin Val",jMin);
                //rt.addValue("kMin Val",kMin+1);
                //rt.addValue("Flooded Pixels",count);
                //rt.show("Results");
        }
}

<quote author="Eri">
Every stack of images/slices that I have, always has an image (it may be two) that has the highest number of counts per pixel, not specifically a region of interest but the whole image. What I want is to somehow find this image and then extract it from the stack. I hope you understand now what I mean!
Eri
Reply | Threaded
Open this post in threaded view
|

Re: obtaining the slice with the maximum intensity

Eri
Thank you very much John!! I think that this will help me a lot!!