Skip to content

Commit f65f638

Browse files
committed
Forward tilesize from the Pyramid constructor
1 parent 5c906aa commit f65f638

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/PyramidScheme.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,10 @@ end
261261

262262

263263
"""
264-
compute_nlevels(data, tilesize=1024)
264+
compute_nlevels(data, tilesize=256)
265265
266266
Compute the number of levels for the aggregation based on the size of `data`.
267+
`tilesize` gives the maximal size of the coarsest level in all directions.
267268
"""
268269
compute_nlevels(data, tilesize=256) = max(0,ceil(Int,log2(maximum(size(data))/tilesize)))
269270

@@ -369,13 +370,16 @@ function output_zarr(n, input_axes, t, path)
369370
end
370371

371372
"""
372-
getpyramids(ras)
373+
getpyramids(reducefunc, ras; recursive=true, tilesize=256)
373374
Compute the data of the pyramids of a given data cube `ras`.
375+
It uses the reduction function `reducefunc` to aggregate the data.
376+
If `recursive` is true the reduction function is applied on the already reduced layers.
377+
`tilesize` indicates the maximal size of coarsest layer.
374378
This returns the data of the pyramids and the dimension values of the aggregated axes.
375379
"""
376-
function getpyramids(reducefunc, ras;recursive=true)
380+
function getpyramids(reducefunc, ras;recursive=true, tilesize=256)
377381
input_axes = DD.dims(ras)
378-
n_level = compute_nlevels(ras)
382+
n_level = compute_nlevels(ras, tilesize)
379383
if iszero(n_level)
380384
@info "Array is smaller than the tilesize no pyramids are computed"
381385
[ras], [dims(ras)]

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ end
4242
@test size(subpyramid) == (10,10)
4343
@test parent(subpyramid) == data[1:10,1:10]
4444
fig, axis, h = plot(pyramid)
45+
46+
@testset "Tilesize" begin
47+
pyrtile = PS.Pyramid(dd, tilesize=50)
48+
@test maximum(size(pyrtile.levels[end])) < 50
49+
end
4550
end
4651

4752
@testitem "Pyramid building RGB eltype" begin

0 commit comments

Comments
 (0)