public class N5SingleScaleMetadataParser extends Object implements N5MetadataParser<N5SingleScaleMetadata>, N5MetadataWriter<N5SingleScaleMetadata>
N5MetadataParser for N5SingleScaleMetadata.
This parser provides default values for all metadata fields when values for the corresponding keys are not found, i.e., it returns empty metadata only when parsing throws an exception. As a result, this parser should appear as the last element of parser lists that are passed to N5DatasetDiscoverer.
When downsamplingFactors are specified, this parser assumes downsampling was performed using averaging and includes an offset to the resulting spatial transformation. Specifically, for a downsamplling factor of f, this parser yields an offset of (f-1)/2.
| Modifier and Type | Field and Description |
|---|---|
static String |
AFFINE_TRANSFORM_KEY |
static Pattern |
channelPattern |
static Pattern |
channelScaleLevelPattern |
static String |
DOWNSAMPLING_FACTORS_KEY |
static String |
PIXEL_RESOLUTION_KEY |
static Pattern |
scaleLevelPattern |
| Constructor and Description |
|---|
N5SingleScaleMetadataParser() |
| Modifier and Type | Method and Description |
|---|---|
static net.imglib2.realtransform.AffineTransform3D |
buildTransform(double[] downsamplingFactors,
double[] pixelResolution,
Optional<net.imglib2.realtransform.AffineTransform3D> extraTransformOpt) |
static Optional<double[]> |
inferDownsamplingFactorsFromDataset(String dataset) |
Optional<N5SingleScaleMetadata> |
parseMetadata(org.janelia.saalfeldlab.n5.N5Reader n5,
N5TreeNode node)
Called by the
N5DatasetDiscoverer while discovering the N5 tree and filling the metadata for datasets or groups. |
Optional<FinalVoxelDimensions> |
validateAndReturnN5vPixelResoution(org.janelia.saalfeldlab.n5.N5Reader n5,
String group)
Checks whether the given group is an n5v scale level: /c[0-9]+/s[0-9]+,
and if so, returns a
FinalVoxelDimensions. |
void |
writeMetadata(N5SingleScaleMetadata t,
org.janelia.saalfeldlab.n5.N5Writer n5,
String group)
Writes metadata to a dataset or group in an N5 container.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapply, parseDatasetAttributes, parseMetadataandThenpublic static final String DOWNSAMPLING_FACTORS_KEY
public static final String PIXEL_RESOLUTION_KEY
public static final String AFFINE_TRANSFORM_KEY
public static final Pattern channelPattern
public static final Pattern scaleLevelPattern
public static final Pattern channelScaleLevelPattern
public static net.imglib2.realtransform.AffineTransform3D buildTransform(double[] downsamplingFactors, double[] pixelResolution, Optional<net.imglib2.realtransform.AffineTransform3D> extraTransformOpt)
public static Optional<double[]> inferDownsamplingFactorsFromDataset(String dataset)
public Optional<N5SingleScaleMetadata> parseMetadata(org.janelia.saalfeldlab.n5.N5Reader n5, N5TreeNode node)
N5MetadataParserN5DatasetDiscoverer while discovering the N5 tree and filling the metadata for datasets or groups.
The metadata parsing is done in the bottom-up fashion, so the children of the given node have already been processed and should already contain valid metadata (if any).
parseMetadata in interface N5MetadataParser<N5SingleScaleMetadata>n5 - the readernode - list of tree nodespublic Optional<FinalVoxelDimensions> validateAndReturnN5vPixelResoution(org.janelia.saalfeldlab.n5.N5Reader n5, String group)
FinalVoxelDimensions.n5 - the readergroup - the group namepublic void writeMetadata(N5SingleScaleMetadata t, org.janelia.saalfeldlab.n5.N5Writer n5, String group) throws Exception
N5MetadataWriterwriteMetadata in interface N5MetadataWriter<N5SingleScaleMetadata>t - metadatan5 - the n5 writergroup - the path relative to the container root of the group or datasetException - the exceptionCopyright © 2021–2026 Saalfeld Lab. All rights reserved.