[ImageJ-devel] Scifio question - how to use (recently updated) bioformats proprietary formats (programmatically)

Curtis Rueden ctrueden at wisc.edu
Wed Mar 4 11:54:47 CST 2015


Hi Jay,

> Note that scifio-bf-compat does not pull in formats-gpl itself

To expand on Mark's statement a bit: I forgot that you will also need to
add a dependency on formats-gpl if you want to enable support for all the
proprietary file formats supported by Bio-Formats.

I updated the scifio-bf-compat README with detailed instructions; see:
   https://github.com/scifio/scifio-bf-compat#usage

HTH,
Curtis

On Wed, Mar 4, 2015 at 8:45 AM, Mark Hiner <hiner at wisc.edu> wrote:

> Hi Jay,
>
> >In confirmation of this, when I look in that package within
> the formats-api-5.0.7.jar artifact, none of these readers exist.
>
> Proprietary readers are in the formats-gpl component[1]. formats-api just
> provides base interfaces. For downloads I would recommend looking at the
> OME downloads pages[2] or, of course, using Maven to pull in the
> formats-gpl dependency. Note that scifio-bf-compat does not pull in
> formats-gpl itself - it just provides the framework for adapting
> Bio-Foramts classes.
>
> Best,
> Mark
>
> [1]
> https://github.com/openmicroscopy/bioformats/tree/develop/components/formats-gpl
> [2] http://downloads.openmicroscopy.org/bio-formats/5.0.7/
>
> On Tue, Mar 3, 2015 at 3:54 PM, Jay Warrick <jay.w.warrick at gmail.com>
> wrote:
>
>> Hi Curtis,
>>
>> Super helpful feedback. Thanks for the tips on leveraging the newest OME
>> stuff.
>>
>> Re: Problem 1 - Did some debugging. As you already know, the
>> scifio-bf-compat dependency is pulling in the formats-api-5.0.7.jar
>> artifact which contains some crucial classes for all this. Critical to
>> matching a file with an appropriate reader is the loci.formats.ImageReader
>> class which has a static method (getDefaultReaderClasses()) that should
>> populate a cache of readers based on the readers.txt file (short example
>> snippet in listing #1). As you can see from the snippet, the readers are
>> expected to be contained within the loci.formats.in package. During
>> population of this cache, each attempt to load a class listed in the file
>> is met with a ClassNotFoundException. In confirmation of this, when I look
>> in that package within the formats-api-5.0.7.jar artifact, none of these
>> readers exist. Thus, the cache of readers does not get populated and Scifio
>> is not able to match my file with any reader. Seems like this is the issue,
>> right? However, it would seem like this would affect almost ANY proprietary
>> format, which tells me I am likely doing something weird if this hasn't
>> come up yet in feedback from others.
>>
>> Suggestions? I re-downloaded the artifact directly from maven.imagej.net again
>> to check. I change the extension to zip and looked in the corresponding
>> folder and did not find any of the readers I would expect.
>>
>> %%%%%%%%%%%%%%
>> Listin #1  - short snippet of readers.txt file.
>> %%%%%%%%%%%%%%
>>
>> # standalone readers with unique file extensions
>> loci.formats.in.PGMReader             # pgm
>> loci.formats.in.FitsReader            # fits
>> loci.formats.in.PCXReader             # pcx
>>
>>
>> On Mar 3, 2015, at 11:28 AM, Curtis Rueden <ctrueden at wisc.edu> wrote:
>>
>> Hi Jay,
>>
>> > I thought it used to be automatic upon adding the scifio and
>> > scifio-bf-compat dependencies.
>>
>> Yeah, that's correct.
>>
>> > A "limited" list of 30 formats show up in the DefaultFormatService
>> > currently and don't include ND2.
>>
>> The format that supports ND2 (and all Bio-Formats formats) is the
>> "Bio-Formats Compatibility Format" at the front of your list.
>>
>> You'll need to debug into the code to find out why the BioFormatsFormat
>> is not being selected properly for your ND2 file.
>>
>> > It looks like the parent pom of scifio-bf-compat (pom-scijava)
>> > specifies <bio-formats.version>5.0.7</bio-formats.version>.
>> > Is it likely to be "risky" to leverage the most recent changes
>> > for ND2 compatibility?
>>
>> Yes, it will not work. The scifio-bf-compat component has not yet been
>> updated to use the Bio-Formats 5.1.x codebase.
>>
>> The good news is: updating it to use the OME 5.1 API was easy. I pushed a
>> branch:
>>
>> https://github.com/scifio/scifio-bf-compat/compare/ome-5.1
>>
>> You can use it during development by:
>>
>> * Cloning scifio-bf-compat.
>> * Switching to the ome-5.1 branch.
>> * Importing scifio-bf-compat into your Eclipse.
>> * Setting your project's bio-formats.version property to 5.1.0-SNAPSHOT.
>> * Setting your project's scifio-bf-compat.version property to
>> 1.11.1-SNAPSHOT.
>>
>> And then Eclipse should switch to a project coupling for scifio-bf-compat
>> and use the branch.
>>
>> But you'll want to stay on a corresponding branch of your own project
>> development until the OME 5.1.0 release.
>>
>> Regards,
>> Curtis
>>
>> On Tue, Mar 3, 2015 at 10:42 AM, Jay Warrick <jay.w.warrick at gmail.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> I have 2 problems you all hopefully have suggestions for... (thanks in
>>> advance)
>>>
>>> *Problem 1:*
>>>
>>> I'm interested in opening ND2 file format programmatically in Java via a
>>> SCIFIO object used with an ImageJ context but can't seem to get it to work.
>>> (see listing A) Error message indicates format not found.
>>>
>>> Hopefully relevant details of what I am currently doing with maven
>>> imports are below. (see listing B)
>>>
>>> Suggestions? Is there a BioFormats dependency I am not bringing in that
>>> is necessary to expose/discover all the additional proprietary formats or
>>> do I have to add the proprietary formats myself using a combination of a
>>> bioformats artifact I'm not aware of and adding each format using the
>>> mechanism provided by scifio-bf-compat? I thought it used to be automatic
>>> upon adding the scifio and scifio-bf-compat dependencies. Any help is
>>> appreciated. I looked in scifio tutorials but couldn't figure it out. Sorry.
>>>
>>> *Problem 2:*
>>>
>>> After resolution of problem 1, I'd like to leverage recent changes to
>>> the bioformats package that addresses a bug in ND2 metadata handling that
>>> was affecting me (https://trac.openmicroscopy.org.uk/ome/ticket/12548).
>>> The link suggests using bioformats 5.1.x vs 5.0.x which also requires use a
>>> few other updated jars (as noted near end of ticket). Suggestions on the
>>> best way to do this given my use case? It looks like the parent pom of
>>> scifio-bf-compat (pom-scijava)
>>> specifies <bio-formats.version>5.0.7</bio-formats.version>. Is it likely to
>>> be "risky" to leverage the most recent changes for ND2 compatibility?
>>>
>>> Thanks,
>>>
>>> Jay
>>>
>>> %%%%%%%%%%%%%
>>> Listing A
>>> %%%%%%%%%%%%%
>>>
>>> final SCIFIO scifio = new SCIFIO(ij.getContext());
>>> Reader reader;
>>> try
>>> {
>>> reader = scifio.initializer().initializeReader(nd2File, new
>>>  SCIFIOConfig().checkerSetOpen(true));
>>> }
>>> catch (Exception e)
>>> {
>>> e.printStackTrace();
>>> return false;
>>> }
>>>
>>>
>>> %%%%%%%%%%%%%
>>> Listing B
>>> %%%%%%%%%%%%%
>>>
>>> My project parent pom is
>>>
>>> <parent>
>>> <groupId>net.imagej</groupId>
>>> <artifactId>pom-imagej</artifactId>
>>> <version>5.12.0</version>
>>> </parent>
>>>
>>>  I have the following maven dependencies
>>>
>>> <dependency>
>>> <groupId>io.scif</groupId>
>>> <artifactId>scifio</artifactId>
>>> </dependency>
>>> <dependency>
>>> <groupId>io.scif</groupId>
>>> <artifactId>scifio-bf-compat</artifactId>
>>> <scope>runtime</scope>
>>> </dependency>
>>>
>>> A "limited" list of 30 formats show up in the DefaultFormatService
>>> currently and don't include ND2. (see Listing C)
>>>
>>>
>>> %%%%%%%%%%%%%
>>> Listing C
>>> %%%%%%%%%%%%%
>>>
>>> (*) Formats in DefaultFormatService
>>>
>>> ImageJ ij = new ImageJ();
>>> Set<Format> formats = ij.scifio().format().getAllFormats();
>>>
>>> returns
>>>
>>> [Bio-Formats Compatibility Format, Animated PNG, Audio Video Interleave,
>>> Windows Bitmap, DICOM, Encapsulated PostScript, Flexible Image Transport
>>> System, Simulated data, Graphics Interchange Format, Image Cytometry
>>> Standard, JPEG-2000, JPEG, Java source code, Multiple Network Graphics,
>>> Micro-Manager, NRRD, OBF, PCX, Portable Gray Map, Text, Zip, QuickTime,
>>> PICT, plugin:class io.scif.ome.formats.OMEXMLFormat, Tile JPEG, QuickTime,
>>> plugin:class io.scif.ome.formats.OMETIFFFormat, Tagged Image File Format,
>>> Minimal TIFF, Tagged Image File Format]
>>>
>>>
>>>
>>> _______________________________________________
>>> ImageJ-devel mailing list
>>> ImageJ-devel at imagej.net
>>> http://imagej.net/mailman/listinfo/imagej-devel
>>>
>>>
>>
>>
>> _______________________________________________
>> 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/20150304/4a16c7ce/attachment-0001.html>


More information about the ImageJ-devel mailing list