Skip to content

Commit

Permalink
Limit chunk size in z
Browse files Browse the repository at this point in the history
  • Loading branch information
minnerbe committed Oct 10, 2024
1 parent 26fe49a commit 4ee68d0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private void storeData(final Img<DoubleType> data, final Bounds stackBounds) {
// transpose data because images are F-order and python expects C-order
final RandomAccessibleInterval<DoubleType> transposedData = Views.permute(data, 0, 2);
final String dataset = Paths.get(parameters.renderWeb.project, parameters.stack).toString();
final int[] fullDimensions = Arrays.stream(transposedData.dimensionsAsLongArray()).mapToInt(i -> (int) i).toArray();
final int[] chunkSize = new int[] {parameters.nCellsX(), parameters.nCellsY(), Math.min(1000, (int) transposedData.dimension(2))};

final double[] min = new double[3];
min[0] = stackBounds.getMinX();
Expand All @@ -214,7 +214,7 @@ private void storeData(final Img<DoubleType> data, final Bounds stackBounds) {
max[2] = stackBounds.getMaxZ();

try (final N5Writer n5Writer = new N5ZarrWriter(parameters.outputPath)) {
N5Utils.save(transposedData, n5Writer, dataset, fullDimensions, new GzipCompression());
N5Utils.save(transposedData, n5Writer, dataset, chunkSize, new GzipCompression());

n5Writer.setAttribute(dataset, "StackBounds", Map.of("min", min, "max", max));
final Map<String, Double> runParameters = Map.of(
Expand Down

0 comments on commit 4ee68d0

Please sign in to comment.