简体   繁体   English

FIJI / ImageJ:如何在另一个插件中使用一个插件中的类?

[英]FIJI / ImageJ: How to use class from one plugin in another plugin?

I want to use the Auto_Threshold class - which implements the "Auto Threshold" plugin in ImageJ . 我想使用Auto_Threshold类-在ImageJ中实现“自动阈值”插件。 According to http://imagej.net/Writing_plugins#The_Context , I can get access to other plugin functionality like LogService using 根据http://imagej.net/Writing_plugins#The_Context ,我可以使用来访问其他插件功能,例如LogService

@Parameter
private LogService logService;

However, this doesn't work for everything. 但是,这并不适用于所有情况。 I tried 我试过了

@Parameter
private Auto_Threshold AutoThreshold

but that doesn't work. 但这不起作用。 I see from the source code at https://github.com/fiji/Auto_Threshold/blob/Auto_Threshold-1.16.5/src/main/java/fiji/threshold/Auto_Threshold.java that that class lives in the fiji.threshold package. 我从https://github.com/fiji/Auto_Threshold/blob/Auto_Threshold-1.16.5/src/main/java/fiji/threshold/Auto_Threshold.java的源代码中看到,该类位于fiji.threshold包中。 Of course, I could just copy that code into my source directory and use that package. 当然,我可以将代码复制到源目录中并使用该程序包。 Is that the best course of action, or is there a more formal way to depend on another plugin? 这是最好的做法,还是有更正式的方式依赖另一个插件?

Thanks, Rory 谢谢罗里

You can use CommandService maybe: 您可以使用CommandService:

@Parameter
private CommandService cs;

Then whenever you want to do something: 然后,每当您想做某事时:

cs.run(OtherPlugin.class, true, ...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM