Search in sources :

Example 1 with N5TreeNode

use of org.janelia.saalfeldlab.n5.N5TreeNode in project bigwarp by saalfeldlab.

the class BigWarpInit method loadN5Source.

public static Source<?> loadN5Source(final String n5Root, final String n5Dataset) {
    final N5Reader n5;
    try {
        n5 = new N5Factory().openReader(n5Root);
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
    final N5MetadataParser<?>[] PARSERS = new N5MetadataParser[] { new ImagePlusLegacyMetadataParser(), new N5CosemMetadataParser(), new N5SingleScaleMetadataParser(), new CanonicalMetadataParser(), new N5GenericSingleScaleMetadataParser() };
    final N5MetadataParser<?>[] GROUP_PARSERS = new N5MetadataParser[] { new N5CosemMultiScaleMetadata.CosemMultiScaleParser(), new N5ViewerMultiscaleMetadataParser(), new CanonicalMetadataParser() };
    N5Metadata meta = null;
    try {
        final N5DatasetDiscoverer discoverer = new N5DatasetDiscoverer(n5, N5DatasetDiscoverer.fromParsers(PARSERS), N5DatasetDiscoverer.fromParsers(GROUP_PARSERS));
        final N5TreeNode node = discoverer.discoverAndParseRecursive(n5Dataset);
        meta = node.getMetadata();
    } catch (IOException e) {
    }
    if (meta instanceof MultiscaleMetadata) {
        return openAsSourceMulti(n5, (MultiscaleMetadata<?>) meta, true);
    } else {
        return openAsSource(n5, meta, true);
    }
}
Also used : N5DatasetDiscoverer(org.janelia.saalfeldlab.n5.N5DatasetDiscoverer) ImagePlusLegacyMetadataParser(org.janelia.saalfeldlab.n5.metadata.imagej.ImagePlusLegacyMetadataParser) N5ViewerMultiscaleMetadataParser(org.janelia.saalfeldlab.n5.metadata.N5ViewerMultiscaleMetadataParser) N5Metadata(org.janelia.saalfeldlab.n5.metadata.N5Metadata) N5TreeNode(org.janelia.saalfeldlab.n5.N5TreeNode) N5MetadataParser(org.janelia.saalfeldlab.n5.metadata.N5MetadataParser) MultiscaleMetadata(org.janelia.saalfeldlab.n5.metadata.MultiscaleMetadata) IOException(java.io.IOException) N5CosemMetadataParser(org.janelia.saalfeldlab.n5.metadata.N5CosemMetadataParser) N5SingleScaleMetadataParser(org.janelia.saalfeldlab.n5.metadata.N5SingleScaleMetadataParser) N5GenericSingleScaleMetadataParser(org.janelia.saalfeldlab.n5.metadata.N5GenericSingleScaleMetadataParser) N5Factory(org.janelia.saalfeldlab.n5.ij.N5Factory) N5Reader(org.janelia.saalfeldlab.n5.N5Reader) CanonicalMetadataParser(org.janelia.saalfeldlab.n5.metadata.canonical.CanonicalMetadataParser)

Aggregations

IOException (java.io.IOException)1 N5DatasetDiscoverer (org.janelia.saalfeldlab.n5.N5DatasetDiscoverer)1 N5Reader (org.janelia.saalfeldlab.n5.N5Reader)1 N5TreeNode (org.janelia.saalfeldlab.n5.N5TreeNode)1 N5Factory (org.janelia.saalfeldlab.n5.ij.N5Factory)1 MultiscaleMetadata (org.janelia.saalfeldlab.n5.metadata.MultiscaleMetadata)1 N5CosemMetadataParser (org.janelia.saalfeldlab.n5.metadata.N5CosemMetadataParser)1 N5GenericSingleScaleMetadataParser (org.janelia.saalfeldlab.n5.metadata.N5GenericSingleScaleMetadataParser)1 N5Metadata (org.janelia.saalfeldlab.n5.metadata.N5Metadata)1 N5MetadataParser (org.janelia.saalfeldlab.n5.metadata.N5MetadataParser)1 N5SingleScaleMetadataParser (org.janelia.saalfeldlab.n5.metadata.N5SingleScaleMetadataParser)1 N5ViewerMultiscaleMetadataParser (org.janelia.saalfeldlab.n5.metadata.N5ViewerMultiscaleMetadataParser)1 CanonicalMetadataParser (org.janelia.saalfeldlab.n5.metadata.canonical.CanonicalMetadataParser)1 ImagePlusLegacyMetadataParser (org.janelia.saalfeldlab.n5.metadata.imagej.ImagePlusLegacyMetadataParser)1