Login  Register

Re: ROI questions...

Posted by Weller Andrew Francis on Jun 23, 2006; 2:49pm
URL: http://imagej.273.s1.nabble.com/Basic-ROI-questions-tp3702395p3702402.html

In essence, at each 'processing' point in my macro I want to store (not
necessarily save) the result (ROI, image, etc) which can be called when
ANDing, etc later in my macro. So for example, if I:

doWand(getResult("XStart",index), getResult("YStart",index));

I want to store that ROI as a variable which can be called later in my
macro for subsequent processing/saving. I've searched the archives for
an answer to no avail...

Any clues?

Many thanks, Andy

On Fri, 2006-06-23 at 13:45 +0200, Andy Weller wrote:

> Dear all,
>
> I have a basic macro that reads images in a batch and segments them; I
> want to add analysis later.
>
> I'm currently a little lost as to how to work with both the ROI
> (morphology, texture) and how to delete the background from my original
> image.
>
> I currently have a function threshold() that returns the doWand of my
> thresholded image. As Wayne says I need to AND the original image with
> the "Masks" image generated by the particle analyzer to delete the
> background. For this I have:
>
> image = open(fileName); // sets original image
> mask = threshold(); // returns thresholded image
> threshImg = image & mask; // deletes background
> open(threshImg); // open image
>
> This is not working though, perhaps there is an obvious reason, but it
> ain't so obvious to me at present!?
>
> I am slowly getting more 'in' to ImageJ and the more I play, the more I
> like, but some 'simple' things aren't so simple to me.
>
> Cheers, Andy
>
> On Mon, 2006-06-12 at 15:59 -0400, Wayne Rasband wrote:
> > > I apologise for the basic questions, but something I've yet to get
> > > accustomed to is ROI management in ImageJ.
> > >
> > > In essence, I have an image with a particle of interest in. I segment
> > > the foreground/background using the 'Mixture Modeling' plugin
> > > (http://rsb.info.nih.gov/ij/plugins/mixture-modeling.html).
> > >
> > > How do I eliminate smaller ROIs? (Or select the largest one,
> > > presuming it's the particle I am after?)
> >
> > The particle analyzer will eliminate smaller objects if you set a
> > minimum size in the dialog and choose "Masks" from the drop down menu.
> > You would need a macro something like this to find the largest object:
> >
> >      max = 0;
> >      for (i=0; i<nResults; i++) {
> >          area = getResult("Area", i);
> >          if (area>max) {
> >              max = area;
> >              index = i;
> >          }
> >     }
> >     doWand(getResult("XStart",index), getResult("YStart",index));
> >
> > This macro assumes that that "Record Starts" was checked in the
> > particle analyze dialog and areas are in pixels.
> >
> > > How do I delete the background from my original image?
> >
> > AND the original image with the "Masks" image generated by the particle
> > analyzer.
> >
> > > How do I select my particle with a bounding box and save as a new
> > > (smaller) image?
> >
> > Create a rectangular ROI and then use the Image>Duplicate command.
> >
> > > Can I save the ROI as well for future reference?
> >
> > Use File>Save As>Selection to save the ROI.
> >
> > > I would then like to do some morphological analysis on the ROI.
> > >
> > > I hope someone can point me in the right direction?
> > >
> > > Many thanks, Andy