[SCIFIO] Minimal Service Setup for ImgOpener

Curtis Rueden ctrueden at wisc.edu
Wed Sep 25 00:00:08 CDT 2013


Hi Michael & all,

> Or more specific is there a better way than incrementally adding
> services to get a "Bioformats" ImgOpener running without discovering
> unrelated services like HotdrawService...

Just to follow up on this thread: the scifio-0.6.1 and scifio-0.6.2
releases have improved the default io.scif.SCIFIO constructor to behave
this way. This constructor creates an application context with all
available core SciJava & SCIFIO services using the invocation:

        new Context(SciJavaService.class, SCIFIOService.class);

The behavior of the SciJava application context was improved to load all
services extending each given type. After some discussion we believe this
is the simplest and most consistent way to do things. The SciJavaService
interface is extended by all base SciJava services (e.g., PluginService).
And the SCIFIOService interface is extended by all SCIFIO-related services.
ImageJ2 also has an ImageJService now too for the same reasons. In this
way, it is possible to easily restrict which sorts of services get added to
the context in an extensible way.

Regards,
Curtis

P.S. The only slightly unintuitive thing (IMHO) is that non-core services
should *not* extend SciJavaService, because that interface is intended for
use by the org.scijava.* services *only*. (E.g., SCIFIOService does not
extend it.)


On Tue, Aug 13, 2013 at 3:37 PM, Michael Zinsmaier <michael.zinsmaier at gmx.de
> wrote:

>  Hi Curtis,
>
> it does work as minimal setting.
> But we discovered that we need more services to get the functionality that
> we need within KNIP (opening all the images that are supported by
> bioformats). So far we added the following services to open some test
> pictures: "FormatService.class, CodecService.class, TiffService.class,
> JAIIIOService.class"
>
> What other services will we need? Or more specific is there a better way
> than incrementally adding services to get a "Bioformats" ImgOpener running
> without discovering unrelated services like HotdrawService...
>
> Best Michael
>
>  Hi Michael,
>
>  > What is the minimal set of Services that we need just for the opener?
>
>  The noargs ImgOpener constructor is supposed to give you exactly that:
>
>
> https://github.com/scifio/scifio/blob/8037fd38419030dff000eda84fca9b35909be3a4/scifio/src/main/java/io/scif/img/AbstractImgIOComponent.java#L68
>
>  Please let us know if it doesn't work for you!
>
>  Regards,
> Curtis
>
>
> On Mon, Aug 12, 2013 at 10:39 AM, Michael Zinsmaier <
> michael.zinsmaier at gmx.de> wrote:
>
>> Hi all,
>>
>> we try to create a suitable context for the ImgOpener but on our
>> classpath are several jar files that contain services which we do not
>> intend to use and which cause problems if discovered (e.g. HotdrawService
>> is discovered but we do not include all required libs...). What is the
>> minimal set of Services that we need just for the opener?
>>
>> or more code based:
>>
>> given the following methods
>>
>>     public void foo() {
>>         Context c = new Context(getIOContextServices());
>>         m_scifio = new SCIFIO(c);
>>         FORMATS = m_scifio.format().getAllFormats();
>>     }
>>
>>     private List<Class<? extends Service>> getIOContextServices() {
>>         final List services = new ArrayList();
>>        services.add(FormatService.class);
>>        return services;
>>     }
>>
>> what would be the minimal list of required services in order to get a
>> suitable Context for the ImgOpener?
>>
>> Regards Michael
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://scif.io/pipermail/scifio/attachments/20130925/b3f95edf/attachment-0002.html>


More information about the SCIFIO mailing list