-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Geometric transforms proposal #7486
Comments
Over the past few weeks, we've had insightful discussions concerning 'geometric transforms'. I summarize the consensus into this new ticket, if all agree, I'm looking forward to getting started on the Transform API. This is not the end of our conversation. As we progress, we can continue to share our thoughts and optimize our approach, like deciding on the kinds of data types that we need to support. Your input is valued, and I am keen to learn from everyone. |
@KumoLiu Great! I've been working on a PR that at present has only the API changes, so we get a clear picture of the modifications to the API. I've also been thinking about the differences between "raster-space" and "world-space" transforms and how they relate to images and geometry respectively, as a way of solving @vikashg's rotate use-case. I'll do a brief presentation of that tomorrow if that's ok. |
I've added a design section to this item as per our discussion last friday |
Part of #7486 ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] 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. --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Part of Project-MONAI#7486 ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] 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. --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
We have added the "kind" property to MetaTensor now with a recent PR. The kinds that we have are "pixel" and "point" but to these we can add "signal" and "text" later for future use. I mention it here to just put it out there for us. |
Design
Design goals
Characteristics of geometry and pixel data
Pixel-space vs world-space
Stages of a mixed pixel / geometry pipeline
a. pixel data
b. geometry data
a. our transforms should always keep pixel and geometry data aligned, for any given sequence of spatial transforms applied to both
Spatial transform categories
Categories of spatial transform
flip
,zoom
, etc.resample
,spacing
, etc.rotate
, etc.A closer look at hybrid transforms
rotate
must perform slightly different operations on pixel and geometry datakeep_size
is false, the extents of pixel data bounds will changeTransform API
The transform API has the following layers
dictionary transform -> array transform -> functional transform
Dictionary transforms
Dictionary transforms specific to images can refer to geometry by name rather than requiring to pass tensors in directly
As such, there shouldn't need to be any changes to the API for dictionary transforms:
Array transforms
Array transforms specific to images need to be modified so that geometry data can be updated. This can be done via additional operation parameters that take a tensor or tuple of tensors:
Functional transforms
Functional transforms that are specific to image data first calculate the pixel-space and world-space transform components to be applied to the image data. They then call a function that applies the appropriate transform to geometry data.
Note: the geometry data should only need one operation for applying data to it, ideally we should not need to write *_image and *_point functions for each of the operations
Implementation
1. Integration of 'kind' Property to MetaTensor:
Propose to incorporate 'kind' property in MetaTensor. The property 'kind' will enable efficient identification and appropriate handling of different data types. The value of 'kind' can be conveniently retrieved using data.kind.
2. Data Input/Output Enhancements:
Introduce
LoadPoint
andLoadPointd
with propertiesrefer
andrefer_key
. These properties will ascertain if the loaded point corresponds to a certain coordinate system and subsequently facilitate retrieval of information such as affine information from the reference.Usage Examples:
LoadPointd(key="point", refer_key="image")
andLoadPointd(data=point, refer=image)
Subject for Discussion: What data formats should we aim to support?
3. Improvements to Transform API:
The core idea is to house the computational logic within the associated operator and register it to the transform. This modification will minimize changes to the transform API. To accommodate a new data type in MONAI, current user-facing API logic would remain unaltered. New operators will simply be added as required.
Example:
4. User Experience Enhancements:
The user experience can be improved by making the data operations more intuitive and user-friendly.
Code example:
The text was updated successfully, but these errors were encountered: