Creating 4 quadrant ROIs based on centroid

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

Creating 4 quadrant ROIs based on centroid

Margaret Johnson
Hello,
I am new to the community. As such, I appreciate any advice in not abusing
this mailing list as well as helping the community.  For example, the
question I have may not be appropriate.  I tried to find an answer.  Please
let me know if I am abusing this list.

My challenge is to divide an irregular shape (a leaf) into 4 quadrants,
with the centroid being the mid-division.  Then put the pixels from each
quadrant into it's own ROI.

I can easily get the centroid.  It is not clear to me how to make the 4
ROIs.  Advice appreciated.

Thank you.

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

Re: Creating 4 quadrant ROIs based on centroid

Mark J. Chopping
Hi Margaret,

You could use thresholding to isolate the leaf area; then use the
Particle Analyser to get the smallest rectangle that encompasses
the leaf; then use knowledge of the width, height, and location of that
rectangle to define the quadrants. This is probably best done with a
macro:

  setThreshold(low, high); // or other operations to isolate the leaf
  run("Make Binary");
  run("Set Measurements...", "area bounding redirect=None decimal=2");
  run("Analyze Particles...", "size="+ minsize+"-"+maxsize+" circularity=0.00-1.00 show=Nothing display exclude clear");
  // where minsize and maxsize are variables with your limits

  // then, assuming only one leaf "particle" was isolate in the image
  wid= getResult('Width', 1);
  x = floor(getResult('BX', 1));
  y = floor(getResult('BY', 1));

  // do some calculations to get the location of the quadrants, then:

  makeRectangle(x1, y1, qwidth, qheight);
  makeRectangle(x2, y2, qwidth, qheight);
  makeRectangle(x3, y3, qwidth, qheight);
  makeRectangle(x4, y4, qwidth, qheight);

You can calculate the quadrants based on your centroid and knowledge of
the leaf-enclosing rectangle dimensions, or based on the location of the
leaf-enclosing rectangle itself; I do not know which one makes more sense
for your application.

  Best wishes,

   Mark

  Mark Chopping, Ph.D.
  Department of Earth & Environmental Studies
  Montclair State University, Montclair, NJ 07043
  It's All Here!
  http://www.montclair.edu/csam/remote-sensing-lab/

----

> Date: Sun, 2 Oct 2016 13:33:30 -0700
> From: Margaret Johnson <[hidden email]>
> Reply-To: [hidden email]
> To: [hidden email]
> Subject: Creating 4 quadrant ROIs based on centroid
>
> Hello,
> I am new to the community. As such, I appreciate any advice in not abusing
> this mailing list as well as helping the community.  For example, the
> question I have may not be appropriate.  I tried to find an answer.  Please
> let me know if I am abusing this list.
>
> My challenge is to divide an irregular shape (a leaf) into 4 quadrants,
> with the centroid being the mid-division.  Then put the pixels from each
> quadrant into it's own ROI.
>
> I can easily get the centroid.  It is not clear to me how to make the 4
> ROIs.  Advice appreciated.
>
> Thank you.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: Creating 4 quadrant ROIs based on centroid

ved sharma
In reply to this post by Margaret Johnson
Hi Margaret,

If (X, Y) is the leaf centroid, then one of the leaf quadrant ROI would be the intersection (AND operation in the ROI Manager) of leaf ROI and the rectangle made by makeRectangle(0, 0, X, Y). Does that make sense?

Ved
___________________________________
Ved Sharma, PhD
Department of Anatomy and Structural Biology
Albert Einstein College of Medicine
Bronx, New York

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

Re: Creating 4 quadrant ROIs based on centroid

Margaret Johnson
Hello Dr. (Ved) Sharma and Dr. (Mark) Chopping,
Both of you were extremely helpful when I got stuck on how to proceed
within an ImageJ macro I was writing.  THANK YOU.  In case of interest, I
wrote up how I used ImageJ in this blog post.
<https://bitknitting.wordpress.com/2016/10/08/detecting-chlorosis-using-image-processing/>

Kind regard,
Margaret.

On Tue, Oct 4, 2016 at 11:38 AM, Ved Sharma <[hidden email]> wrote:

> Hi Margaret,
>
> If (X, Y) is the leaf centroid, then one of the leaf quadrant ROI would be
> the intersection (AND operation in the ROI Manager) of leaf ROI and the
> rectangle made by makeRectangle(0, 0, X, Y). Does that make sense?
>
> Ved
> ___________________________________
> Ved Sharma, PhD
> Department of Anatomy and Structural Biology
> Albert Einstein College of Medicine
> Bronx, New York
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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