Commit 76974d7f authored by Constantin Pape's avatar Constantin Pape

Fix issue with effective pixel size in downscale_multiset

parent b466a16f
......@@ -164,7 +164,6 @@ def _downscale_multiset_block(blocking, block_id, ds_in, ds_out,
blocks_prev = [blocking_prev.getBlock(bid) for bid in block_ids_prev]
multisets = [ds_in.read_chunk(chunk_id) for chunk_id in chunk_ids_prev]
# TODO can paintera deal with this ?
if all(mset is None for mset in multisets):
fu.log_block_success(block_id)
return
......@@ -225,7 +224,10 @@ def downscale_multiset(job_id, config_path):
blocking_prev = nt.blocking([0, 0, 0], prev_shape, block_shape)
effective_scale_factor = config['effective_scale_factor']
effective_pixel_size = int(np.prod(effective_scale_factor))
# we need the effective pixel size of the previous scale level here,
# which we get by dividing the current effective pixel size by the product of the
# scale factor
effective_pixel_size = int(np.prod(effective_scale_factor) / np.prod(scale_factor))
# submit blocks
with vu.file_reader(input_path, 'r') as f_in, vu.file_reader(output_path) as f_out:
......
......@@ -84,6 +84,11 @@ class TestLabelMultisets(BaseTest):
# 3.) check pixel-wise agreement
self.check_pixels(res, exp)
def check_empty(self, res, shape):
res = deserialize_multiset(res, shape)
self.assertEqual(res.n_entries, 1)
self.assertTrue(np.array_equal(res.ids, np.array([0], dtype='uint64')))
def test_label_multisets(self):
from cluster_tools.label_multisets import LabelMultisetWorkflow
task = LabelMultisetWorkflow
......@@ -145,9 +150,13 @@ class TestLabelMultisets(BaseTest):
out_exp = ds_exp.read_chunk(chunk_id)
print("Checking chunk:", chunk_id)
if out is None:
self.assertTrue(out_exp is None)
continue
self.check_chunk(out, out_exp, chunk_shape)
# NOTE paintera-conversion currently is writing out empty chunks.
# this might change in the future and then we can just check that `out_exp is None`
# For now, we have to check that the chunk is empty
# self.assertTrue(out_exp is None)
self.check_empty(out_exp, chunk_shape)
else:
self.check_chunk(out, out_exp, chunk_shape)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment