Caveat emptor: this is experimental code, which will be later merged elsewhere!
Motivation
Metadata is incredibly important in scientific image processing. The ImgLib2 ecosystem has no formal mechanism for working with metadata. This repository aims to solve that.
Goals
The library goals are:
- Compatibility with existing ImgLib2 types: data+metadata should behave like standard
RandomAccessible/RandomAccessibleIntervalobjects. - Transform-aware metadata: views or transforms applied to data should automatically apply to associated metadata as well.
- Type-safe, interface-driven access: a small, well-typed API for querying and composing metadata without unnecessary copying.
- Convenient structured metadata access for common formats (for example, OME).
The main metadata stand-in throughout the Fiji ecosystem is the Dataset class of ImageJ2, used by e.g. SCIFIO. However, it has a number of issues:
- It cannot operate within a type-safe environment. This hinders use within ImgLib2-algorithm, SciJava Ops, etc.
- It requires the dependency of imagej-common.
Build
Currently, this project depends upon a few snapshots, which you'll need to obtain before building this project:
imglib2, based on theraiview-genericsbranchimglib2-imagej, based on themainbranch. Used as a test dependency.
Current Status
The current design is centered around a few interfaces:
- The
MetadataItemis a piece of metadata in an n-dimensional data space.- It can be identified by a
String keyand a set of "attached" dimensional axes.- Metadata can (but may not) vary along each of its attached axes, e.g.:
- Channel LUTs might be a 1-dimensional piece of metadata "attached" to the channel axis. The LUT used for a pixel varies only on the channel axis.
- An axis label (X, Y, Channel, etc.) is a 0-dimensional piece of metadata "attached" to some axis. It does not vary along that axis.
- ROIs are n-dimensional pieces of metadata "attached" to all axes.
- Metadata can (but may not) vary along each of its attached axes, e.g.:
- It can be identified by a
- The
MetadataStoreis a collection of metadata, supporting retrieval (MetadataStore.item), agglomeration (MetadataStore.add) ofMetadataItems.MetadataStores can be viewed likeRandomAccessibles can be viewed with the ImgLib2 Fluent API.
- The
Datasetclass as the fundamental currency in metadata-rich data processing.- A union of a
MetadataStoreand aRandomAccessible - Viewable using the fluent views API. e.g.
Dataset new = old.permute(3, 2)should be painless.
- A union of a
The pain points are:
RandomAccessibleViewand its subclasses have difficult typing.- This makes it difficult to subclass
Dataset, if we want aDatasetIntervalor aRealDataset - See imglib/imglib2#379
- This makes it difficult to subclass
- Creating mutable
MetadataItems are tedious.RandomAccessibleIntervals are tricky to mutate - they rely on element mutability.- Many common-sense metadata types (e.g. String,
ColorTable) are not mutable.
- Many common-sense metadata types (e.g. String,
- Do we even need metadata mutability?
Future Work Where do we go from here?
- Spec out
HasMetadataStoreinterfaces for OME-NGFF metadata? - Get those imglib PRs merged? (Note that imglib/imglib2#379 is technically a breaking change).
- Package review?