Skip to content
Snippets Groups Projects
Commit 9b4da64f authored by Stephan Saalfeld's avatar Stephan Saalfeld
Browse files

Catmaid implements mipmapTransforms

parent c1a4ffc2
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ import net.imglib2.RandomAccessibleInterval; ...@@ -7,6 +7,7 @@ import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.NativeImg; import net.imglib2.img.NativeImg;
import net.imglib2.img.basictypeaccess.volatiles.array.VolatileIntArray; import net.imglib2.img.basictypeaccess.volatiles.array.VolatileIntArray;
import net.imglib2.img.cell.CellImg; import net.imglib2.img.cell.CellImg;
import net.imglib2.realtransform.AffineTransform3D;
import net.imglib2.type.NativeType; import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.ARGBType; import net.imglib2.type.numeric.ARGBType;
import net.imglib2.type.volatiles.VolatileARGBType; import net.imglib2.type.volatiles.VolatileARGBType;
...@@ -45,8 +46,10 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat ...@@ -45,8 +46,10 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat
private long[][] imageDimensions; private long[][] imageDimensions;
private int[][] blockDimensions; private int[][] blockDimensions;
private AffineTransform3D[] mipmapTransforms;
protected VolatileGlobalCellCache< VolatileIntArray > cache; private VolatileGlobalCellCache< VolatileIntArray > cache;
public CatmaidImageLoader() public CatmaidImageLoader()
{ {
...@@ -77,11 +80,19 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat ...@@ -77,11 +80,19 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat
mipmapResolutions = new double[ numScales ][]; mipmapResolutions = new double[ numScales ][];
imageDimensions = new long[ numScales ][]; imageDimensions = new long[ numScales ][];
blockDimensions = new int[ numScales ][]; blockDimensions = new int[ numScales ][];
mipmapTransforms = new AffineTransform3D[ numScales ];
for ( int l = 0; l < numScales; ++l ) for ( int l = 0; l < numScales; ++l )
{ {
mipmapResolutions[ l ] = new double[] { 1 << l, 1 << l, 1 }; mipmapResolutions[ l ] = new double[] { 1 << l, 1 << l, 1 };
imageDimensions[ l ] = new long[] { width >> l, height >> l, depth }; imageDimensions[ l ] = new long[] { width >> l, height >> l, depth };
blockDimensions[ l ] = new int[] { tileWidth, tileHeight, 1 }; 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 }; final int[] maxLevels = new int[] { numScales - 1 };
...@@ -150,4 +161,10 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat ...@@ -150,4 +161,10 @@ public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, Volat
{ {
return cache; return cache;
} }
@Override
public AffineTransform3D[] getMipmapTransforms( int setup )
{
return mipmapTransforms;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment