Skip to content

Commit

Permalink
fix buffer_bbox offset (#1209)
Browse files Browse the repository at this point in the history
* fix buffer_bbox offset

* Add assertion to check means after upsampling

* formatting

* add changelog entry
  • Loading branch information
MatthisCl authored Dec 6, 2024
1 parent 8db3228 commit f0caad7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section

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



Expand Down
2 changes: 2 additions & 0 deletions webknossos/tests/dataset/test_upsampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def test_upsampling(tmp_path: Path) -> None:
args=None,
)

assert layer.get_mag("2").read().mean() == layer.get_mag("1").read().mean()


def test_upsample_cube() -> None:
buffer = np.zeros(BUFFER_SHAPE, dtype=np.uint8)
Expand Down
2 changes: 1 addition & 1 deletion webknossos/webknossos/dataset/_upsampling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def upsample_cube_job(
data_cube = upsample_cube(cube_buffer, inverse_factors)

buffer_bbox = target_view.bounding_box.with_topleft_xyz(
target_offset
target_offset * inverse_factors
).with_size_xyz(data_cube.shape)
data_cube = buffer_bbox.xyz_array_to_bbox_shape(data_cube)
file_buffer[(channel_index,) + buffer_bbox.to_slices_xyz()] = (
Expand Down

0 comments on commit f0caad7

Please sign in to comment.