- java.lang.Object
-
- bdv.img.cache.VolatileGlobalCellCache
-
- All Implemented Interfaces:
CacheControl
public class VolatileGlobalCellCache extends Object implements CacheControl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVolatileGlobalCellCache.KeyKey for a cell identified by timepoint, setup, level, and index (flattened spatial coordinate).-
Nested classes/interfaces inherited from interface bdv.cache.CacheControl
CacheControl.CacheControls, CacheControl.Dummy
-
-
Field Summary
Fields Modifier and Type Field Description protected net.imglib2.cache.LoaderCache<VolatileGlobalCellCache.Key,net.imglib2.img.cell.Cell<?>>backingCache
-
Constructor Summary
Constructors Constructor Description VolatileGlobalCellCache(int maxNumLevels, int numFetcherThreads)Create a new global cache with a new fetch queue served by the specified number of fetcher threads.VolatileGlobalCellCache(net.imglib2.cache.queue.BlockingFetchQueues<Callable<?>> queue)Create a new global cache with the specified fetch queue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Remove all references to loaded data.<T extends net.imglib2.type.NativeType<T>,A extends net.imglib2.img.basictypeaccess.DataAccess>
VolatileCachedCellImg<T,A>createImg(net.imglib2.img.cell.CellGrid grid, int timepoint, int setup, int level, net.imglib2.cache.volatiles.CacheHints cacheHints, CacheArrayLoader<A> cacheArrayLoader, T type)Create aVolatileCachedCellImgbacked by thisVolatileGlobalCellCache, using the providedCacheArrayLoaderto load data.<T extends net.imglib2.type.NativeType<T>,A extends net.imglib2.img.basictypeaccess.DataAccess>
VolatileCachedCellImg<T,A>createImg(net.imglib2.img.cell.CellGrid grid, int timepoint, int setup, int level, net.imglib2.cache.volatiles.CacheHints cacheHints, SimpleCacheArrayLoader<A> cacheArrayLoader, T type)Create aVolatileCachedCellImgbacked by thisVolatileGlobalCellCache, using the providedSimpleCacheArrayLoaderto load data.voidensureNumPriorities(int numPriorities)Make sure that thefetch queuehas at leastnumPrioritiespriority levels.voidprepareNextFrame()Prepare the cache for providing data for the "next frame", by moving pending cell request to the prefetch queue (BlockingFetchQueues.clearToPrefetch()).
-
-
-
Field Detail
-
backingCache
protected final net.imglib2.cache.LoaderCache<VolatileGlobalCellCache.Key,net.imglib2.img.cell.Cell<?>> backingCache
-
-
Constructor Detail
-
VolatileGlobalCellCache
public VolatileGlobalCellCache(int maxNumLevels, int numFetcherThreads)Create a new global cache with a new fetch queue served by the specified number of fetcher threads.- Parameters:
maxNumLevels- the highest occurring mipmap level plus 1.numFetcherThreads- how many threads should be created to load data.
-
VolatileGlobalCellCache
public VolatileGlobalCellCache(net.imglib2.cache.queue.BlockingFetchQueues<Callable<?>> queue)
Create a new global cache with the specified fetch queue. (It is the callers responsibility to create fetcher threads that serve the queue.)- Parameters:
queue- queue to which asynchronous data loading jobs are submitted
-
-
Method Detail
-
prepareNextFrame
public void prepareNextFrame()
Prepare the cache for providing data for the "next frame", by moving pending cell request to the prefetch queue (BlockingFetchQueues.clearToPrefetch()).- Specified by:
prepareNextFramein interfaceCacheControl
-
ensureNumPriorities
public void ensureNumPriorities(int numPriorities)
Make sure that thefetch queuehas at leastnumPrioritiespriority levels.Typically,
numPrioritiesshould be the number of mipmap levels. Then loading of lower-resolution blocks can be prioritized over higher-resolution blocks.
-
clearCache
public void clearCache()
Remove all references to loaded data.Note that there may be pending cell requests which will re-populate the cache unless the fetch queue is cleared as well.
-
createImg
public <T extends net.imglib2.type.NativeType<T>,A extends net.imglib2.img.basictypeaccess.DataAccess> VolatileCachedCellImg<T,A> createImg(net.imglib2.img.cell.CellGrid grid, int timepoint, int setup, int level, net.imglib2.cache.volatiles.CacheHints cacheHints, CacheArrayLoader<A> cacheArrayLoader, T type)
Create aVolatileCachedCellImgbacked by thisVolatileGlobalCellCache, using the providedCacheArrayLoaderto load data.- Parameters:
grid-timepoint-setup-level-cacheHints-cacheArrayLoader-type-- Returns:
-
createImg
public <T extends net.imglib2.type.NativeType<T>,A extends net.imglib2.img.basictypeaccess.DataAccess> VolatileCachedCellImg<T,A> createImg(net.imglib2.img.cell.CellGrid grid, int timepoint, int setup, int level, net.imglib2.cache.volatiles.CacheHints cacheHints, SimpleCacheArrayLoader<A> cacheArrayLoader, T type)
Create aVolatileCachedCellImgbacked by thisVolatileGlobalCellCache, using the providedSimpleCacheArrayLoaderto load data.- Parameters:
grid-timepoint-setup-level-cacheHints-cacheArrayLoader-type-- Returns:
-
-