diff --git a/src/main/java/net/preibisch/bigstitcher/spark/SparkAffineFusion.java b/src/main/java/net/preibisch/bigstitcher/spark/SparkAffineFusion.java index d7008ec..df5bf24 100644 --- a/src/main/java/net/preibisch/bigstitcher/spark/SparkAffineFusion.java +++ b/src/main/java/net/preibisch/bigstitcher/spark/SparkAffineFusion.java @@ -273,6 +273,10 @@ else if ( outputPathURIString.toLowerCase().endsWith( ".h5" ) || outPathURI.toSt final DataType dataType = driverVolumeWriter.getAttribute( "/", "Bigstitcher-Spark/DataType", DataType.class ); + final long[] orig_bbMin = driverVolumeWriter.getAttribute( "/", "Bigstitcher-Spark/Boundingbox_min", long[].class ); + if ( !Double.isNaN( anisotropyFactor ) ) + orig_bbMin[ 2 ] = Math.round( Math.floor( orig_bbMin[ 2 ] * anisotropyFactor ) ); + System.out.println( "FusionFormat: " + fusionFormat ); System.out.println( "FusionType: " + fusionType ); System.out.println( "Input XML: " + xmlURI ); @@ -329,8 +333,8 @@ else if ( { System.out.println( "The number of channels and timepoint in XML does not match the number in the export dataset." - + "You have to specify which ViewIds/Channels/Illuminations/Tiles/Angles/Timepoints should be fused into" - + "a specific 3D volume in the fusion dataset:"); + + "You have to specify which ViewIds/Channels/Illuminations/Tiles/Angles/Timepoints should be fused into" + + "a specific 3D volume in the fusion dataset:"); viewIdsGlobal = AbstractSelectableViews.loadViewIds( dataGlobal, vi, angleIds, channelIds, illuminationIds, tileIds, timepointIds ); @@ -488,6 +492,13 @@ else if ( intensityN5PathURIString.toLowerCase().endsWith( ".h5" ) || intensityN dataLocal.getViewRegistrations().getViewRegistrations(), anisotropyFactor, Double.NaN ); + + final HashMap< ViewId, AffineTransform3D > orig_registrations = + TransformVirtual.adjustAllTransforms( + viewIds, + dataLocal.getViewRegistrations().getViewRegistrations(), + Double.NaN, + Double.NaN ); final Converter conv; final Type type; @@ -518,7 +529,7 @@ else if ( dataType == DataType.UINT16 ) // The min coordinates of the block that this job renders (in pixels) final int n = gridBlock[ 0 ].length; final long[] superBlockOffset = new long[ n ]; - Arrays.setAll( superBlockOffset, d -> gridBlock[ 0 ][ d ] + bbMin[ d ] ); + Arrays.setAll( superBlockOffset, d -> gridBlock[ 0 ][ d ] + orig_bbMin[ d ] ); // The size of the block that this job renders (in pixels) final long[] superBlockSize = gridBlock[ 1 ]; @@ -533,7 +544,7 @@ else if ( dataType == DataType.UINT16 ) Arrays.setAll( fusedBlockMax, d -> superBlockOffset[ d ] + superBlockSize[ d ] - 1 ); final List< ViewId > overlappingViews = - OverlappingViews.findOverlappingViews( dataLocal, viewIds, registrations, fusedBlock ); + OverlappingViews.findOverlappingViews( dataLocal, viewIds, orig_registrations, fusedBlock ); if ( overlappingViews.size() == 0 ) return gridBlock; @@ -808,4 +819,4 @@ public static void main(final String... args) throws SpimDataException { System.exit(new CommandLine(new SparkAffineFusion()).execute(args)); } -} +} \ No newline at end of file