Posted by
Weller Andrew Francis on
Jun 23, 2006; 12:45pm
URL: http://imagej.273.s1.nabble.com/Basic-ROI-questions-tp3702395p3702397.html
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
> >