Quantcast

How to write macro that deletes ROI that meets certain criteria

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to write macro that deletes ROI that meets certain criteria

lihong.zhan
This post has NOT been accepted by the mailing list yet.
Hi forum,

This is my first post. I am wondering if anyone knows how to use macro code to edit a list of ROIs from ROI manager. Here is the task I want to achieve:

1) Generated ROIs of cells using analyze particles from ImageA.
2) Use the ROIs to measure grey value of a cell marker in imageB.
3) If an individual ROI has measurement of grey greater than 20, then delete this ROI.
4) Finalize the list of ROIs (which will all have value =<20 if measured against imageB).

I keep getting bug message after running these line below

for (i=1;i<roiManager("count");i++) {
        roiManager("Measure", i)>20;
        roiManager("Delete"); }


Really appreciate if anyone can help with this.

Lihong
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write macro that deletes ROI that meets certain criteria

AppleJus
Hi

Please try following:

for(i=0; i<roiManager("count"); i++){
      roiManager("select", i);
      run("Measure");
      if(getResult("Mean" > 20){
            roiManager("delete");
       }
}

It should hopefully more or less be what you are looking for !
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to write macro that deletes ROI that meets certain criteria

lihong.zhan
This post has NOT been accepted by the mailing list yet.
Hi AppleJus,

This is very helpful. I got it to work. Thank you very much.

Lihong
Loading...