Changeset 1992


Ignore:
Timestamp:
01/02/07 14:20:30 (13 years ago)
Author:
curtis
Message:

Use new ImageJ v1.38f functionality to temporarily disable OpenUsingPlugins
flag while ImageJReader uses ImageJ to import certain file types (e.g., FITS).

Location:
trunk/loci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/ImageJReader.java

    r1947 r1992  
    7373      r.exec("import ij.process.ImageProcessor"); 
    7474      r.exec("opener = new Opener()"); 
    75     } 
    76     catch (Exception exc) { noImageJ = true; } 
     75      r.setVar("false", false); 
     76    } 
     77    catch (Throwable t) { noImageJ = true; } 
    7778  } 
    7879 
     
    126127      r.setVar("dir", file.getParent() + System.getProperty("file.separator")); 
    127128      r.setVar("name", file.getName()); 
    128       r.exec("image = opener.openImage(dir, name)"); 
     129      synchronized (ImageJReader.class) { 
     130        try { 
     131          r.exec("state = Opener.getOpenUsingPlugins()"); 
     132          r.exec("Opener.setOpenUsingPlugins(false)"); 
     133        } 
     134        catch (ReflectException exc) { 
     135          // probably ImageJ version < 1.38f 
     136        } 
     137        r.exec("image = opener.openImage(dir, name)"); 
     138        try { 
     139          r.exec("Opener.setOpenUsingPlugins(state)"); 
     140        } 
     141        catch (ReflectException exc) { 
     142          // probably ImageJ version < 1.38f 
     143        } 
     144      } 
    129145      r.exec("size = image.getStackSize()"); 
    130146      Image img = (Image) r.exec("image.getImage()"); 
     
    132148      return ImageTools.makeBuffered(img); 
    133149    } 
    134     catch (Exception exc) { 
     150    catch (ReflectException exc) { 
    135151      throw new FormatException(exc); 
    136152    } 
  • trunk/loci/plugins/Importer.java

    r1987 r1992  
    4040import javax.swing.*; 
    4141import loci.formats.*; 
    42 import loci.formats.in.ImageJReader; 
    4342import loci.plugins.browser.LociDataBrowser; 
    4443 
     
    6867  public Importer(LociImporter plugin) { 
    6968    this.plugin = plugin; 
    70     ImageReader.removeReaderType(ImageJReader.class); 
    7169  } 
    7270 
Note: See TracChangeset for help on using the changeset viewer.