Skip to content

Conversation

@atbenmurray
Copy link
Contributor

@atbenmurray atbenmurray commented Oct 30, 2022

Signed-off-by: Ben Murray [email protected]

Description

This is part of the work towards #4855. It adds:

  • a lazy apply method
  • A transform-like wrapper for apply called Apply
    - MetaMatrix and related functionality to represent abstracted grid and matrix transforms with metadata
  • A universal resample function that can be used to apply grid / matrix transforms
    - Functional spatial and croppad implementations that define but don't apply transforms

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@atbenmurray atbenmurray mentioned this pull request Oct 30, 2022
7 tasks
@atbenmurray atbenmurray mentioned this pull request Oct 30, 2022
33 tasks
@wyli
Copy link
Contributor

wyli commented Nov 1, 2022

/black
thanks, I think this PR introduces quite a few APIs at a time and some of them (MatrixFactory/MetaMatrix) need more discussions... is it possible to make it smaller, for example, only including croppad, apply, and an example of SpatialCrop transform, so that we can create a working example of lazy cropping, then finalise the functional and apply API? cc @ericspod @rijobro @Nic-Ma

@atbenmurray
Copy link
Contributor Author

atbenmurray commented Nov 1, 2022

thanks, I think this PR introduces quite a few APIs at a time and some of them (MatrixFactory/MetaMatrix) need more discussions... is it possible to make it smaller, for example, only including croppad, apply, and an example of SpatialCrop transform, so that we can create a working example of lazy cropping, then finalise the functional and apply API? cc @ericspod @rijobro @Nic-Ma

The problem is that MatrixFactory/MetaMatrix are the classes by which a lot of the internal stuff for lazy resampling is done. They could certainly change before the PR goes in, but that would necessitate some plumbing to happen and I don't know if I'll have time before I am on holiday. The key thing here at the moment is that this PR doesn't change any existing behaviour so if we want to refactor we certainly can.

What they do:

  • MatrixFactory is an attempt to wrap up the various affine operations in a way that it can be simply constructed by either defining dimensions, device etc or by passing a tensor so that is determined automatically, and used in an OO way.
  • MetaTensor is the transformation + metadata that accompanies it. It contains either a Matrix or a Grid object, depending

In theory, one or both could go, but it might make everything somewhat verbose. Neither are supposed to be user-facing

Might be a good topic for tomorrow, but I am trying to get the PRs as populated as possible for tonight.

@atbenmurray atbenmurray self-assigned this Nov 2, 2022
atbenmurray added a commit that referenced this pull request Nov 2, 2022
…nd dictionary transforms to operate while waiting for PR #5436

Signed-off-by: Ben Murray <[email protected]>
atbenmurray added a commit that referenced this pull request Nov 2, 2022
…al, array and dictionary transforms to operate while waiting for PR #5436

Signed-off-by: Ben Murray <[email protected]>
atbenmurray added a commit that referenced this pull request Nov 2, 2022
…al, array and dictionary transforms to operate while waiting for PR #5436

Signed-off-by: Ben Murray <[email protected]>
atbenmurray added a commit that referenced this pull request Nov 2, 2022
monai-bot and others added 5 commits November 23, 2022 09:51
  - `_pending_operations` defaults to `MetaObj.get_default_applied_operations()`
  - removes the unused `Apply` class
  - fixes unit tests, style checks
  - torch.pi doesn't exist before torch 1.10

Signed-off-by: Wenqi Li <[email protected]>
wyli added 3 commits November 23, 2022 11:10
Signed-off-by: Wenqi Li <[email protected]>
Signed-off-by: Wenqi Li <[email protected]>
Signed-off-by: Wenqi Li <[email protected]>
@wyli wyli marked this pull request as ready for review November 23, 2022 13:10
Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atbenmurray please make more changes if needed and let me know when you think it's ready.. cc @Nic-Ma this mainly introduces necessary APIs monai.transforms.lazy.*

@wyli
Copy link
Contributor

wyli commented Nov 24, 2022

/build

@wyli wyli merged commit 2c7ba9e into dev Nov 25, 2022
@wyli wyli deleted the lr_apply_2 branch November 25, 2022 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants