# Divide ROI in three equal ROI

3 messages
Open this post in threaded view
|
Report Content as Inappropriate

## Divide ROI in three equal ROI

 This post was updated on . Hello everyone. I am analyzing color in single teeth on the complete tooth, its upper, middle and lower third. For that I have created an ROI by selecting the full contour, and then I have calculated each third manually with the selection tools, but it is a bit cumbersome. Is there a faster way, perhaps through a macro? I need to create three new selections of the same height respecting the initial contour.
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Divide ROI in three equal ROI

 I think this does what you want. macro "cut into thirds vertically" {   roiManager("Add");   firstROI = roiManager("count")-1;   getSelectionBounds(x, y, width, height);   third = width / 3;   for (i=0; i<3; i++) {     makeRectangle (x+(i*third), y, third, height);     roiManager("Add");     roiManager("select", roiManager("count")-1);     roiManager("rename", "rectangle");     roiManager("select", newArray(firstROI, roiManager("count")-1));     roiManager("and");     roiManager("Add");     roiManager("deselect");     roiManager("select", roiManager("count")-2);     roiManager("delete");   } } _________________________________________ Michael Cammer, Optical Microscopy Specialist http://ocs.med.nyu.edu/microscopyhttp://microscopynotes.com/Cell: (914) 309-3270 ________________________________________ From: andres91 [[hidden email]] Sent: Monday, June 19, 2017 8:06 PM To: [hidden email] Subject: Divide ROI in three equal ROI Hello everyone. I am analyzing the color in single teeth in the complete tooth, its upper third, middle and lower. For that I have created an ROI by selecting the full contour, and then I have calculated each third manually with the selection tools, but it is a bit cumbersome. Is there a faster way, perhaps through a macro? I need to create three new selections of the same height respecting the initial contour. -- View this message in context: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.1557.x6.nabble.com_Divide-2DROI-2Din-2Dthree-2Dequal-2DROI-2Dtp5018932.html&d=DQICAg&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=2DSXQ8PqAC6VKbQFX5kLp10-ogyHqYZ5tdivc8iVg5A&s=w5Ey1BIKNLBm1oUkGvoYZmD0kI7S4qPTfe76-h69aHI&e=Sent from the ImageJ mailing list archive at Nabble.com. -- ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DQICAg&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=2DSXQ8PqAC6VKbQFX5kLp10-ogyHqYZ5tdivc8iVg5A&s=S7bCXvTId8mR8Zy8kQMeZLOEVtIZr4ywkn9r2dTSWnM&e=------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html