-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduced an abstraction layer for all N5 dataset parameters and to … (
#201) * introduced an abstraction layer for all N5 dataset parameters and to potentially expose parts of the image (5D -> 3D for OME-ZARR), this allows us to directly use the N5ImageLoader for example for reading OME-ZARR based datasets. It also supports pre-fetching of all dataset attributes, which can slow down cloud processing if not done. I also added an instantiateN5Reader() method. * Revise, clean up, add javadoc. * BdvN5Format doesn't have to extend N5Properties. Added DefaultN5Properties instead. * 5D container slicing happens by overriding the (now exposed) N5ImageLoader.prepareCachedImage(...) method. * N5ImageLoader.prefetch() must be called by the client if desired. This will open a N5Reader if necessary, so can happen independent of N5ImageLoader.open(). --------- Co-authored-by: tpietzsch <[email protected]>
- Loading branch information
1 parent
4d308f7
commit fe3f2da
Showing
3 changed files
with
258 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*- | ||
* #%L | ||
* BigDataViewer core classes with minimal dependencies. | ||
* %% | ||
* Copyright (C) 2012 - 2024 BigDataViewer developers. | ||
* %% | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* #L% | ||
*/ | ||
package bdv.img.n5; | ||
|
||
import org.janelia.saalfeldlab.n5.DataType; | ||
import org.janelia.saalfeldlab.n5.N5Reader; | ||
|
||
public class DefaultN5Properties implements N5Properties | ||
{ | ||
@Override | ||
public String getDatasetPath( final int setupId, final int timepointId, final int level ) | ||
{ | ||
return BdvN5Format.getPathName( setupId, timepointId, level ); | ||
} | ||
|
||
@Override | ||
public DataType getDataType( final N5Reader n5, final int setupId ) | ||
{ | ||
final String path = BdvN5Format.getPathName( setupId ); | ||
return n5.getAttribute( path, BdvN5Format.DATA_TYPE_KEY, DataType.class ); | ||
} | ||
|
||
@Override | ||
public double[][] getMipmapResolutions( final N5Reader n5, final int setupId ) | ||
{ | ||
final String path = BdvN5Format.getPathName( setupId ); | ||
return n5.getAttribute( path, BdvN5Format.DOWNSAMPLING_FACTORS_KEY, double[][].class ); | ||
} | ||
|
||
@Override | ||
public long[] getDimensions( final N5Reader n5, final int setupId, final int timepointId, final int level ) | ||
{ | ||
final String path = getDatasetPath( setupId, timepointId, level ); | ||
return n5.getDatasetAttributes( path ).getDimensions(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.