Strange problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange problem

Frederic V. Hessman
One fine evening, I was in the process of modifying some plugins when  
this error appeared:

Method getCanvas() not found in class ij.ImagePlus.
                ImageCanvas canv = imp.getCanvas();

My first reaction was - how in the *#$% could I have messed things up  
to get this bizzzre error?    After nothing seemed to cure it, I  
simply re-installed ImageJ completely (1.37).  Without having done  
ANYTHING to restore my old plugins, I tried to compile the following  
trivial test plugin (I only added the lines marked to the default  
PlugInFilter):

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;

public class Test implements PlugInFilter {
        ImagePlus imp;

        public int setup(String arg, ImagePlus imp) {
                this.imp = imp;
                return DOES_ALL;
        }

        public void run(ImageProcessor ip) {
/*******************************************************/
                ImageCanvas canv = imp.getCanvas();
                if (canv != null) IJ.showMessage ("got canvas");
/*******************************************************/
                ip.invert();
                imp.updateAndDraw();
                IJ.wait(500);
                ip.invert();
                imp.updateAndDraw();
        }
}

Sure enough:

Note: sun.tools.javac.Main has been deprecated.
/Applications/ImageJ/plugins/Test.java:17: Method getCanvas() not  
found in class ij.ImagePlus.
                ImageCanvas canv = imp.getCanvas();
                                                ^
1 error, 1 warning


I even checked to see if the unlikely case that ImagePlus.getCanvas()  
had been removed or made private in 1.37 - nope.

     /** Returns the ImageCanvas being used to
         display this image, or null. */
     public ImageCanvas getCanvas() {
         return win!=null?win.getCanvas():null;
     }

Any ideas?

Rick

P.S. I'm running under OSX 10.4.8, PowerBook G4, 1GB
Reply | Threaded
Open this post in threaded view
|

Re: Strange problem

dscho
Hi,

On Sun, 11 Feb 2007, Hessman Frederic wrote:

> One fine evening, I was in the process of modifying some plugins when this
> error appeared:
>
> Method getCanvas() not found in class ij.ImagePlus.
> ImageCanvas canv = imp.getCanvas();

Are you _sure_ you use a newer ImageJ (Try Help>About ImageJ)? getCanvas()
was added to ImagePlus in Version 1.37e on May 4th, 2006.

> After nothing seemed to cure it, I simply re-installed ImageJ completely
> (1.37).

AFAICT this is too old. The current stable version is 1.38.

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Strange problem

ctrueden
In reply to this post by Frederic V. Hessman
Hi Rick,

I agree with Dscho that you should get the ij.jar 1.38 upgrade file from:
http://rsb.info.nih.gov/ij/upgrade/

You can also try compiling your plugin from the command line with:
javac MyPlugin.java -cp ij.jar

-Curtis

On 2/11/07, Hessman Frederic <[hidden email]> wrote:

> One fine evening, I was in the process of modifying some plugins when
> this error appeared:
>
> Method getCanvas() not found in class ij.ImagePlus.
>                 ImageCanvas canv = imp.getCanvas();
>
> My first reaction was - how in the *#$% could I have messed things up
> to get this bizzzre error?    After nothing seemed to cure it, I
> simply re-installed ImageJ completely (1.37).  Without having done
> ANYTHING to restore my old plugins, I tried to compile the following
> trivial test plugin (I only added the lines marked to the default
> PlugInFilter):
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.filter.*;
>
> public class Test implements PlugInFilter {
>         ImagePlus imp;
>
>         public int setup(String arg, ImagePlus imp) {
>                 this.imp = imp;
>                 return DOES_ALL;
>         }
>
>         public void run(ImageProcessor ip) {
> /*******************************************************/
>                 ImageCanvas canv = imp.getCanvas();
>                 if (canv != null) IJ.showMessage ("got canvas");
> /*******************************************************/
>                 ip.invert();
>                 imp.updateAndDraw();
>                 IJ.wait(500);
>                 ip.invert();
>                 imp.updateAndDraw();
>         }
> }
>
> Sure enough:
>
> Note: sun.tools.javac.Main has been deprecated.
> /Applications/ImageJ/plugins/Test.java:17: Method getCanvas() not
> found in class ij.ImagePlus.
>                 ImageCanvas canv = imp.getCanvas();
>                                                 ^
> 1 error, 1 warning
>
>
> I even checked to see if the unlikely case that ImagePlus.getCanvas()
> had been removed or made private in 1.37 - nope.
>
>      /** Returns the ImageCanvas being used to
>          display this image, or null. */
>      public ImageCanvas getCanvas() {
>          return win!=null?win.getCanvas():null;
>      }
>
> Any ideas?
>
> Rick
>
> P.S. I'm running under OSX 10.4.8, PowerBook G4, 1GB
>
Reply | Threaded
Open this post in threaded view
|

