将 ImageJ 宏命令实施到现有插件中

Implementing ImageJ macro commands into an existing Plugin

我正在尝试更改 ImageJ 的现有插件 OpenComet。我不喜欢 Java,所以也许这很容易。

我要实现的是以下内容

  1. run("Bio-Formats Windowless Importer", "open=path autoscale color_mode=Default view=Hyperstack stack_order=XYCZT");
    在 Bioformat Importer 插件的帮助下打开我的文件

  2. run("Flip Horizontally");

这应该放在下面的代码中:

// Iterate over each input file
            for(int i=0;i<inFiles.length;i++){
                // Try to open file as image
//NUMBER 1 BIOFORMAT IMPORT AT THIS POINT               
                ImagePlus imp = IJ.openImage(inFiles[i].getPath());
                                // If image could be opened, run comet analysis
                if(imp!=null){
//NUMBER 2 FLIPPING AT THIS POINT
                    String imageKey =  inFiles[i].getName();

此外,我需要导入 BioFormat Importer 的 class 或类似的东西。我不会吗?

非常感谢。

  1. run("Bio-Formats Windowless Importer", "open=path autoscale color_mode=Default view=Hyperstack stack_order=XYCZT");

    opening my files with the help of the Bioformat Importer plugin

您可以使用生物格式的 BF 帮助程序 class 来实现此目的(参见其 API documentation). For a javascript example, have a look here。在 Java 中,它可能看起来像:

import loci.plugins.BF;
  [...]
ImagePlus[] imps = BF.openImagePlus(inFiles[i].getPath());
ImagePlus imp = imps[0];
  1. run("Flip Horizontally");

Java模式下使用recorder插件>宏>记录...)获取所需命令:

import ij.IJ;
 [...]
IJ.run(imp, "Flip Horizontally", "");

如果您想了解较低级别的 Java 命令,请使用 Command Finder(按 [L] 或 Plugins > Utilities > Find Commands...) 并键入 "flip",你会发现 class 实现了命令:

ij.plugin.filter.Transformer("fliph")

希望对您有所帮助。