【问题标题】:Run ImageJ macro from within my own java application从我自己的 java 应用程序中运行 ImageJ 宏
【发布时间】:2017-05-09 23:53:08
【问题描述】:

我找到了this post which uses the IJ.runMacro() 方法,但我对“Clown (14K)”指的是什么感到困惑,我想使用我自己制作的宏,而不是从 imageJ 的网站下载的宏。

我的宏现在是这样的:

run("Non-local Means Denoising", "sigma=5 smoothing_factor=1");

当我使用批处理器时,它在 ImageJ 中有效。 (Non-Local Means Denoising is an ImageJ Plugin)

我的两个问题是:

  • 如何调用使用 IJ.runMacro 方法(或替代方法)创建的宏?

  • 如何指定 runMacro 方法将影响的图像?

感谢您的宝贵时间。

【问题讨论】:

标签: java image-processing plugins macros imagej


【解决方案1】:

我终于找到了我的问题here的答案

最终解决它的代码行是:

System.setProperty("plugins.dir", "C:\\Users\\Speedy Octopus\\Downloads\\ij150-win-java8\\ImageJ\\plugins");

所以整个 Test 类现在看起来像这样:

import ij.IJ;
import ij.ImagePlus;
import ij.io.FileSaver;
import ij.plugin.PlugIn;


public class Test implements PlugIn {

public static void main(String[] args) {

    Test test = new Test();
    test.run("Denoise.ijm");

}

@Override
public void run(String arg0) {
    String directory = "C:\\Users\\Speedy Octopus\\Desktop\\10Cover Shots\\10.JPG";

    ImagePlus imp = IJ.openImage(directory);
    FileSaver fileSaver = new FileSaver(imp);

    System.setProperty("plugins.dir", "C:\\Users\\Speedy Octopus\\Downloads\\ij150-win-java8\\ImageJ\\plugins");
    IJ.run(imp, "Non-local Means Denoising", "sigma=5 smoothing_factor=1");
    fileSaver.saveAsJpeg("C:\\Users\\Speedy Octopus\\Desktop\\10Cover Shots\\10edited.JPG");
}
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-20
    • 1970-01-01
    • 2012-02-07
    • 1970-01-01
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    相关资源
    最近更新 更多