Login  Register

Re: Extending Analyzer class

Posted by Wayne Rasband on Aug 17, 2009; 3:50am
URL: http://imagej.273.s1.nabble.com/Extending-Analyzer-class-tp3691479p3691480.html

On Aug 16, 2009, at 5:24 AM, Joachim Wesner wrote:

> Hi list,
>
> I was just wondering, is there an easy way to supplement the list if
> measurements in the Analyzer class with own definitions and without
> touching the main source code?
>
> IMHO this would be a very useful feature!
>
> I think "extending" from that class (in the OO sense) would not help  
> here
> much (!?), as it seems I would need to duplicate quite a bit of code  
> of the
> original Analyzer and if this is done,
> can I overload the internal Plugin with mine so nothing else changes?

The Analyzer class was not designed to be extendable but you can  
easily add custom measurements to the Results Table by using the  
ResultsTable.addValue(label, value) method or the setResult(label,  
row, value) macro function. There are examples at:

     http://rsbweb.nih.gov/ij/plugins/sine-cosine.html

-wayne