Re: Strange problem

Frederic V. Hessman
Thank to all of the helpful comments and ideas, I finally found out  
what my problem was:  NASA/Goddard has imbedded ImageJ in it's  
downloadable version of "SkyView" (an interface to all kinds of  
astronomical data and catalogues covering all wavelengths) and this  
old version of ImageJ was getting loaded before everything else had a  
chance.

Particular cudos to Johannes Schindelin who gave the final suggestion  
which worked:     java -verbose:class -jar ij.jar

Just shows you how handy and even hidden ImageJ can be in places  
where you wouldn't necessarily expect it!

Rick

On 13 Feb 2007, at 9:03 pm, Curtis Rueden wrote:

>> One fine evening, I was in the process of modifying some plugins when
>> this error appeared:
>>
>> Method getCanvas() not found in class ij.ImagePlus.
>>                 ImageCanvas canv = imp.getCanvas();
>>
>> My first reaction was - how in the *#$% could I have messed things up
>> to get this bizzzre error?    After nothing seemed to cure it, I
>> simply re-installed ImageJ completely (1.37).  Without having done
>> ANYTHING to restore my old plugins, I tried to compile the following
>> trivial test plugin (I only added the lines marked to the default
>> PlugInFilter):
>>
>> import ij.*;
>> import ij.process.*;
>> import ij.gui.*;
>> import java.awt.*;
>> import ij.plugin.filter.*;
>>
>> public class Test implements PlugInFilter {
>>         ImagePlus imp;
>>
>>         public int setup(String arg, ImagePlus imp) {
>>                 this.imp = imp;
>>                 return DOES_ALL;
>>         }
>>
>>         public void run(ImageProcessor ip) {
>> /*******************************************************/
>>                 ImageCanvas canv = imp.getCanvas();
>>                 if (canv != null) IJ.showMessage ("got canvas");
>> /*******************************************************/
>>                 ip.invert();
>>                 imp.updateAndDraw();
>>                 IJ.wait(500);
>>                 ip.invert();
>>                 imp.updateAndDraw();
>>         }
>> }
>>
>> Sure enough:
>>
>> Note: sun.tools.javac.Main has been deprecated.
>> /Applications/ImageJ/plugins/Test.java:17: Method getCanvas() not
>> found in class ij.ImagePlus.
>>                 ImageCanvas canv = imp.getCanvas();
>>                                                 ^
>> 1 error, 1 warning
>>
>>
>> I even checked to see if the unlikely case that ImagePlus.getCanvas()
>> had been removed or made private in 1.37 - nope.
>>
>>      /** Returns the ImageCanvas being used to
>>          display this image, or null. */
>>      public ImageCanvas getCanvas() {
>>          return win!=null?win.getCanvas():null;
>>      }
>>
>> Any ideas?
>>
>> Rick
>>
>> P.S. I'm running under OSX 10.4.8, PowerBook G4, 1GB
>>

------------------------------------------------------------------------
------------------------
Dr. Frederic V. Hessman     [hidden email]
Institut für Astrophysik          Tel.  +49-551-39-5052
Friedrich-Hund-Platz 1         Fax +49-551-39-5043
37077 Goettingen                 Room F04-133
http://www.Astro.physik.Uni-Goettingen.de/~hessman
------------------------------------------------------------------------
-------------------------
MONET: a MOnitoring NEtwork of Telescopes
http://monet.Uni-Goettingen.de
------------------------------------------------------------------------
-------------------------