java - 从我自己的 java 应用程序中运行 ImageJ 宏

标签 java image-processing plugins macros imagej

我找到了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 方法将影响哪些图像?

感谢您的宝贵时间。

最佳答案

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

最终解决该问题的代码行是:

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

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

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");
}
}

关于java - 从我自己的 java 应用程序中运行 ImageJ 宏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41315604/

相关文章:

java - 从 Google 云端硬盘中的 ID 文件夹获取子文件

Java - JTable 默认选择第一列

python - 将Python与opencv结合使用以实现图像拼接

eclipse - 使用 gradle eclipse 插件指定 JRE Con​​tainer

python - 如果尚未导入,则 Vim 函数插入 Python 导入

java - Tomcat 上的 JPA2 - 可能吗?

java - 除某些方法外, Sonar 违规

android - 以编程方式将照片转换为android中的卡通?

matlab - 为非参数图像查找多个椭圆

java - Eclipse Checkstyle 插件可以与 Java 1.5 一起使用吗?