I want to calculate equivalent ellipse from particle area and have a couple
of questions: (1) is there a consensus on what criteria to use for major axis, or is it better derived from aspect ratio (eg, from minimum bounding rectangle)? (2) I'm using a spreadsheet initially, and am hoping that I don't need to "re-invent the wheel" (. it's been too long since algebra! .<g>.). I'm looking for formulas for eq.ellipse from area and major axis, as well as ellipsoid from ellipse. TIA :) |
On Sunday 17 January 2010 14:16:50 you wrote:
> (2) I'm using a spreadsheet initially, and am hoping that I don't need to > "re-invent the wheel" (. it's been too long since algebra! .<g>.). I'm > looking for formulas for eq.ellipse from area and major axis, as well as > ellipsoid from ellipse. In the particles8 plugin I compute that as: EquivEllipseAr: Equivalent Ellipse Area = (Pi*Feret*Breadth)/4, this is the area of an ellipse with the same long and short axes as the particle, G. |
I have a stack of thresholded images. I need to divide the stack into a grid of regions of interest (ROIs), then I need to calculate area fraction in each ROI for each image in the stack.
Any suggestions on how to do this would be appreciated. Thank you! Frank Shaffer National Energy Technology Lab |
Hi Frank
This macro does roughly what you want. It iterates an ROI over the stack and gets the area fraction each time. If you want more or fewer ROI's, change the roiWidth and roiHeight calculations. ----------------- roiWidth = getWidth() / 10; roiHeight = getHeight() / 10; row = 0; for (s = 1; s <= nSlices(); s++){ setSlice(s); for (y = 0; y < getHeight()-roiHeight; y += roiHeight){ for (x = 0; x < getWidth()-roiWidth; x += roiWidth){ makeRectangle(x, y, roiWidth, roiHeight); getStatistics(area, mean, min, max, std, histogram); areaFraction = histogram[255]/(histogram[255] + histogram[0]); setResult("Slice", row, s); setResult("x", row, x); setResult("y", row, y); setResult("AF", row, areaFraction); row++; } } } updateResults(); --------- Michael On 17/01/2010 17:25, Franklin Shaffer wrote: > I have a stack of thresholded images. I need to divide the stack into a grid of regions of interest (ROIs), then I need to calculate area fraction in each ROI for each image in the stack. > > Any suggestions on how to do this would be appreciated. > > Thank you! > Frank Shaffer > National Energy Technology Lab |
Dear Michael,
Your macro does exactly what I needed. Thank you for your help. I use ImgeJ daily and I am now convinced now that I need to learn to write plugins and marcos. ImageJ is a wonderful tool and a great example of how a research community can work together. Once again, sincere thanks" Frank Shaffer USDOE National Energy Technology Laboratory >>> "Michael Doube" <[hidden email]> 1/18/2010 6:06 AM >>> Hi Frank This macro does roughly what you want. It iterates an ROI over the stack and gets the area fraction each time. If you want more or fewer ROI's, change the roiWidth and roiHeight calculations. ----------------- roiWidth = getWidth() / 10; roiHeight = getHeight() / 10; row = 0; for (s = 1; s <= nSlices(); s++){ setSlice(s); for (y = 0; y < getHeight()-roiHeight; y += roiHeight){ for (x = 0; x < getWidth()-roiWidth; x += roiWidth){ makeRectangle(x, y, roiWidth, roiHeight); getStatistics(area, mean, min, max, std, histogram); areaFraction = histogram[255]/(histogram[255] + histogram[0]); setResult("Slice", row, s); setResult("x", row, x); setResult("y", row, y); setResult("AF", row, areaFraction); row++; } } } updateResults(); --------- Michael On 17/01/2010 17:25, Franklin Shaffer wrote: > I have a stack of thresholded images. I need to divide the stack into a grid of regions of interest (ROIs), then I need to calculate area fraction in each ROI for each image in the stack. > > Any suggestions on how to do this would be appreciated. > > Thank you! > Frank Shaffer > National Energy Technology Lab |
Free forum by Nabble | Edit this page |