Skip to content

Commit 5677674

Browse files
fixed #69
contains several fixes actually
1 parent 69a9cb6 commit 5677674

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/main/java/net/preibisch/mvrecon/process/export/ExportN5Api.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,12 @@ else if ( storageType == StorageFormat.ZARR ) // OME-Zarr export
399399
final List<long[][]> grid = N5ApiTools.assembleJobs(
400400
null, // no need to go across ViewIds (for now)
401401
new long[] { mrInfo[ 0 ].dimensions[ 0 ], mrInfo[ 0 ].dimensions[ 1 ], mrInfo[ 0 ].dimensions[ 2 ] },
402+
blocksize(),
402403
new int[] {
403404
blocksize()[0] * computeBlocksizeFactor()[ 0 ],
404405
blocksize()[1] * computeBlocksizeFactor()[ 1 ],
405-
blocksize()[2] * computeBlocksizeFactor()[ 2 ] },
406-
blocksize() );
406+
blocksize()[2] * computeBlocksizeFactor()[ 2 ] }
407+
);
407408

408409
IOFunctions.println( "num blocks = " + Grid.create( bb.dimensionsAsLongArray(), blocksize() ).size() + ", size = " + bsX + "x" + bsY + "x" + bsZ );
409410
IOFunctions.println( "num compute blocks = " + grid.size() + ", size = " + bsX*bsFactorX + "x" + bsY*bsFactorY + "x" + bsZ*bsFactorZ );
@@ -495,7 +496,13 @@ else if ( storageType == StorageFormat.ZARR ) // OME-Zarr export
495496
for ( int level = 1; level < mrInfo.length; ++level )
496497
{
497498
final int s = level;
498-
final List<long[][]> allBlocks = N5ApiTools.assembleJobs( mrInfo[ level ] );
499+
final List<long[][]> allBlocks =
500+
N5ApiTools.assembleJobs(
501+
mrInfo[ level ],
502+
new int[] {
503+
blocksize()[0] * computeBlocksizeFactor()[ 0 ],
504+
blocksize()[1] * computeBlocksizeFactor()[ 1 ],
505+
blocksize()[2] * computeBlocksizeFactor()[ 2 ] });
499506

500507
IOFunctions.println( new Date( System.currentTimeMillis() ) + ": Downsampling: " + Util.printCoordinates( mrInfo[ level ].absoluteDownsampling ) + " with relative downsampling of " + Util.printCoordinates( mrInfo[ level ].relativeDownsampling ));
501508
IOFunctions.println( new Date( System.currentTimeMillis() ) + ": s" + level + " num blocks=" + allBlocks.size() );

src/main/java/net/preibisch/mvrecon/process/n5api/N5ApiTools.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.janelia.saalfeldlab.n5.Compression;
4343
import org.janelia.saalfeldlab.n5.DataType;
4444
import org.janelia.saalfeldlab.n5.DatasetAttributes;
45+
import org.janelia.saalfeldlab.n5.GzipCompression;
4546
import org.janelia.saalfeldlab.n5.N5Writer;
4647
import org.janelia.saalfeldlab.n5.RawCompression;
4748
import org.janelia.saalfeldlab.n5.imglib2.N5Utils;
@@ -352,23 +353,23 @@ public static MultiResolutionLevelInfo[] setupBdvDatasetsHDF5(
352353
subdivisions = ArrayImgs.ints( blocksizes, new long[] { 3, downsamplings.length } ); // blocksize
353354
resolutions = ArrayImgs.doubles( downsamples, new long[] { 3, downsamplings.length } ); // downsampling
354355
}
355-
356+
356357
driverVolumeWriter.createDataset(
357358
subdivisionsDatasets,
358359
subdivisions.dimensionsAsLongArray(),// new long[] { 3, 1 },
359-
new int[] { (int)subdivisions.dimension( 0 ), (int)subdivisions.dimension( 1 ) }, //new int[] { 3, 1 },
360+
Arrays.stream( subdivisions.dimensionsAsLongArray() ).mapToInt(i -> (int) i).toArray(),//new int[] { (int)subdivisions.dimension( 0 ), (int)subdivisions.dimension( 1 ) }, //new int[] { 3, 1 },
360361
DataType.INT32,
361362
new RawCompression() );
362363

363364
driverVolumeWriter.createDataset(
364365
resolutionsDatasets,
365366
resolutions.dimensionsAsLongArray(),// new long[] { 3, 1 },
366-
new int[] { (int)resolutions.dimension( 0 ), (int)resolutions.dimension( 1 ) },//new int[] { 3, 1 },
367+
Arrays.stream( resolutions.dimensionsAsLongArray() ).mapToInt(i -> (int) i).toArray(),//new int[] { (int)resolutions.dimension( 0 ), (int)resolutions.dimension( 1 ) },//new int[] { 3, 1 },
367368
DataType.FLOAT64,
368369
new RawCompression() );
369-
370-
N5Utils.saveBlock(subdivisions, driverVolumeWriter, "s" + String.format("%02d", viewId.getViewSetupId()) + "/subdivisions", new long[] {0,0,0} );
371-
N5Utils.saveBlock(resolutions, driverVolumeWriter, "s" + String.format("%02d", viewId.getViewSetupId()) + "/resolutions", new long[] {0,0,0} );
370+
371+
N5Utils.saveBlock(subdivisions, driverVolumeWriter, "s" + String.format("%02d", viewId.getViewSetupId()) + "/subdivisions", new long[] {0,0} );
372+
N5Utils.saveBlock(resolutions, driverVolumeWriter, "s" + String.format("%02d", viewId.getViewSetupId()) + "/resolutions", new long[] {0,0} );
372373
}
373374

374375
return mrInfo;

0 commit comments

Comments
 (0)