【问题标题】:How does exec("dir /w"); function work in imageJ?exec("dir /w"); 怎么做? imageJ中的功能工作?
【发布时间】:2014-05-02 08:40:15
【问题描述】:

如何在 imageJ 中使用 exec(),http://fiji.sc/ImageJ_tricks#Execute_external_programs?我可以使用 exec() 函数来启动外部 python 程序,例如:

exec("python", d:\py\program1.py");

是否可以从 python 返回一个图像数组给 exec?

【问题讨论】:

    标签: python imagej


    【解决方案1】:

    exec() 宏函数是 hard coded 以返回 STDOUT,如 Curtis Rueden 的 answer to a similar question on the ImageJ mailing list 中所述。

    但是,您可以通过脚本编辑器直接在斐济内部运行Python (or, for that matter, Jython) scripts,或者将它们放入Fiji.app/plugins/ 文件夹中。

    【讨论】:

    • 谢谢,我问是因为我有兴趣尝试从 ImageJ 中找到使用 numpy 和 scipy 的方法,并认为这可能是一种选择。
    • 嗯,this question 和这个post on the ImageJ mailing list 可能你会感兴趣。
    • 谢谢,虽然我希望不必重写我的程序来让它在 imagej 中启动。
    【解决方案2】:

    对于任何有兴趣在 imageJ 中使用其他 python 库的人,exec() 可以完成工作。使用:

    exec("python", "d:\\pathtoyour\\pythonprogram.py");
    

    使用 imageJ 脚本编辑器将其保存为 .ijm 文件。然后可以将其作为插件安装,以从 imageJ 启动您的 python 程序。

    【讨论】:

      猜你喜欢
      • 2011-03-25
      • 1970-01-01
      • 1970-01-01
      • 2018-12-19
      • 1970-01-01
      • 2013-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多