Re: Version Detection?
Posted by
Wayne Rasband on
Oct 08, 2007; 9:32pm
URL: http://imagej.273.s1.nabble.com/Version-Detection-tp3698245p3698247.html
You can modify Nova_Plugin so it does not reference the FITS or
FITS_Reader classes. Use
imp = IJ.openImage(path);
to open the image and
String info = (String)imp.getProperty("Info");
boolean isFITS = info!=null && info.startsWith("SIMPLE");
to test to see if it is a FITS image.
-wayne
On Oct 8, 2007, at 3:12 PM, Andy Puckett wrote:
> Ok, I find this really annoying. I'm running the following code:
>
> String ijvers = IJ.getVersion();
>
> if (ijvers.compareTo("1.38f") < 0) {
> IJ.log("ImageJ: older");
> if (imp.getStackSize() < 2 && !(imp instanceof ij.plugin.FITS)) {
> IJ.error( "Must select a Nova compatible FITS image." );
> return;
> }
> } else {
> IJ.log("ImageJ: newer");
> if (imp.getStackSize() < 2 && !(imp instanceof
> ij.plugin.FITS_Reader)) {
> IJ.error( "Must select a Nova compatible FITS image." );
> return;
> }
> }
>
> Now, even though I'm running ImageJ 1.38x and the code correctly
> responds with "ImageJ: newer" in the log file (so the ELSE clause
> is being used), I still get this error message:
>
> /Applications/ImageJ/plugins/Nova20071008/Nova_Plugin_.java:54:
> Class ij.plugin.FITS not found.
> if (imp.getStackSize() < 2 && !(imp instanceof ij.plugin.FITS)) {
>
> So, Java will still examine (and reject) the code of the THEN
> clause, even though I've told it to use the ELSE clause for
> versions of ImageJ that don't have the FITS class??? That's idiotic.
>
> Ok, bitching aside... any suggestions?
>
> Thanks,
> Andy