ImageJ:使用生物格式进行调试

ImageJ: Debug with bioformats

我已经下载了 imageJ 源代码并导入到 Eclipse 中。目前,我正在为 imageJ 开发一个插件,我可以 运行 imageJ 使用我的 eclipse 插件并根据需要进行调试。我的问题是我希望从 eclipse 初始化 imageJ 但加载 bioformats reader plugin 以便我可以打开 .lif 文件。如何将此插件引入 imageJ 源代码中?我试图在我的项目中添加依赖项到 bioformats 的 .jar 文件,但它不起作用。

仅供曾经研究过相同问题的人参考:

  1. 下载全部源码:https://github.com/openmicroscopy/bioformats
  2. 复制文件夹:bioformats-develop\components\bio-formats-plugins\src 到您的项目。
  3. 将loci.plugins.LociImporter.java复制到ij.plugin。
  4. 删除loci.plugins.LociImporter.java
  5. 修改ij.plugin.LociImporter.java,添加arg:

    这一行
     public void run(String arg) {
         DebugTools.enableLogging("INFO");
         arg = "location=[Local machine] windowless=false "; //<-This one
         [...]
     }
    
  6. 修改loci.plugins.in.Importer.java:

    //import loci.plugins.LociImporter;//substitute this import per
      import ij.plugin.LociImporter;//this one
    
  7. 修改ij.Menus.java:

    [...]
    Menu importMenu = getMenu("File>Import", true); 
    addPlugInItem(importMenu, "Bio-Formats", "ij.plugin.LociImporter",0,false);  //<-Add this line
    [...]
    
  8. 添加 bioformats.jar 作为项目的外部库。

运行 项目。现在您可以从文件->导入->生物格式打开 .lif。通过此修改,您将无法进行拖放操作,但您只需使用此菜单打开文件即可使用此插件。由于这仅使用 "import" 这仅对打开有用。如果你想要一些关于保存的东西,你应该像我为导入所做的那样调用 loci.plugins.LociExporter("") 。 (实际上,通过我的修改,我们正在调用 ij.plugin.LociImporter("location=[Local machine] windowless=false ")

不要复制源文件,也不要复制 JAR 文件。您应该根据需要管理您的项目依赖项 using Maven or similar 21st century build tool (Gradle is also effective). Add a dependency on net.imagej:ij and ome:formats-gpl 以及其他 Bio-Formats 工件。

另请参阅: