diff --git a/src/main/java/net/preibisch/mvrecon/process/downsampling/DownsampleTools.java b/src/main/java/net/preibisch/mvrecon/process/downsampling/DownsampleTools.java index 84d00f18..f079d4e7 100644 --- a/src/main/java/net/preibisch/mvrecon/process/downsampling/DownsampleTools.java +++ b/src/main/java/net/preibisch/mvrecon/process/downsampling/DownsampleTools.java @@ -33,6 +33,7 @@ import mpicbg.spim.data.sequence.VoxelDimensions; import net.imglib2.RandomAccessibleInterval; import net.imglib2.realtransform.AffineTransform3D; +import net.imglib2.util.LinAlgHelpers; import net.imglib2.type.numeric.real.FloatType; import net.imglib2.util.Pair; import net.imglib2.util.Util; @@ -108,7 +109,7 @@ public static Pair< RandomAccessibleInterval, AffineTransform3D > openDownsample final double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( viewId.getViewSetupId() ).getMipmapResolutions(); // best possible step size in the output image when using original data - final float[] sizeMaxResolution = getStepSize( m ); + final double[] sizeMaxResolution = getStepSize( m ); //System.out.println( Util.printCoordinates( sizeMaxResolution ) ); float acceptedError = 0.02f; @@ -133,7 +134,7 @@ public static Pair< RandomAccessibleInterval, AffineTransform3D > openDownsample AffineTransform3D model = m.copy(); model.concatenate( s ); - final float[] size = getStepSize( model ); + final double[] size = getStepSize( model ); boolean isValid = true; @@ -186,29 +187,16 @@ public static Pair< RandomAccessibleInterval, AffineTransform3D > openDownsample } } - private static float[] getStepSize( final AffineTransform3D model ) + private static double[] getStepSize( final AffineTransform3D model ) { - final float[] size = new float[ 3 ]; - + final double[] size = new double[ 3 ]; final double[] tmp = new double[ 3 ]; - final double[] o0 = new double[ 3 ]; - - model.apply( tmp, o0 ); - for ( int d = 0; d < 3; ++d ) { - final double[] o1 = new double[ 3 ]; - - for ( int i = 0; i < tmp.length; ++i ) - tmp[ i ] = 0; - - tmp[ d ] = 1; - - model.apply( tmp, o1 ); - - size[ d ] = (float)length( o1, o0 ); + for ( int i = 0; i < 3; ++i ) + tmp[ i ] = model.get( i, d ); + size[ d ] = LinAlgHelpers.length( tmp ); } - return size; }