Skip to content

Commit f0caad7

Browse files
authored
fix buffer_bbox offset (#1209)
* fix buffer_bbox offset * Add assertion to check means after upsampling * formatting * add changelog entry
1 parent 8db3228 commit f0caad7

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
3535

3636
### Fixed
3737
- Fixed unpickling of the SSL_Context to allow for a second or third pickling. [#1223](https://github.com/scalableminds/webknossos-libs/pull/1223)
38+
- Fixed offset error in upsample_cube job [#1209](https://github.com/scalableminds/webknossos-libs/pull/1209)
3839

3940

4041

webknossos/tests/dataset/test_upsampling.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def test_upsampling(tmp_path: Path) -> None:
4545
args=None,
4646
)
4747

48+
assert layer.get_mag("2").read().mean() == layer.get_mag("1").read().mean()
49+
4850

4951
def test_upsample_cube() -> None:
5052
buffer = np.zeros(BUFFER_SHAPE, dtype=np.uint8)

webknossos/webknossos/dataset/_upsampling_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def upsample_cube_job(
7474
data_cube = upsample_cube(cube_buffer, inverse_factors)
7575

7676
buffer_bbox = target_view.bounding_box.with_topleft_xyz(
77-
target_offset
77+
target_offset * inverse_factors
7878
).with_size_xyz(data_cube.shape)
7979
data_cube = buffer_bbox.xyz_array_to_bbox_shape(data_cube)
8080
file_buffer[(channel_index,) + buffer_bbox.to_slices_xyz()] = (

0 commit comments

Comments
 (0)