Posted by
Leonard Sitongia on
Aug 30, 2007; 6:02pm
URL: http://imagej.273.s1.nabble.com/dev-overriding-multiple-classes-tp3698479p3698485.html
Volker Bäcker wrote:
> Create a jar-file with your subclasses and put the jar file in the
> same directory as your plugin that uses them. You could as well put
> them somewhere else in the classpath or add the location to the
> classpath.
> Volker
>
> Leonard Sitongia a écrit :
>> What is the best practice for overriding multiple classes in ij that
>> aren't related in a class hierarchy? I could write invisible plugins
>> (no underscore) and call them from the plugin I want visible (with
>> the underscore)?
>>
>> In this case, I want to extend ImagePlus and Calibration, and maybe
>> more.
Thank you for your help. I'd like to follow up on this with more basic
questions about how to proceed.
My goal is to adapt ImageJ to work on my image data that is in polar
coordinates. They are images of the Sun. They're 2D FITS pixel image
files. But, the natural coordinates to use are polar. This way moving
the mouse around the image shows coordinate status at the bottom of the
ImageJ window in (r,theta) instead of the (x,y) coordinates.
I started out extending Calibration with PolarCalibration, adding getR
and getTheta. I also extend ImagePlus with PolarImagePlus to override
getLocationAsString to display (r,theta) by using PolarCalibration.
The fundamental question is, with inheritance, I can't get ImageJ to use
my new classes, right? I need to then create a plugin that loads a
PolarImagePlus, and displays it. Then the main ImageJ window will show
status with (r,theta). But, other stuff in ImageJ, for example
measuring, will not use getR, for example, because they use getX. That
is, the other operations in ImageJ will use the methods from the
ImagePlus part of my PolarImagePlus.
I can't override getX and getY in Calibration because getR and getTheta
need two arguments, (x,y).
I can't think of a way to accomplish this without modifying Calibration
and ImagePlus, or duplicating the code in parts of ImageJ to create my
own polar coordinate version of it, which I would of course want to
avoid doing.
Thanks!
--
==Leonard E. Sitongia
High Altitude Observatory
National Center for Atmospheric Research
P.O. Box 3000 Boulder CO 80307 USA
[hidden email] voice: (303)497-2454 fax: (303)497-1589