diff --git a/src/main/java/bdv/cl/JoclExample.java b/src/main/java/bdv/cl/JoclExample.java
index 04f59e31bcfbf3903ead6922e85c665a0cf87229..674f3af87233e3b97854a6f8a2b7d74ed47d6c14 100644
--- a/src/main/java/bdv/cl/JoclExample.java
+++ b/src/main/java/bdv/cl/JoclExample.java
@@ -1,27 +1,11 @@
package bdv.cl;
-import ij.ImageJ;
-
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import java.util.Random;
-import mpicbg.spim.data.SpimDataException;
-import net.imglib2.img.array.ArrayImgs;
-import net.imglib2.img.basictypeaccess.volatiles.array.VolatileShortArray;
-import net.imglib2.img.display.imagej.ImageJFunctions;
-import net.imglib2.util.IntervalIndexer;
-import bdv.img.cache.CacheHints;
-import bdv.img.cache.LoadingStrategy;
-import bdv.img.cache.VolatileCell;
-import bdv.img.cache.VolatileGlobalCellCache;
-import bdv.img.hdf5.Hdf5ImageLoader;
-import bdv.spimdata.SequenceDescriptionMinimal;
-import bdv.spimdata.SpimDataMinimal;
-import bdv.spimdata.XmlIoSpimDataMinimal;
-
import com.jogamp.common.nio.Buffers;
import com.jogamp.opencl.CLBuffer;
import com.jogamp.opencl.CLCommandQueue;
@@ -37,6 +21,22 @@ import com.jogamp.opencl.CLMemory.Map;
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.CLProgram;
+import bdv.img.cache.CacheHints;
+import bdv.img.cache.LoadingStrategy;
+import bdv.img.cache.VolatileCell;
+import bdv.img.cache.VolatileGlobalCellCache;
+import bdv.img.hdf5.Hdf5ImageLoader;
+import bdv.img.hdf5.Hdf5VolatileShortArrayLoader;
+import bdv.spimdata.SequenceDescriptionMinimal;
+import bdv.spimdata.SpimDataMinimal;
+import bdv.spimdata.XmlIoSpimDataMinimal;
+import ij.ImageJ;
+import mpicbg.spim.data.SpimDataException;
+import net.imglib2.img.array.ArrayImgs;
+import net.imglib2.img.basictypeaccess.volatiles.array.VolatileShortArray;
+import net.imglib2.img.display.imagej.ImageJFunctions;
+import net.imglib2.util.IntervalIndexer;
+
public class JoclExample
{
private final String fn = "/Users/pietzsch/workspace/data/111010_weber_full.xml";
@@ -117,10 +117,11 @@ public class JoclExample
final SpimDataMinimal spimData = io.load( fn );
final SequenceDescriptionMinimal seq = spimData.getSequenceDescription();
final Hdf5ImageLoader imgLoader = ( Hdf5ImageLoader ) seq.getImgLoader();
+ final Hdf5VolatileShortArrayLoader loader = imgLoader.getShortArrayLoader();
- final VolatileGlobalCellCache< VolatileShortArray > cache = imgLoader.getCache();
+ final VolatileGlobalCellCache cache = imgLoader.getCache();
final CacheHints cacheHints = new CacheHints( LoadingStrategy.BLOCKING, 0, false );
- final VolatileGlobalCellCache< VolatileShortArray >.VolatileCellCache cellCache = cache.new VolatileCellCache( 0, 0, 0, cacheHints );
+ final VolatileGlobalCellCache.VolatileCellCache< VolatileShortArray > cellCache = cache.new VolatileCellCache< VolatileShortArray >( 1, 0, 0, cacheHints, loader );
final int n = 3;
final int[] dim = new int[] { 15, 7, 3 };
diff --git a/src/main/java/bdv/cl/RenderSlice.java b/src/main/java/bdv/cl/RenderSlice.java
index 10d986599d1fa524946adef703234e37f50d4d82..ed956fa7903e893487a97b5c18e95f6bc5307704 100644
--- a/src/main/java/bdv/cl/RenderSlice.java
+++ b/src/main/java/bdv/cl/RenderSlice.java
@@ -11,28 +11,6 @@ import java.nio.ShortBuffer;
import javax.swing.JFrame;
-import mpicbg.spim.data.sequence.ViewId;
-import net.imglib2.Cursor;
-import net.imglib2.RandomAccessible;
-import net.imglib2.display.screenimage.awt.UnsignedByteAWTScreenImage;
-import net.imglib2.img.array.ArrayImgs;
-import net.imglib2.realtransform.AffineTransform2D;
-import net.imglib2.realtransform.AffineTransform3D;
-import net.imglib2.type.numeric.integer.UnsignedShortType;
-import net.imglib2.ui.InteractiveDisplayCanvasComponent;
-import net.imglib2.ui.overlay.BufferedImageOverlayRenderer;
-import net.imglib2.ui.util.GuiUtil;
-import net.imglib2.util.IntervalIndexer;
-import net.imglib2.util.Intervals;
-import net.imglib2.view.Views;
-import bdv.cl.BlockTexture.Block;
-import bdv.cl.BlockTexture.BlockKey;
-import bdv.cl.FindRequiredBlocks.RequiredBlocks;
-import bdv.img.cache.CachedCellImg;
-import bdv.img.hdf5.Hdf5ImageLoader;
-import bdv.viewer.Source;
-import bdv.viewer.state.ViewerState;
-
import com.jogamp.common.nio.Buffers;
import com.jogamp.opencl.CLBuffer;
import com.jogamp.opencl.CLCommandQueue;
@@ -51,6 +29,28 @@ import com.jogamp.opencl.CLMemory.Map;
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.CLProgram;
+import bdv.cl.BlockTexture.Block;
+import bdv.cl.BlockTexture.BlockKey;
+import bdv.cl.FindRequiredBlocks.RequiredBlocks;
+import bdv.img.cache.CachedCellImg;
+import bdv.img.hdf5.Hdf5ImageLoader;
+import bdv.viewer.Source;
+import bdv.viewer.state.ViewerState;
+import mpicbg.spim.data.sequence.ViewId;
+import net.imglib2.Cursor;
+import net.imglib2.RandomAccessible;
+import net.imglib2.display.screenimage.awt.UnsignedByteAWTScreenImage;
+import net.imglib2.img.array.ArrayImgs;
+import net.imglib2.realtransform.AffineTransform2D;
+import net.imglib2.realtransform.AffineTransform3D;
+import net.imglib2.type.numeric.integer.UnsignedShortType;
+import net.imglib2.ui.InteractiveDisplayCanvasComponent;
+import net.imglib2.ui.overlay.BufferedImageOverlayRenderer;
+import net.imglib2.ui.util.GuiUtil;
+import net.imglib2.util.IntervalIndexer;
+import net.imglib2.util.Intervals;
+import net.imglib2.view.Views;
+
public class RenderSlice
{
private final Hdf5ImageLoader imgLoader;
@@ -147,7 +147,8 @@ public class RenderSlice
t = System.currentTimeMillis() - t;
System.out.println( "getRequiredBlocks: " + t + " ms" );
t = System.currentTimeMillis();
- final RandomAccessible< UnsignedShortType > img = Views.extendZero( imgLoader.getImage( new ViewId( timepointId, setupId ), 0 ) ); // TODO
+ final RandomAccessible< UnsignedShortType > img = Views.extendZero(
+ imgLoader.getSetupImgLoader( setupId ).getImage( timepointId, 0 ) ); // TODO
final short[] blockData = new short[ paddedBlockSize[ 0 ] * paddedBlockSize[ 1 ] * paddedBlockSize[ 2 ] ];
int nnn = 0;
for ( final int[] cellPos : requiredBlocks.cellPositions )
@@ -193,7 +194,7 @@ public class RenderSlice
///////////////////
- final CLImage2d< ByteBuffer > renderTarget = ( CLImage2d< ByteBuffer > ) cl.createImage2d(
+ final CLImage2d< ByteBuffer > renderTarget = cl.createImage2d(
Buffers.newDirectByteBuffer( width * height ),
width,
height,
@@ -315,7 +316,8 @@ public class RenderSlice
private RequiredBlocks getRequiredBlocks( final AffineTransform3D sourceToScreen, final int w, final int h, final int dd, final ViewId view )
{
- final CachedCellImg< ?, ? > cellImg = (bdv.img.cache.CachedCellImg< ?, ? > ) imgLoader.getImage( view, 0 );
+ final RandomAccessible< UnsignedShortType > img = imgLoader.getSetupImgLoader( view.getViewSetupId() ).getImage( view.getTimePointId(), 0 );
+ final CachedCellImg< ?, ? > cellImg = (bdv.img.cache.CachedCellImg< ?, ? > ) img;
final long[] imgDimensions = new long[ 3 ];
cellImg.dimensions( imgDimensions );
return FindRequiredBlocks.getRequiredBlocks( sourceToScreen, w, h, dd, blockSize, imgDimensions );