Open ssgpers opened 3 years ago
I upload example data to (\cba\cba):\exchange\AliaksandrHalavatyi\Raquel-Drosophila-focus-3D-rotation
If we need to expose few parameters to the end user that need to be changed in each particular project, I can provide corresponding GUI
You only need the position in 2D, is that right?
Maybe we can try another approach, using StartDist for segmentation and MLJ for the Elliposid fitting:
Below macro worked for me for some old data (we still would have to test for the new data).
You could also give it a go if you want.
If it does not work out of the box, maybe down-sampling the image slightly could help.
/**
* Required Update Sites:
* - MorpholibJ
* - StartDist
* - CSBDeep
*
*/
run("Z Project...", "projection=[Max Intensity]");
rename("max");
//run("Brightness/Contrast...");
run("Enhance Contrast", "saturated=0.35");
run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2D], args=['input':'max', 'modelChoice':'DSB 2018 (from StarDist 2D paper)', 'normalizeInput':'true', 'percentileBottom':'1.0', 'percentileTop':'99.8', 'probThresh':'0.479071', 'nmsThresh':'0.3', 'outputType':'Label Image', 'nTiles':'1', 'excludeBoundary':'2', 'roiPosition':'Automatic', 'verbose':'false', 'showCsbdeepProgress':'false', 'showProbAndDist':'false'], process=[false]");
run("Analyze Regions", "area perimeter circularity euler_number bounding_box centroid equivalent_ellipse ellipse_elong. convexity max._feret oriented_box oriented_box_elong. geodesic tortuosity max._inscribed_disc average_thickness geodesic_elong.");
Thanks for the advice.
Essentially we need position in 3D and rotation.
But if position in 2D already known, Z can be found by finding slice of the maximum intensity in the local enighbourhood of the center.
Before we used your function initial procedure was actually using particle analyzer as you suggested, the only problem was touching embryos were not splitting often. But maybe with Starist can work roubstly
How do we find the center one? The biggest after excluding all the ones that touch the image border?
There are sometimes cases when 2 or more full embryos are in the image.
I previously excluded objects by size after segmentation and then picked one which center is closest to the center of the image.
was working in majority cases.
Should I implement this in the macro already, or would you do this?
I can add it no problem, as long as nothing more complicated is needed or as long as you do not have better idea
This works for the sample images that you shared.
Currently the output in the table is in micrometer...
/**
* Required Update Sites:
* - MorpholibJ
* - StartDist
* - CSBDeep
*
*/
run("Close All");
//open("/Users/tischer/Desktop/Raquel-Drosophila-focus-3D-rotation/Test1_TR1_1_W0001_P0001_T0001.lsm");
open("/Users/tischer/Desktop/Raquel-Drosophila-focus-3D-rotation/Test1_TR1_1_W0001_P0002_T0001.lsm");
//open("/Users/tischer/Desktop/Raquel-Drosophila-focus-3D-rotation/Test1_TR1_1_W0001_P0004_T0001.lsm");
run("Z Project...", "projection=[Max Intensity]");
// The size of an embryo should be about 20 pixels in diameter for StarDist
// Thus we have to rescale accordingly
flyWidthInMicrometer = 220;
getPixelSize(unit, pw, ph, pd);
flyWidthInPixels = flyWidthInMicrometer / pw;
desiredFlyWidthInPixels = 20;
scalingFactor = desiredFlyWidthInPixels / flyWidthInPixels;
run("Scale...", "x=&scalingFactor y=&scalingFactor interpolation=Bilinear average create");
// remember pixel size which is lost during StarDist
getPixelSize(unit, pw, ph, pd);
rename("input");
run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2D], args=['input':'input', 'modelChoice':'DSB 2018 (from StarDist 2D paper)', 'normalizeInput':'true', 'percentileBottom':'1.0', 'percentileTop':'99.8', 'probThresh':'0.479071', 'nmsThresh':'0.3', 'outputType':'Label Image', 'nTiles':'1', 'excludeBoundary':'2', 'roiPosition':'Automatic', 'verbose':'false', 'showCsbdeepProgress':'false', 'showProbAndDist':'false'], process=[false]");
run("Properties...", "pixel_width=&pw pixel_height=&pw");
run("Duplicate...", " "); // We duplicate, i.e. force into RAM, because the StarDist output is virtual (V)
run("Remove Border Labels", "left right top bottom");
run("Analyze Regions", "area perimeter circularity euler_number bounding_box centroid equivalent_ellipse ellipse_elong. convexity max._feret oriented_box oriented_box_elong. geodesic tortuosity max._inscribed_disc average_thickness geodesic_elong.");
Let me know if that's enough for you to work with or whether I should do more!
@tischi We have a new embryo automated imaging project. fly-reg procedure works, but not precisely:
Can you please help to solve these issues?