public interface Translator extends SCIFIOPlugin, org.scijava.plugin.SingletonPlugin
Translators.
Multiple Translators can be defined for a given Format. Each
encodes a process for converting from one Metadata type to
another (where either the source or the destination is the Metadata
type associated with this Format).
The translate(Metadata, Metadata) method always accepts an instance
of both source and destination Metadata. This allows chaining of
multiple translators (or other methods) to populate a single instance of
Metadata.
If no Metadata instance is readily available for translation, it can
be created through the Format, and existing Metadata
instances can be reset to ensure no previous information persists.
Format.createMetadata(),
TranslatorService| Modifier and Type | Method and Description |
|---|---|
Class<? extends Metadata> |
dest() |
Class<? extends Metadata> |
source() |
void |
translate(Metadata source,
List<ImageMetadata> sourceImgMeta,
Metadata destination)
As
translate(Metadata, Metadata) with the format-specific and
image metadata explicitly split out. |
void |
translate(Metadata source,
Metadata destination)
Uses the source
Metadata to populate the destination
Metadata. |
getVersion, loggetIdentifiercontext, getContext, setContextcompareTo, getPriority, setPrioritygetInfo, setInfogetLocationClass<? extends Metadata> source()
Class<? extends Metadata> dest()
void translate(Metadata source, Metadata destination)
Metadata to populate the destination
Metadata. Specifically, the format-specific metadata and/or
ImageMetadata of the source are used to populate the format-
specific metadata of the destination (from which the destination's
ImageMetadata can be derived}.
Note that the destination does not have to be empty, but can be built up through multiple translations. However each translation step is assumed to overwrite any previously existing data.
For a reference to a fresh Metadata instance to use in translation,
consider the Format.createMetadata() method.
source - Metadata to use to populatedestination - Metadata to be populatedIllegalArgumentException - if the arguments don't match the
Metadata types of this Translator.Format.createMetadata()void translate(Metadata source, List<ImageMetadata> sourceImgMeta, Metadata destination)
translate(Metadata, Metadata) with the format-specific and
image metadata explicitly split out.
NB: it is NOT GUARANTEED that the Metadata.getAll() method of the
source here will provide equivalent ImageMetadata as sourceImgMeta.
For example, if a MetadataWrapper was used, the two are unlikely to
match up. This is necessary, as Translator discovery depends on the
format of source and destination, but augmentation via wrapping must affect
the underlying ImageMetadata non-destructively.
source - Metadata to use to populatesourceImgMeta - ImageMetadata to use to populatedestination - Metadata to be populatedCopyright © 2011–2026 SCIFIO. All rights reserved.