Re: Data from summary window
Posted by davek604 on Nov 28, 2014; 9:15am
URL: http://imagej.273.s1.nabble.com/Data-from-summary-window-tp5010658p5010670.html
Hello Tiago
I'm trying to use a set threshold percentage, eg I want to use 0.1% of the histogram to threshold my cells and I noticed that the summary %area gave me the percentage I was looking for. So I thought that would be simpler than calculating it from the getHistogram command and counting pixels in bins.
So what you posted is exactly what I want to do but it unfortunately still doesn't work. I'm debugging it in Eclipse and it wouldn't start until I declared the variables. The problem seems to be the table variable which Eclipse insists is a ResultsTable variable type, it is always null so the summary table cannot be found. However what I've noticed is that you say you run it on 1.9m2 what is that, as the highest version I can download of ImageJ is 1.48 are you using ImageJ2. I've put the code with my slight modifications below (also made sure all imports are in place). I really appreciate your help on this because I'm really stuck.
ImagePlus imp = null;
imp = IJ.openImage(Prefs.getImagesURL()+"bat-cochlea-volume.zip");
imp.show();
ParticleAnalyzer pa = new ParticleAnalyzer(ParticleAnalyzer.DISPLAY_SUMMARY,0,new ResultsTable(),0,100);
pa.analyze(imp);
Frame frame = WindowManager.getFrame("Summary of "+imp.getTitle());
if (frame!=null && (frame instanceof TextWindow)) {
TextWindow tw = (TextWindow)frame;
ResultsTable table = tw.getTextPanel().getResultsTable();
if (table!= null) {
ResultsTable st = tw.getTextPanel().getResultsTable();
IJ.log("Table found! Here is 1st row:\n"+ st.getRowAsString(0));
} else {
IJ.log("Summary Table not found");
}
}