Hi there,
I wrote some code that takes an image, does the particle analysis (but only the segmentation part) on it,
and then, when the user clicks on an ROI, it measures this ROI using the Analyzer.
When I run it, I get numbers that don't make sense, such as Solidity>1, Roundness>1, and Angles of 0 and 90 (only these two discrete values). When I use the "set measurements" way to measure, I get the correct numbers (I also tested that on synthetic test-images).
Before I paste some of the code I must mention two things that I did:
1. I used a ParticleAnalyzer.analyze() to get the ROIs, and then and stats->Analyzer.saveResults(), to measure user-chosen ROIs (because the ParticleAnalyzer's saveResults() method is protected, and I don't know how to deal with that).
2. the segmentation and the measurement are on different images (after the segmentattion I redirect everything to a copy of the original image, which is a color image and not binary).
could anyone give me an idea about this problem?
Cheers
J
int measurements=1+2+4+8+16+32+64+128+256+512+1024+2048+4096+8192;
int options=ParticleAnalyzer.EXCLUDE_EDGE_PARTICLES+ParticleAnalyzer.SHOW_RESULTS+ParticleAnalyzer.SHOW_ROI_MASKS+ParticleAnalyzer.SHOW_MASKS+ParticleAnalyzer.ADD_TO_MANAGER+ParticleAnalyzer.CLEAR_WORKSHEET+ParticleAnalyzer.SHOW_OVERLAY_OUTLINES;
ImagePlus imp = IJ.openImage(ShuffledAdressBook[ImageIndex]);
…….
ParticleAnalyzer CellAnalyzer=new ParticleAnalyzer(options,measurements,rt,minparticle,maxparticle);
Analyzer CellAnalyzer2=new Analyzer(Ghost,measurements,rt);
CellAnalyzer.analyze(imp);
…………….
Redirected to imp called Ghost
……………..
if (rx.contains(offscreenX,offscreenY))
{
IJ.log("inside!!!");Hit=1;
rx.setStrokeColor(SelectedColor);
rm.runCommand("Deselect");
rm.select(Roindex);
ImageStatistics stats =ImageStatistics.getStatistics(Ghost.getProcessor(),measurements,Ghost.getCalibration());
CellAnalyzer2.saveResults(stats,rx);//I had to use an Analyzer here and not ParticleAnalyzer, because saveresults is protected in Particleanalyzer
CellAnalyzer2.updateHeadings();
if (TheChosenOnes.contains(rx)) {IJ.log("already exists!!!");}
else {TheChosenOnes.add(rx);}
}