Ring Shaped ROIs

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

Ring Shaped ROIs

Carl Sebeny
A ring shaped ROI can be defined manually by using the Oval selection
tool twice: once to create an outer circular selection and again to
subtract an inner Oval selection ("alt" key down) from the outer circle.
Processes such as "clear" and "invert" affect the pixels within the ring
shaped region bounded by the two oval selections without affecting
pixels interior to the smaller oval (the donut hole). .

 

The macro language does not seem to provide the capability to define
such a ring shaped ROI. The following statements always result in the
creation of a single oval selection corresponding to the second
"makeOval" statement:

 

            makeOval(x1, y1, width1, height1);

            setKeyDown("alt");

            makeOval(x2, y2, width2, height2);

 

The second "makeOval" statement is not affected by the "setKeyDown"
statement. The same result is obtained with and without the "setKeyDown"
statement.

 

Is there a way to define a ring shaped ROI with the macro language?

 

Carl Sebeny,

Applied Vision Company

 
Reply | Threaded
Open this post in threaded view
|

Re: Ring Shaped ROIs

Jim Passmore
ImageJ Interest Group <[hidden email]> wrote on 03-14-2006 12:42:20
PM:


>
>
> Is there a way to define a ring shaped ROI with the macro language?


Carl,

Assuming your ring is the same thickness on all sides, you could try
something like this:

getPixelSize(unit, pw, ph, pd);
makeOval(x2, y2, width2, height2);
bandSizePixels="band="+d2s((width1-width2)*pw/2,0)
run("Make Band...", bandSizePixels);

This is a little awkward, as the "Make Band" command uses calibrated
distances, and makeOval uses pixel values, so you have to convert with the
values obtained with getPixelSize.

There may be other ways--this came to mind first.  Hope it helps.

Jim

----------------------------------------------
Jim Passmore
Research Associate
Cryovac, Sealed Air Corporation
[hidden email]
864-433-2927 voice
864-433-2205 fax
----------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Ring Shaped ROIs

Wayne Rasband
In reply to this post by Carl Sebeny
> A ring shaped ROI can be defined manually by using the Oval
> selection tool twice: once to create an outer circular
> selection and again to subtract an inner Oval selection
> ("alt" key down) from the outer circle. Processes such as
> "clear" and "invert" affect the pixels within the ring
> shaped region bounded by the two oval selections without
> affecting pixels interior to the smaller oval (the donut
> hole). .
>
> The macro language does not seem to provide the capability
> to define such a ring shaped ROI. The following statements
> always result in the creation of a single oval selection
> corresponding to the second "makeOval" statement:
>
>             makeOval(x1, y1, width1, height1);
>             setKeyDown("alt");
>             makeOval(x2, y2, width2, height2);
>
> The second "makeOval" statement is not affected by the
> "setKeyDown" statement. The same result is obtained with
> and without the "setKeyDown"statement.
>
> Is there a way to define a ring shaped ROI with the macro language?

This worked in ImageJ 1.33 but I removed this feature because of some
nasty side effects. It's working again, however, in 1.37a.

You can also add selections using setKeyDown("shift"). There is an
example macro at

     http://rsb.info.nih.gov/ij/macros/CompositeSelections.txt

that uses makeOval(), makeRectangle() and makePolygon() to create
composite selections.

-wayne
Reply | Threaded
Open this post in threaded view
|

Getting 1.37a

Christopher Coulon
> It's working again, however, in 1.37a.

Where can we get 1.37a?  The upgrade website currently contains ij.jar
version 1.36b.

Chris Coulon
       

The GAIA Group
Global Automated Image Analysis
http://www.gaiag.net
[hidden email]


We welcome image analysis problems in all fields.

Christopher Coulon, Ph.D., Founder
415 515-3379
Reply | Threaded
Open this post in threaded view
|

Re: Getting 1.37a

Wayne Rasband
> Where can we get 1.37a?  The upgrade website
> currently contains ij.jar version 1.36b.

Daily (hourly?) builds of ImageJ are available at

     http://rsb.info.nih.gov/ij/ij.jar

This the same ij.jar used by the applet versions of ImageJ at

     http://rsb.info.nih.gov/ij/applets.html

-wayne