Skip to content

Commit e25ef7b

Browse files
committed
feat: change default block sizes in builder
Signed-off-by: Caleb Hulbert <cmhulbert@gmail.com>
1 parent 0984e4b commit e25ef7b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/main/java/org/janelia/saalfeldlab/n5/DatasetAttributes.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,18 +351,23 @@ public static Builder builder(final DatasetAttributes attributes) {
351351
return new Builder(attributes);
352352
}
353353

354+
private static final int[] DEFAULT_1D_BLOCK_SIZE = new int[]{65536};
355+
private static final int[] DEFAULT_2D_BLOCK_SIZE = new int[]{512,512};
356+
private static final int[] DEFAULT_3D_BLOCK_SIZE = new int[]{128,128,128};
357+
private static final int DEFAULT_ND_DIM_LEN = 64;
358+
354359
protected static int[] defaultBlockSize(final long[] dimensions) {
355360

356361
final int[] blockSize;
357362
if (dimensions.length == 1)
358-
blockSize = new int[]{1024};
363+
blockSize = DEFAULT_1D_BLOCK_SIZE.clone();
359364
else if (dimensions.length == 2)
360-
blockSize = new int[]{256, 256};
365+
blockSize = DEFAULT_2D_BLOCK_SIZE.clone();
361366
else if (dimensions.length == 3)
362-
blockSize = new int[]{128, 128, 128};
367+
blockSize = DEFAULT_3D_BLOCK_SIZE.clone();
363368
else {
364369
blockSize = new int[dimensions.length];
365-
Arrays.fill(blockSize, 64);
370+
Arrays.fill(blockSize, DEFAULT_ND_DIM_LEN);
366371
}
367372
for (int i = 0; i < blockSize.length; i++)
368373
blockSize[i] = (int)Math.min(blockSize[i], dimensions[i]);

0 commit comments

Comments
 (0)