Hi Tobias, On Fri, 22 Aug 2014, Tobias Pietzsch wrote:
> Currently > new io.scif.img.ImgOpener(); > fails with > java.lang.IllegalArgumentException: Invalid service: > net.imagej.legacy.LegacyAppEventService Yep, the explanation is very easy: > [...] > Caused by: java.lang.UnsupportedOperationException: Cannot instantiate more > than one DefaultLegacyService > [...] There is already a context, including a legacy service. Unfortunately, the best way to get at this context from an *ImageJ 1.x plugin* that I could come up with is: import org.scijava.Context; ... final Context context = (Context) IJ.runPlugIn(Context.class.getName(), ""); final ImgOpener opener = new ImgOpener(context); (There is no way to make that more convenient without letting SCIFIO depend on ImageJ 1.x, which is of course a big no-no). Of course, you could also turn your plugin into an ImageJ2 plugin -- which is handled properly in Fiji thanks to Fiji Just Being ImageJ2 -- and then it would become as easy as: @Parameter private IOService io; ... // use the IOService (which lets SCIFIO handle // things) to open your dataset Ciao, Johannes _______________________________________________ ImageJ-devel mailing list ImageJ-devel@imagej.net http://imagej.net/mailman/listinfo/imagej-devel