Skip to content

feat: Add transform method to Layer class (AI GENERATED) #1311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tobias314
Copy link
Contributor

Attention: AI generated PR (should be handled as experimental and with care)

This commit introduces a new transform method to the Layer class, allowing for spatial transformations of layer data.

The method takes an output layer, an inverse transformation function, and optional parameters for magnification, number of threads, output bounding box, and chunk shape.

Key features:

  • Supports arbitrary inverse transformations (e.g., affine, rotation, translation, scaling) via a callable.
  • Processes data in chunks to handle large datasets efficiently.
  • Utilizes multithreading for improved performance.
  • Handles out-of-bounds coordinates by clamping and uses nearest-neighbor interpolation for non-integer coordinates.

Unit tests have been added to webknossos/tests/dataset/test_layer.py to verify the functionality, covering:

  • Identity, translation, scaling, and affine transformations.
  • Different output bounding box configurations.
  • Various chunk shapes and numbers of threads.
  • Edge cases such as transformations mapping outside input bounds and small input layers.

Description:

  • abc

Issues:

  • fixes #...

Todos:

Make sure to delete unnecessary points or to check all before merging:

  • Updated Changelog
  • Updated Documentation
  • Added / Updated Tests
  • Considered adding this to the Examples

This commit introduces a new `transform` method to the `Layer` class,
allowing for spatial transformations of layer data.

The method takes an output layer, an inverse transformation function,
and optional parameters for magnification, number of threads, output
bounding box, and chunk shape.

Key features:
- Supports arbitrary inverse transformations (e.g., affine, rotation,
  translation, scaling) via a callable.
- Processes data in chunks to handle large datasets efficiently.
- Utilizes multithreading for improved performance.
- Handles out-of-bounds coordinates by clamping and uses nearest-neighbor
  interpolation for non-integer coordinates.

Unit tests have been added to `webknossos/tests/dataset/test_layer.py`
to verify the functionality, covering:
- Identity, translation, scaling, and affine transformations.
- Different output bounding box configurations.
- Various chunk shapes and numbers of threads.
- Edge cases such as transformations mapping outside input bounds and
  small input layers.
@Tobias314 Tobias314 changed the title feat: Add transform method to Layer class feat: Add transform method to Layer class (AI GENERATED) May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant