make_bdv fails upon certain dataset size
jhennies opened this issue · comments
Hi @constantinpape,
I merged your master to my pybdv fork after #31 and I stumbled upon this:
from pybdv import make_bdv
import numpy as np
from shutil import rmtree
target_vol = np.ones((128, 128, 144), dtype='uint8')
tmp_bdv = './test.n5'
scale_factors = [[2, 2, 2], [2, 2, 2], [4, 4, 4]]
downscale_mode = 'interpolate'
n_threads = 1
try:
make_bdv(
data=target_vol,
output_path=tmp_bdv,
downscale_factors=scale_factors,
downscale_mode=downscale_mode,
n_threads=n_threads
)
except:
rmtree(tmp_bdv)
raise
rmtree(tmp_bdv)
results in
Downsample scale 1 / 3
8%|▊ | 1/12 [00:00<00:04, 2.51it/s]
Traceback (most recent call last):
File "/home/hennies/.PyCharmCE2018.1/config/scratches/scratch_5.py", line 19, in <module>
n_threads=n_threads
File "/g/schwab/hennies/src/github/pybdv/pybdv/converter.py", line 447, in make_bdv
overwrite=overwrite_data)
File "/g/schwab/hennies/src/github/pybdv/pybdv/converter.py", line 192, in make_scales
overwrite=overwrite)
File "/g/schwab/hennies/src/github/pybdv/pybdv/downsample.py", line 162, in downsample
sample_chunk(bb)
File "/g/schwab/hennies/src/github/pybdv/pybdv/downsample.py", line 154, in sample_chunk
ds_out[bb] = outp[bb_local]
File "/g/schwab/hennies/miniconda3/envs/mobie-env2/lib/python3.7/site-packages/z5py/dataset.py", line 388, in __setitem__
item_arr = rectify_shape(item_arr, shape)
File "/g/schwab/hennies/miniconda3/envs/mobie-env2/lib/python3.7/site-packages/z5py/shape_utils.py", line 94, in rectify_shape
raise ValueError(msg)
ValueError: could not broadcast input array from shape (64, 64, 64) into shape (64, 64, 8); complicated broacasting not supported
If I use e.g. np.ones((128, 128, 128), dtype='uint8')
it works just fine.
Any ideas? Can you reproduce this?
Yes, that was just an error I introduced in #31.
Fixed with the latest commit to master.
Thanks!