public class ZarrKeyValueWriter extends ZarrKeyValueReader implements org.janelia.saalfeldlab.n5.CachedGsonKeyValueN5Writer
KeyValueAccess implementation.| Modifier and Type | Class and Description |
|---|---|
protected static class |
ZarrKeyValueWriter.ZarrJsonElements
Stores
JsonObjects to be written to .zattrs, .zgroup, and .zarray. |
org.janelia.saalfeldlab.n5.N5Writer.DataBlockSupplier<T>org.janelia.saalfeldlab.n5.N5Reader.Versioncache, cacheMeta, dimensionSeparator, gson, keyValueAccess, mapN5DatasetAttributes, mergeAttributes, uri, VERSION, VERSION_ZERO, ZARR_FORMAT_KEY, ZARRAY_FILE, ZATTRS_FILE, ZGROUP_FILENO_VERSION, VERSION, VERSION_KEY| Constructor and Description |
|---|
ZarrKeyValueWriter(org.janelia.saalfeldlab.n5.KeyValueAccess keyValueAccess,
String basePath,
com.google.gson.GsonBuilder gsonBuilder,
boolean mapN5DatasetAttributes,
boolean mergeAttributes,
String dimensionSeparator,
boolean cacheAttributes)
Opens an
ZarrKeyValueWriter at a given base path with a custom
GsonBuilder to support custom attributes. |
addTypeAdapters, cacheMeta, combine, combineAll, createDatasetAttributes, datasetExists, exists, existsFromContainer, getAttribute, getAttribute, getAttributes, getAttributesFromContainer, getAttributesKey, getAttributesUnmapped, getCache, getConvertedDatasetAttributes, getDatasetAttributes, getGson, getJsonResource, getKeyValueAccess, getURI, getVersion, getVersion, getZArray, getZArrayAttributes, getZArrayAttributes, getZAttributes, getZGroup, groupExists, isDatasetFromAttributes, isDatasetFromContainer, isGroupFromAttributes, isGroupFromContainer, n5ToZarrDatasetAttributes, newCache, reverseAttrsWhenCOrder, toString, zarrToN5DatasetAttributesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitremove, writeAndCacheAttributes, writeAttributescacheMeta, datasetExists, exists, existsFromContainer, getAttribute, getAttribute, getAttributes, getAttributesFromContainer, getCache, getDatasetAttributes, groupExists, hasDatasetAttributes, isDatasetFromAttributes, isDatasetFromContainer, isGroupFromAttributes, isGroupFromContainer, list, listFromContainer, newCache, normalGetDatasetAttributesdeleteBlock, deleteChunk, deleteChunks, initializeContainer, removeAttributes, setAttributes, writeAttributes, writeBlock, writeChunk, writeChunks, writeRegion, writeRegioncreateDataset, deleteBlock, deleteChunk, remove, setAttribute, setVersion, writeSerializedBlockabsoluteAttributesPath, absoluteGroupPath, blockExists, getKeyValueAccess, readBlock, readChunk, readChunkscreateDatasetAttributes, getAttributesKey, getGson, listAttributesclose, deepList, deepList, deepList, deepList, deepList, deepListDatasets, deepListDatasets, deepListDatasets, deepListDatasets, deepListHelper, getConvertedDatasetAttributes, getGroupSeparator, getURI, getVersion, groupPath, readSerializedBlockpublic ZarrKeyValueWriter(org.janelia.saalfeldlab.n5.KeyValueAccess keyValueAccess, String basePath, com.google.gson.GsonBuilder gsonBuilder, boolean mapN5DatasetAttributes, boolean mergeAttributes, String dimensionSeparator, boolean cacheAttributes) throws org.janelia.saalfeldlab.n5.N5Exception
ZarrKeyValueWriter at a given base path with a custom
GsonBuilder to support custom attributes.
If the base path does not exist, it will be created.
If the base path exists and if the N5 version of the container is
compatible with this implementation, the N5 version of this container
will be set to the current N5 version of this implementation.keyValueAccess - basePath - n5 base pathgsonBuilder - cacheAttributes - cache attributes
Setting this to true avoids frequent reading and parsing of
JSON
encoded attributes, this is most interesting for high latency
file
systems. Changes of attributes by an independent writer will
not be
tracked.org.janelia.saalfeldlab.n5.N5Exception - if the base path cannot be written to or cannot be created.public boolean isCompatible(org.janelia.saalfeldlab.n5.N5Reader.Version version)
public void setVersion(String path) throws org.janelia.saalfeldlab.n5.N5Exception
setVersion in interface org.janelia.saalfeldlab.n5.CachedGsonKeyValueN5WritersetVersion in interface org.janelia.saalfeldlab.n5.GsonKeyValueN5Writerorg.janelia.saalfeldlab.n5.N5Exceptionprotected void setVersion(String path, boolean create) throws org.janelia.saalfeldlab.n5.N5Exception
protected void initializeGroup(String normalPath) throws org.janelia.saalfeldlab.n5.N5Exception
normalPath - org.janelia.saalfeldlab.n5.N5Exceptionpublic void createGroup(String path) throws org.janelia.saalfeldlab.n5.N5Exception
createGroup in interface org.janelia.saalfeldlab.n5.CachedGsonKeyValueN5WritercreateGroup in interface org.janelia.saalfeldlab.n5.GsonKeyValueN5WritercreateGroup in interface org.janelia.saalfeldlab.n5.N5Writerorg.janelia.saalfeldlab.n5.N5Exceptionpublic ZarrDatasetAttributes createDataset(String path, org.janelia.saalfeldlab.n5.DatasetAttributes datasetAttributes) throws org.janelia.saalfeldlab.n5.N5Exception
createDataset in interface org.janelia.saalfeldlab.n5.N5Writerorg.janelia.saalfeldlab.n5.N5Exceptionpublic void setAttributes(String path, Map<String,?> attributes) throws org.janelia.saalfeldlab.n5.N5Exception
setAttributes in interface org.janelia.saalfeldlab.n5.GsonKeyValueN5WritersetAttributes in interface org.janelia.saalfeldlab.n5.N5Writerorg.janelia.saalfeldlab.n5.N5Exceptionpublic boolean removeAttribute(String pathName, String key) throws org.janelia.saalfeldlab.n5.N5Exception
removeAttribute in interface org.janelia.saalfeldlab.n5.GsonKeyValueN5WriterremoveAttribute in interface org.janelia.saalfeldlab.n5.N5Writerorg.janelia.saalfeldlab.n5.N5Exceptionpublic <T> T removeAttribute(String pathName, String key, Class<T> cls) throws org.janelia.saalfeldlab.n5.N5Exception
removeAttribute in interface org.janelia.saalfeldlab.n5.GsonKeyValueN5WriterremoveAttribute in interface org.janelia.saalfeldlab.n5.N5Writerorg.janelia.saalfeldlab.n5.N5Exceptionpublic void setDatasetAttributes(String pathName, org.janelia.saalfeldlab.n5.DatasetAttributes datasetAttributes) throws org.janelia.saalfeldlab.n5.N5Exception
setDatasetAttributes in interface org.janelia.saalfeldlab.n5.N5Writerorg.janelia.saalfeldlab.n5.N5Exceptionpublic void setZArrayAttributes(String pathName, ZArrayAttributes attributes) throws org.janelia.saalfeldlab.n5.N5Exception
pathName - the group / dataset pathattributes - ZArray attributesorg.janelia.saalfeldlab.n5.N5Exception - the exceptionprotected void setZGroup(String pathName, org.janelia.saalfeldlab.n5.N5Reader.Version version) throws IOException
IOExceptionprotected void deleteJsonResource(String normalPath, String jsonName) throws org.janelia.saalfeldlab.n5.N5Exception
protected void writeJson(String normalPath, String jsonName, com.google.gson.JsonElement attributes) throws org.janelia.saalfeldlab.n5.N5Exception
protected void writeJsonResource(String normalPath, String jsonName, Object attributes) throws org.janelia.saalfeldlab.n5.N5Exception
protected void writeZArray(String normalGroupPath, com.google.gson.JsonElement attributes) throws org.janelia.saalfeldlab.n5.N5Exception
protected void writeZGroup(String normalGroupPath, com.google.gson.JsonElement attributes) throws org.janelia.saalfeldlab.n5.N5Exception
protected void writeZAttrs(String normalGroupPath, com.google.gson.JsonElement attributes) throws org.janelia.saalfeldlab.n5.N5Exception
public static byte[] padCrop(byte[] src,
int[] srcBlockSize,
int[] dstBlockSize,
int nBytes,
int nBits,
byte[] fill_value)
protected void redirectDatasetAttribute(com.google.gson.JsonObject src, String key, ZarrKeyValueWriter.ZarrJsonElements zarrElems, ZarrDatasetAttributes dsetAttrs)
protected static void redirectDatasetAttribute(com.google.gson.JsonObject src, String srcKey, com.google.gson.JsonObject dest, String destKey)
protected void redirectDatasetAttribute(com.google.gson.JsonObject src, String srcKey, ZarrKeyValueWriter.ZarrJsonElements zarrElems, String destKey, ZarrDatasetAttributes dsetAttrs)
protected void redirectGroupDatasetAttribute(com.google.gson.JsonObject src, String srcKey, ZarrKeyValueWriter.ZarrJsonElements zarrElems, String destKey, ZarrDatasetAttributes dsetAttrs)
protected static void redirectDataType(com.google.gson.JsonObject src, com.google.gson.JsonObject dest)
protected static void redirectCompression(com.google.gson.JsonObject src, com.google.gson.Gson gson, com.google.gson.JsonObject dest)
protected static ZarrKeyValueWriter.ZarrJsonElements build(com.google.gson.JsonObject obj, com.google.gson.Gson gson)
protected static ZarrKeyValueWriter.ZarrJsonElements build(com.google.gson.JsonObject obj, com.google.gson.Gson gson, boolean mapN5Attributes)
ZarrKeyValueWriter.ZarrJsonElements object from a JsonObject containing attributes.
Used when re-directing attributes to the appropriate zarr metadata files according to attribute keys.
obj - the json attributes objectgson - the jsonmapN5Attributes - if true, map n5 attribute keys to corresponding zarr attribute keysprotected static boolean hasRequiredArrayKeys(com.google.gson.JsonObject obj)
protected static void move(com.google.gson.JsonObject src, Supplier<com.google.gson.JsonObject> dstSup, String... keys)
Copyright © 2019–2026 Saalfeld Lab. All rights reserved.