Posted by
JiHO-2 on
Jun 25, 2009; 10:02pm
URL: http://imagej.273.s1.nabble.com/Using-the-Analyzer-plugin-to-get-measurements-general-questions-tp3691987.html
Hi everyone,
I am trying to get a few measurements programmatically within a
plugin. Ideally I would like that to be invisible to the user (i.e. do
displaying a result table). So I don't want to call IJ.run("Set
Measurements") and IJ.run("Measure"). Currently my code looks like:
ResultsTable rt = new ResultsTable();
// imB is an ImagePlus
Analyzer ana = new Analyzer(imB, CENTROID, rt);
ana.setMeasurement(AREA, true);
ana.setMeasurement(ELLIPSE, true);
ana.measure();
rt = ana.getResultsTable();
rt.show("Results"); // just to check
I have (at least) two problems with that:
1/ Is it the correct way to select several measurements? Can I
somewhere give a string with all measurements I what like in the
IJ.run case? Here I am expecting to get CENTROID, AREA, and ELLIPSE.
2/ measure() is described as public void measure() in the API but the
compilation gives:
src/imagej/plugins/Threshold_Stack.java:92: measure() is not public
in ij.plugin.filter.Analyzer; cannot be accessed from outside package
and indeed in the source it is only void measure(). In that case, how
do I trigger the collection of the measurements I set before? Silly
question but I could not figure it out.
Thanks in advance. Sincerely,
JiHO
---
http://maururu.netPS: More generally, I find it very easy to chain up ImageJ
functionality in macros or macro like plugins (i.e. which call
IJ.run("something")) but I am really struggling to convert those to
the less GUI oriented way of calling the plugins/classes directly, as
for the case above. My only source of information is currently the API
and, while it gives all the possibilites for each class, it does not
really orient me towards how those should be used. Is there some other
resource tat would complement the API? Something based on commented
examples maybe, showing how to use each each plugin for example.
I've read "Writing ImageJ plugins" and wandered through the wiki but
this did not really help. I am curious to know how the numerous
plugins developer work when they face the need to introduce new
functionality from ImageJ's API.
Thanks again.