Login  Register

Re: Stack? Flatten? Overlay? How to superimpose mask

Posted by dscho on Nov 30, 2012; 7:59pm
URL: http://imagej.273.s1.nabble.com/Stack-Flatten-Overlay-How-to-superimpose-mask-tp5001011p5001012.html

Hi Sheryn,

On Thu, 29 Nov 2012, Sheryn Olson wrote:

> I need to quantify % coverage of vegetation, snow over an image of a
> snowshoe hare.  I believe I need to mask the hare outline, but short of
> drawing an outline on the photo, I can't determine how.   The
> quantification part will be simple.  But I'm struggling with defining the
> region of interest.   One person suggested convolution, another suggested
> drawing the outline, but the problem is - I don't always have the whole
> hare visible, so it needs to be outlined or masked with a predefined
> outline.

I played around a little with your example, and it seems that there is no
straight-forward, automatic way to determine the ROI.

So a manual way to define the ROI would be to right-click on the tiny
small triangle in the oval icon (the second tool from the left in the
toolbar), select the Selection Brush Tool, then double-click on the icon
and set the radius to something like 60 pixels.

Now you can draw the outline of the hare; this will create a selection
that you can fill using this little macro:

-- snip --
original = getImageID();
setBatchMode(true);
newImage("dummy", "8-bit black", getWidth(), getHeight(), 1);
run("Restore Selection");
setColor(255);
fill();
run("Select None");
run("Fill Holes");
run("Create Selection");
close();
selectImage(original);
setBatchMode(false);
run("Restore Selection");
-- snap --

> My roi file is a clean outline of the hare, but how to match it to the
> photo(s)?.    I don't know how to manipulate the ROI to match the hare
> outline in the photo;  I can move the ROI and resize it, but not "pull"
> it out of proportion to match the photo.    (a click and drag would be
> great!)

Note that it is very easy to correct the ROI by holding down the Shift key
to add to the selection and holding down the Alt key to remove from the
selection.

For the click and drag, you probably want a new style of selections, most
likely Snakes (also known as Active Contours). You might be able to make
good use of EPFL's ESnakes: http://bigwww.epfl.ch/algorithms/esnake/

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html