- java.lang.Object
-
- bdv.img.n5.N5ImageLoader
-
- All Implemented Interfaces:
ViewerImgLoader,mpicbg.spim.data.generic.sequence.BasicImgLoader,mpicbg.spim.data.generic.sequence.BasicMultiResolutionImgLoader,mpicbg.spim.data.sequence.ImgLoader,mpicbg.spim.data.sequence.MultiResolutionImgLoader
public class N5ImageLoader extends Object implements ViewerImgLoader, mpicbg.spim.data.sequence.MultiResolutionImgLoader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classN5ImageLoader.SetupImgLoader<T extends net.imglib2.type.NativeType<T>,V extends net.imglib2.Volatile<T> & net.imglib2.type.NativeType<V>>
-
Constructor Summary
Constructors Constructor Description N5ImageLoader(File n5File, mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> sequenceDescription)N5ImageLoader(URI n5URI, mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> sequenceDescription)N5ImageLoader(org.janelia.saalfeldlab.n5.N5Reader n5Reader, URI n5URI, mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> sequenceDescription)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Clear the cache.static SimpleCacheArrayLoader<?>createCacheArrayLoader(org.janelia.saalfeldlab.n5.N5Reader n5, String pathName)protected N5PropertiescreateN5PropertiesInstance()Create a new N5Properties (provides metadata and resolves dataset paths).CacheControlgetCacheControl()FilegetN5File()URIgetN5URI()N5ImageLoader.SetupImgLoader<?,?>getSetupImgLoader(int setupId)protected org.janelia.saalfeldlab.n5.N5ReaderinstantiateN5Reader()Create a new N5Reader.Future<Void>prefetch(int parallelism)Touch all metadata in advance in parallel so the N5-API caches them.protected <T extends net.imglib2.type.NativeType<T>>
net.imglib2.RandomAccessibleInterval<T>prepareCachedImage(String datasetPath, int setupId, int timepointId, int level, net.imglib2.cache.volatiles.CacheHints cacheHints, T type)Create aCellImgbacked by the cache.voidsetCreatedSharedQueue(SharedQueue createdSharedQueue)Use the givenSharedQueueto asynchronously load blocks.voidsetNumFetcherThreads(int n)Set the number of fetcher threads that will be created to asynchronously load blocks.
-
-
-
Constructor Detail
-
N5ImageLoader
public N5ImageLoader(URI n5URI, mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> sequenceDescription)
-
N5ImageLoader
public N5ImageLoader(File n5File, mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> sequenceDescription)
-
N5ImageLoader
public N5ImageLoader(org.janelia.saalfeldlab.n5.N5Reader n5Reader, URI n5URI, mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> sequenceDescription)
-
-
Method Detail
-
getN5URI
public URI getN5URI()
-
getN5File
public File getN5File()
-
instantiateN5Reader
protected org.janelia.saalfeldlab.n5.N5Reader instantiateN5Reader()
Create a new N5Reader.Can be overridden by subclasses (rather than only having the option to provide an instance at construction time).
- Returns:
- a new N5Reader instance
-
createN5PropertiesInstance
protected N5Properties createN5PropertiesInstance()
Create a new N5Properties (provides metadata and resolves dataset paths).Can be overridden by subclasses to adapt to different metadata schemes and storage layouts.
- Returns:
- a new N5Properties instance.
-
prefetch
public Future<Void> prefetch(int parallelism)
Touch all metadata in advance in parallel so the N5-API caches them.prefetch()completes immediately. The prefetching is done asynchronously in a newForkJoinPoolwith the indicatedparallelismlevel. The returnedFuturecan be used to wait for completion of the async prefetching.- Parameters:
parallelism- the parallelism level- Returns:
- represents completion of the prefetching
-
setNumFetcherThreads
public void setNumFetcherThreads(int n)
Description copied from interface:ViewerImgLoaderSet the number of fetcher threads that will be created to asynchronously load blocks. It is permitted to setn=0, but that means that the volatile versions of images may not work correctly.This is an optional operation, i.e., some ImgLoader implementations may just ignore it.
This method should be called before using the image loader, otherwise it might not have the desired effect.
- Specified by:
setNumFetcherThreadsin interfaceViewerImgLoader
-
setCreatedSharedQueue
public void setCreatedSharedQueue(SharedQueue createdSharedQueue)
Description copied from interface:ViewerImgLoaderUse the givenSharedQueueto asynchronously load blocks.This is an optional operation, i.e., some ImgLoader implementations may just ignore it.
This method should be called before using the image loader, otherwise it might not have the desired effect.
- Specified by:
setCreatedSharedQueuein interfaceViewerImgLoader
-
close
public void close()
-
getSetupImgLoader
public N5ImageLoader.SetupImgLoader<?,?> getSetupImgLoader(int setupId)
- Specified by:
getSetupImgLoaderin interfacempicbg.spim.data.generic.sequence.BasicImgLoader- Specified by:
getSetupImgLoaderin interfacempicbg.spim.data.generic.sequence.BasicMultiResolutionImgLoader- Specified by:
getSetupImgLoaderin interfacempicbg.spim.data.sequence.ImgLoader- Specified by:
getSetupImgLoaderin interfacempicbg.spim.data.sequence.MultiResolutionImgLoader- Specified by:
getSetupImgLoaderin interfaceViewerImgLoader
-
getCacheControl
public CacheControl getCacheControl()
- Specified by:
getCacheControlin interfaceViewerImgLoader
-
prepareCachedImage
protected <T extends net.imglib2.type.NativeType<T>> net.imglib2.RandomAccessibleInterval<T> prepareCachedImage(String datasetPath, int setupId, int timepointId, int level, net.imglib2.cache.volatiles.CacheHints cacheHints, T type)
Create aCellImgbacked by the cache.
-
createCacheArrayLoader
public static SimpleCacheArrayLoader<?> createCacheArrayLoader(org.janelia.saalfeldlab.n5.N5Reader n5, String pathName) throws IOException
- Throws:
IOException
-
-