Login  Register

Re: ROI questions...

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

Sorry, I can't get my head round this... Basically, my macro has:

run("Crop"); // A cropped image
threshold(); // This is threshold with my function

What I would like to do is this:

Fit a bounding box to crop this newly threshold image:

getSelectionBounds(x, y, width, height);
makeRectangle(x, y, width, height);
run("Crop");
roiManager("Add"); // The ROI found from the threshold is added to the
manager

AND the new run("Crop") image with the roiManager("Add") ROI to delete
the background. I guess using:

imageCalculator("AND create", CropImage, ROI);

I would like to save both the newly cropped-to-ROI and deleted
background image AND the ROI. This will allow me to open these 2 in the
future to do some analyses on them - morphological, textural, etc.

I hope this makes sense and that someone can help me out?!

Thanks, Andy

On Fri, 2006-06-23 at 10:16 -0400, Wayne Rasband wrote:

> > 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...
>
> Save the ROIs in the ROI Manager. Here are some example macros that do
> this:
>
>        http://rsb.info.nih.gov/ij/macros/RoiManagerMacros.txt
>        http://rsb.info.nih.gov/ij/macros/ROI_Manager_Stack_Demo.txt
>        http://rsb.info.nih.gov/ij/macros/RoiManagerAddParticles.txt
>
> The ROI Manager macro functions are described at:
>
>      
> http://rsb.info.nih.gov/ij/developer/macro/functions.html#roiManager
>
> -wayne