Login  Register

Re: Draw circles on pre-defined point annotations in an image and measure the area/readius of these circles

Posted by Marien Koen on Feb 04, 2014; 12:56pm
URL: http://imagej.273.s1.nabble.com/Draw-circles-on-pre-defined-point-annotations-in-an-image-and-measure-the-area-readius-of-these-circs-tp5006356p5006399.html

Thanks Michael! Looks great. I am a total newbie, but I try to work it out!

Best regards
Koen

ir. Koen Marien

Imaging Scientist, PhD student

Lab building, 1st floor (campus ZNA Middelheim)

Lindendreef 1, 2020 Antwerpen (Belgium)        Phone: +32 (0)3 218 19 17

https://www.uantwerp.be/en/staff/koen-marien/

________________________________________
Van: ImageJ Interest Group [[hidden email]] namens Michael Schmid [[hidden email]]
Verzonden: maandag 3 februari 2014 16:12
Aan: [hidden email]
Onderwerp: Re: Draw circles on pre-defined point annotations in an image and measure the area/readius of these circles

Hi Koen,

what you can do:

You can save the (multi-) point selection with Save As>Selection or using the ROI Manager. To see how it is done in a macro, use Plugins>Macro>Record.

Load the selection, and write a macro:
  getSelectionCoordinates(xpoints, ypoints);
gives you the coordinates. Then make sure the ROI mamager is empty:
  roiManager("Delete");
Have a loop, e.g.,
  radius=2;
  for (i=0; i<lengthOf(xpoints); i++) {
    makeOval(xpoints[i]-radius, ypoints[i]-radius, 2*radius, 2*radius);
    roiManager("Add");
  }
  roiManager("Show All");
  waitForUser("Select each circle, then CTRL-SHIFT-drag handles to enlarge.\nOK when done.");

//(mind the line break possibly introduced by the mailer; the waitForUser command should be one line)

With 'Show All' in the Roi Manager, you can click on each selection to make it active, then drag its handles with the SHIFT and CTRL keys down to enlarge it to the desired size. (Mac: shift and cmd keys down). CTRL keeps the center and SHIFT constrains it to a circle.
If you want to have all circles with the same size, this is not necessary, of course.

Finally, have a loop
  for (i=0; i<roiManager("count"); i++) {
    roiManager("select", i);
    getSelectionBounds(x, y, width, height);
    //and do whatever you want: measure, print something to the log,
    //or whatever.
  }
If you just want to measure, you need no loop, just use
  roiManager("Multi Measure");

See the description of the macro functions:
  http://rsb.info.nih.gov/ij/developer/macro/functions.html

Make sure you update ImageJ to the latest daily build; there was a bug possibly affecting macro recording of saving rois.

Michael
________________________________________________________________
On Jan 31, 2014, at 15:28, Marien Koen wrote:

> Hi there
>
>
> I want to do a study that measures the influence of the size of regions of interest (ROIs) and want to do the following:
>
> 1) create multiple (n=10-20) point annotations in images and save them, allowing to go to them when later opening the image again
> 2) draw circles on these point annotations but in such a way that a point annotation is the centre of the circle
> 3) remember the radius/area/perimeter of these circles and export them in a structured way
>
> Ideally I can do this on my very big images (Mirax files), but it may also be possible to create some images (.jpg, .bmp, ...) of certain regios in the Mirax file and do the circle drawing on these.
>
>
> All help and suggestions welcome
>
> Thanks!
> Koen
>
>
>
> ir. Koen Marien
>
> Imaging Scientist, PhD student
>
> Lab building, 1st floor (campus ZNA Middelheim)
>
> Lindendreef 1, 2020 Antwerpen (Belgium)        Phone: +32 (0)3 218 19 17
>
> https://www.uantwerp.be/en/staff/koen-marien/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

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