Bio-Formats as a library: which dependencies?

As Bio-Formats becomes increasingly indispensable within QuPath, I’d really appreciate any advice on how best to include it.

Based on Using Bio-Formats as a Java library, I’ve tried a few things:

  • Requesting users download bioformats_package.jar themselves
  • Including bioformats_package.jar in QuPath (this causes some slf4j trouble)
  • Including formats-gpl with Gradle

The last option seems the most reliable, but it results in a lot of other dependencies being included (MinIO may be especially culpable). They aren’t really doing any harm, but I’d rather streamline things as possible - not least to help with bundling up all third party licenses.

Since I saw in the docs most additional libraries are optional I had a look at Fiji, and it seems to contain a restricted set of jars (this one?), but I’m not sure how this is managed.

Are there any tips about how to include ‘the right amount of’ Bio-Formats in an application like QuPath?

1 Like

Hi Pete, if you want to streamline the dependencies I would certainly recommend the 3rd option you listed rather than using the package jar.

This will still pull some dependencies that are needed but should be more efficient. That being said I did a quick gradle test and there were some discrepancies between it and mvn. In ome-common we had specifically excluded some dependencies for minIO ( but these seemed to be present in the gradle dependency tree. Adding the below should exclude those additional modules to improve things further:

configurations.all {
   exclude group:"commons-codec", module: "commons-codec"
   exclude group:"commons-logging", module: "commons-logging"
   exclude group:"", module:"jsr305"
   exclude group:"", module:"annotations"

Thanks @dgault! I’ve added this, and thanks to @imagejan’s helpful tagging of this post I also saw from your post at Bio-Formats 6 dependencies not present on Java-8 update site that minio should be optional… so I have tried removing it as well for now. The result is about 10 fewer jars to include.

1 Like

The MiniIO dependency is only used when reading images from an S3 location. So if that is not needed then excluding it should be safe.

1 Like