Re: generate ROIs around X,Y co-ordinate list

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

Re: generate ROIs around X,Y co-ordinate list

dpoburko
Hi All,

  I am trying to automate segmentation of small fluorescence events. In
the process, I was planing on using the Analyze particles to help with
this job. So far so good. But I am wondering how I might go about using
the centroid X.Y position from the particle analysis to then go back and
create ROIs of a predetermined size around the list of centroid
co-ordinates. In theory this shouldn't be hard, but I'm at a loss for
how to code it (i.e. gather the XY list from the results table and hand
it to the ROI manager or generate regions).

Thanks,
Damon

--

Damon Poburko, PhD
Postdoctoral Research Fellow
Stanford University School of Medicine
Dept. of Molecular & Cellular Physiology
279 Campus Dr., Beckman B103, Stanford, CA 94305
Ph: 650 725 7564, fax: 650 725 8021
Reply | Threaded
Open this post in threaded view
|

Re: generate ROIs around X,Y co-ordinate list

Wayne Rasband
> Hi All,
>
>  I am trying to automate segmentation of small fluorescence events. In
> the process, I was planing on using the Analyze particles to help with
> this job. So far so good. But I am wondering how I might go about
> using the centroid X.Y position from the particle analysis to then go
> back and create ROIs of a predetermined size around the list of
> centroid co-ordinates. In theory this shouldn't be hard, but I'm at a
> loss for how to code it (i.e. gather the XY list from the results
> table and hand it to the ROI manager or generate regions).

You can do this using a macro that retrieves the X and Y coordinates
from the Results table and uses them to generate ROIs of a
predetermined size. This example runs the particle analyzer on the
blobs sample image and, for each particle found, generates a radius 15
circular ROI and adds it to the ROI Manager.

   radius = 15;
   run("Blobs (25K)");
   setAutoThreshold();
   run("Set Measurements...", "area mean centroid redirect=None");
   run("Analyze Particles...", "size=0 circularity=0.00 display exclude
clear");
   resetThreshold();
   roiManager("reset");
   for (i=0; i<nResults; i++) {
      x = getResult("X", i);
      y = getResult("Y", i);
      makeOval(x-radius, y-radius, radius*2, radius*2);
      run("Add to Manager ");
   }
   setOption("Show All",true);

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

Re: generate ROIs around X,Y co-ordinate list

dpoburko
Wayne Rasband wrote:

>> Hi All,
>>
>>  I am trying to automate segmentation of small fluorescence events.
>> In the process, I was planing on using the Analyze particles to help
>> with this job. So far so good. But I am wondering how I might go
>> about using the centroid X.Y position from the particle analysis to
>> then go back and create ROIs of a predetermined size around the list
>> of centroid co-ordinates. In theory this shouldn't be hard, but I'm
>> at a loss for how to code it (i.e. gather the XY list from the
>> results table and hand it to the ROI manager or generate regions).
>
> You can do this using a macro that retrieves the X and Y coordinates
> from the Results table and uses them to generate ROIs of a
> predetermined size. This example runs the particle analyzer on the
> blobs sample image and, for each particle found, generates a radius 15
> circular ROI and adds it to the ROI Manager.
>
>   radius = 15;
>   run("Blobs (25K)");
>   setAutoThreshold();
>   run("Set Measurements...", "area mean centroid redirect=None");
>   run("Analyze Particles...", "size=0 circularity=0.00 display exclude
> clear");
>   resetThreshold();
>   roiManager("reset");
>   for (i=0; i<nResults; i++) {
>      x = getResult("X", i);
>      y = getResult("Y", i);
>      makeOval(x-radius, y-radius, radius*2, radius*2);
>      run("Add to Manager ");
>   }
>   setOption("Show All",true);
>
> -wayne
Wayne & Chris,

Perfect. That was exactly what I was looking for. That saved me a lot of
time.

Many thanks,
Damon
Reply | Threaded
Open this post in threaded view
|

Re: generate ROIs around X,Y co-ordinate list

Schebique
Hi.

may be you can find this code also usefull:

// This macro demonstrates how to add particle analyzer
// outlines to the ROI Manager. Note that doWand() may
// not work reliably unless the objects being traced
// have been highlighted in red using setThreshold().

requires("1.33f");
for (i=0; i<nResults; i++) {
    x = getResult('XStart', i);
    y = getResult('YStart', i);
    doWand(x,y);
    roiManager("add");
}


Damon Poburko napsal(a):

> Wayne Rasband wrote:
>>> Hi All,
>>>
>>>  I am trying to automate segmentation of small fluorescence events.
>>> In the process, I was planing on using the Analyze particles to help
>>> with this job. So far so good. But I am wondering how I might go
>>> about using the centroid X.Y position from the particle analysis to
>>> then go back and create ROIs of a predetermined size around the list
>>> of centroid co-ordinates. In theory this shouldn't be hard, but I'm
>>> at a loss for how to code it (i.e. gather the XY list from the
>>> results table and hand it to the ROI manager or generate regions).
>>
>> You can do this using a macro that retrieves the X and Y coordinates
>> from the Results table and uses them to generate ROIs of a
>> predetermined size. This example runs the particle analyzer on the
>> blobs sample image and, for each particle found, generates a radius
>> 15 circular ROI and adds it to the ROI Manager.
>>
>>   radius = 15;
>>   run("Blobs (25K)");
>>   setAutoThreshold();
>>   run("Set Measurements...", "area mean centroid redirect=None");
>>   run("Analyze Particles...", "size=0 circularity=0.00 display
>> exclude clear");
>>   resetThreshold();
>>   roiManager("reset");
>>   for (i=0; i<nResults; i++) {
>>      x = getResult("X", i);
>>      y = getResult("Y", i);
>>      makeOval(x-radius, y-radius, radius*2, radius*2);
>>      run("Add to Manager ");
>>   }
>>   setOption("Show All",true);
>>
>> -wayne
> Wayne & Chris,
>
> Perfect. That was exactly what I was looking for. That saved me a lot
> of time.
>
> Many thanks,
> Damon
>