[ImageJ-devel] (headless) command execution - missing project files

Curtis Rueden ctrueden at wisc.edu
Thu Apr 10 15:32:11 CDT 2014


Hi Stefan,

Thanks. Rather than doing this:

  CommandInfo testopInfo = new CommandInfo(IJTestOp.class.getName());
  testopModule = (CommandModule) testopInfo.createModule();

I suggest instead:

  CommandInfo testopInfo = commandService.getCommand(IJTestOp.class);
  testopModule = (CommandModule) moduleService.createModule(testopInfo);

Otherwise, you will have lots of problems because the created module will
not know its context. If you use the service methods, all the injections
are taken care of for you; see:


https://github.com/imagej/imagej/blob/imagej-2.0.0-beta-7.9/core/core/src/main/java/imagej/module/DefaultModuleService.java#L150

Also, rather than:

  testopModule.setInput("ivalIn", 321);
  testopModule.getCommand().run();

I would use the service method:

  moduleService.run(testopModule, false, "ivalIn", 321);

Regards,
Curtis


On Thu, Apr 10, 2014 at 3:13 PM, Stefan Posch <posch at informatik.uni-halle.de
> wrote:

> sorry. I forgot to attach the project ... here it comes.
>
> Stefan
>
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagej.net
> http://imagej.net/mailman/listinfo/imagej-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20140410/365b4e77/attachment.html>


More information about the ImageJ-devel mailing list