diff --git a/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java b/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java index f7b839f0e384667fa62859ae40f160e3d3ccde28..5f56ac92dbcb91544be242dd16dad7a74bce3c77 100644 --- a/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java +++ b/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java @@ -7,6 +7,7 @@ import net.imglib2.RandomAccessibleInterval; import net.imglib2.img.NativeImg; import net.imglib2.img.basictypeaccess.volatiles.array.VolatileIntArray; import net.imglib2.img.cell.CellImg; +import net.imglib2.realtransform.AffineTransform3D; import net.imglib2.type.NativeType; import net.imglib2.type.numeric.ARGBType; import net.imglib2.type.volatiles.VolatileARGBType; @@ -45,8 +46,10 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat private long[][] imageDimensions; private int[][] blockDimensions; + + private AffineTransform3D[] mipmapTransforms; - protected VolatileGlobalCellCache< VolatileIntArray > cache; + private VolatileGlobalCellCache< VolatileIntArray > cache; public CatmaidImageLoader() { @@ -77,11 +80,19 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat mipmapResolutions = new double[ numScales ][]; imageDimensions = new long[ numScales ][]; blockDimensions = new int[ numScales ][]; + mipmapTransforms = new AffineTransform3D[ numScales ]; for ( int l = 0; l < numScales; ++l ) { mipmapResolutions[ l ] = new double[] { 1 << l, 1 << l, 1 }; imageDimensions[ l ] = new long[] { width >> l, height >> l, depth }; blockDimensions[ l ] = new int[] { tileWidth, tileHeight, 1 }; + + final AffineTransform3D mipmapTransform = new AffineTransform3D(); + mipmapTransform.set( mipmapResolutions[ l ][ 0 ], 0, 0 ); + mipmapTransform.set( mipmapResolutions[ l ][ 1 ], 1, 1 ); + mipmapTransform.set( 0.5 * ( mipmapResolutions[ l ][ 0 ] - 1 ), 0, 3 ); + mipmapTransform.set( 0.5 * ( mipmapResolutions[ l ][ 0 ] - 1 ), 1, 3 ); + mipmapTransforms[ l ] = mipmapTransform; } final int[] maxLevels = new int[] { numScales - 1 }; @@ -150,4 +161,10 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat { return cache; } + + @Override + public AffineTransform3D[] getMipmapTransforms( int setup ) + { + return mipmapTransforms; + } }