public final class PerImageMetadataStore extends Object implements AutoCloseable
ome-metadata.ndjson): one line {"axes":{...},"meta":<json>} per image.
An in-memory axesKey -> metadataJson map is the source of truth for reads and is
updated synchronously (via put(java.lang.String, java.lang.String)) as images are recorded, so metadata is readable the
instant an image is queued (mirroring NDTiffStorage's separate index sidecar). The file
append (append(java.util.Map<java.lang.String, java.lang.Object>, java.lang.String)) is done separately — on the storage's writer thread — so JSON
validation and the flushed disk write never add latency to the acquisition thread. The file
is append-only, which keeps it crash-tolerant and safe to tail while writing.
Per-image metadata is also embedded in each plane's TIFF ImageDescription-sibling
private tag by the writer, so a standalone TIFF file is self-describing; the sidecar keeps the
fast, appendable index used for read-while-write.
| Modifier and Type | Method and Description |
|---|---|
void |
append(Map<String,Object> axes,
String metadataJson)
Append one NDJSON line to the sidecar.
|
void |
close() |
static PerImageMetadataStore |
createWritable(Path datasetRoot)
Open for writing (creates/appends the sidecar).
|
String |
get(String axesKey)
Metadata JSON for the given key, or null if none recorded.
|
boolean |
has(String axesKey) |
Set<String> |
keySet()
Unmodifiable view of every recorded axes key (serialized form).
|
static PerImageMetadataStore |
openReadOnly(Path datasetRoot)
Open for reading; loads any existing sidecar into the in-memory index.
|
void |
put(String axesKey,
String metadataJson)
Record per-image metadata in the in-memory index (readable immediately).
|
public static PerImageMetadataStore createWritable(Path datasetRoot)
public static PerImageMetadataStore openReadOnly(Path datasetRoot)
public void put(String axesKey, String metadataJson)
append(java.util.Map<java.lang.String, java.lang.Object>, java.lang.String) afterwards — typically from the writer thread — to persist it.axesKey - canonical serialized axes keymetadataJson - per-image metadata JSON (may be null)public void append(Map<String,Object> axes, String metadataJson)
get(java.lang.String); no-op in read-only mode.axes - the axes map (stored for round-trip)metadataJson - per-image metadata JSON (may be null)public boolean has(String axesKey)
public void close()
close in interface AutoCloseableCopyright © 2026. All rights reserved.