Analyze particles for pixel aspect ratio != 1

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

Analyze particles for pixel aspect ratio != 1

Barcelo, Steven
Hello all,

I am trying to measure the size of spherical particles from an SEM image with rectangular pixels.  Fit Ellipse seems like a good option, but only works if I manually set the pixel aspect ratio to 1 in set scale (which I'm sure introduces some other error).  Since the particles are not perfect circles in the image, Feret's diameter does not seem like a great option (assuming I am right that it measures the maximum diameter).
In brief:
Is there a way to use Fit Ellipse for an image with rectangular pixels?
Are there better ways to measure particle size that I'm overlooking?

Thanks,
Steven Barcelo
Reply | Threaded
Open this post in threaded view
|

Re: Analyze particles for pixel aspect ratio != 1

Lim Soon Yew
Hi All,

I had wrote a macro that measure the radius based on the centroids and boundaries of the segmented particles. I am not sure if this is the best way to do it? If anyone knows a better method, please let me know.
Regards, John

//*Created by Lim Soon Yew (John), dated 8 Aug 2010
//**This macro measure the radius of segmented particles based on the centroid and boundary.
//***The unit of radius is pixel. Line 6 to 9 loads an example image, Line 11 onwards is the actual macros
//****Ignore the zeros at the end, there are not real due to the variable perimeter of the boundaries.

run("Blobs (25K)"); //Load a sample image
setAutoThreshold("Default");
//run("Threshold...");
run("Analyze Particles...", "size=150-Infinity circularity=0.00-1.00 show=[Overlay Outlines] exclude clear add");

particle=roiManager("count");
dir=getDirectory("temp");
name="nucleus";
setBatchMode(true);
run("Clear Results");
run("Set Measurements...", "  centroid redirect=None decimal=3");
for(p=0;p<=particle-1;p++) {
roiManager("Select", p);
saveAs("XY Coordinates", dir+name+p+1+".txt");
roiManager("Measure");
}
xcenter = newArray(p);
ycenter = newArray(p);
for(n=0;n<=p-1;n++) {
xcenter[n]=getResult("X", n);
ycenter[n]=getResult("Y", n);
}
run("Clear Results");
for(p=0;p<=particle-1;p++) {
run("Text Image... ", "open=["+dir+name+p+1+".txt]");
h=getHeight();
boundary_x=newArray(h);
boundary_y=newArray(h);
rx=newArray(h);rx2=newArray(h);
ry=newArray(h);ry2=newArray(h);
rxy=newArray(h);
radius=newArray(h);
for(n=0;n<=h-1;n++) {
boundary_x[n]=getPixel(0,n);
boundary_y[n]=getPixel(1,n);
rx[n]=boundary_x[n]-xcenter [p];rx2[n]=rx[n]*rx[n];
ry[n]=boundary_y[n]-ycenter [p];ry2[n]=ry[n]*ry[n];
rxy[n]=rx2[n]+ry2[n];
radius[n]=sqrt(rxy[n]);
setResult("Radius"+p+1, n, radius[n]);
File.delete(dir+name+p+1+".txt");
}
}
selectWindow("Log");
run("Close");
updateResults();

________________________________________
From: ImageJ Interest Group [[hidden email]] On Behalf Of Barcelo, Steven [[hidden email]]
Sent: Saturday, August 07, 2010 7:35 AM
To: [hidden email]
Subject: Analyze particles for pixel aspect ratio != 1

Hello all,

I am trying to measure the size of spherical particles from an SEM image with rectangular pixels.  Fit Ellipse seems like a good option, but only works if I manually set the pixel aspect ratio to 1 in set scale (which I'm sure introduces some other error).  Since the particles are not perfect circles in the image, Feret's diameter does not seem like a great option (assuming I am right that it measures the maximum diameter).
In brief:
Is there a way to use Fit Ellipse for an image with rectangular pixels?
Are there better ways to measure particle size that I'm overlooking?

Thanks,
Steven Barcelo