Macro to draw oval inside object

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

Macro to draw oval inside object

Matthew Jones-2
Hello,

Is it possible to write a macro to draw an oval inside a circular object in an image (DICOM), so the oval is about 75% the size of the object? The “Find Edges” command finds the edges of the object fine, but how can the macro access the coordinates of those edges, to work out 75% of that?

I ask because I’m trying to write a macro to analyse the quality of an MRI phantom image.

Thanks

Matthew


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro to draw oval inside object

Straatman, Kees (Dr.)
Dear Matthew,

You could try something like:

roiManager("Add");
getStatistics(area);
n = 0.75*area;
do{
        run("Enlarge...", "enlarge=-1 pixel");
        getStatistics(area1);
}while(area1>n)
roiManager("Add");
perc = 100*area1/area;
print(perc+"%");

Draw a ROI on an image and run the code. It works on any ROI. The area will always be below 75% in this example. How much will depend on how large the original area was; the smaller the larger the difference will be.

Best wishes

Kees

Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif




-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Matthew Jones
Sent: 08 September 2017 19:42
To: [hidden email]
Subject: Macro to draw oval inside object

Hello,

Is it possible to write a macro to draw an oval inside a circular object in an image (DICOM), so the oval is about 75% the size of the object? The "Find Edges" command finds the edges of the object fine, but how can the macro access the coordinates of those edges, to work out 75% of that?

I ask because I'm trying to write a macro to analyse the quality of an MRI phantom image.

Thanks

Matthew


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

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