Skip to content

Conversation

@rijobro
Copy link
Contributor

@rijobro rijobro commented Apr 12, 2022

Requires this PR.

Description

Convert between dictionary data and MetaTensor. Will be useful for maintaining backwards compatibility. Not a breaking change, so can go into dev.

Status

Ready/Work in progress/Hold

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • New tests added to cover the changes.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@rijobro rijobro requested review from Nic-Ma and wyli April 12, 2022 15:13
@rijobro
Copy link
Contributor Author

rijobro commented Apr 12, 2022

The diff will decrease once the meta tensor PR has been merged. The only new functionality here should be in monai/transforms/meta_utility/dictionary.py.

@rijobro rijobro force-pushed the MetaTensor_transforms branch from f5491b8 to deb7951 Compare April 12, 2022 20:37
@rijobro rijobro closed this Apr 12, 2022
@rijobro rijobro force-pushed the MetaTensor_transforms branch from deb7951 to 1880d38 Compare April 12, 2022 20:42
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro reopened this Apr 12, 2022
rijobro added 2 commits April 13, 2022 14:23
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro
Copy link
Contributor Author

rijobro commented Apr 13, 2022

@wyli @Nic-Ma do you think you could have a look at this one. The tests seem to be good, so would like to merge. Going into dev as it's a non-breaking change.

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.

thanks, I think these transforms are useful during the migration of meta_dict -> metatensor, but eventually we don't need these, so I'm fine with or without this PR in dev, any ideas @Nic-Ma @ericspod ?

@rijobro
Copy link
Contributor Author

rijobro commented Apr 13, 2022

In our codebase you're right that these would be temporary, but if a user has custom transforms, this would be useful.

Compose([
    LoadImaged(),  # will use MetaTensor
    CustomTransformd(),  # expects dict
    OtherMonaiTransformd(),  # will use MetaTensor
])

would become:

Compose([
    LoadImaged(),  # will use MetaTensor
    FromMetaTensord(),
    CustomTransformd(),  # expects dict
    ToMetaTensord(),
    OtherMonaiTransformd(),  # will use MetaTensor
])

@rijobro rijobro mentioned this pull request Apr 13, 2022
4 tasks
@ericspod
Copy link
Member

These will be needed in the long run like @rijobro suggests.

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.

Thanks, it looks good to me.

@rijobro rijobro enabled auto-merge (squash) April 13, 2022 19:47
@Nic-Ma Nic-Ma disabled auto-merge April 14, 2022 04:15
rijobro added 2 commits April 14, 2022 09:58
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro
Copy link
Contributor Author

rijobro commented Apr 14, 2022

/build

@rijobro
Copy link
Contributor Author

rijobro commented Apr 14, 2022

@wyli , can you run blossom on this please?

@rijobro rijobro enabled auto-merge (squash) April 14, 2022 10:57
@wyli
Copy link
Contributor

wyli commented Apr 14, 2022

@wyli , can you run blossom on this please?

looks good, I'll merge this one soon.

@wyli
Copy link
Contributor

wyli commented Apr 14, 2022

/build

@rijobro rijobro merged commit 443fc0c into Project-MONAI:dev Apr 14, 2022
wyli added a commit that referenced this pull request Apr 14, 2022
* update citation (#4133)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* `ToMetaTensor` and `FromMetaTensor` transforms (#4115)

to and from meta

Co-authored-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro deleted the MetaTensor_transforms branch April 14, 2022 15:27
Can-Zhao added a commit to Can-Zhao/MONAI that referenced this pull request May 10, 2022
Add padding to filter to ensure same size after anti-aliasing

Use replicate padding insteadof zero padding to avoid artifacts for non-zero boundary

Reuse GaussianSmooth

4073 Enhance DynUNet doc-strings (Project-MONAI#4102)

* Fix doc strings error

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* remove duplicate places

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

4105 drops pt16 support (Project-MONAI#4106)

* update sys req

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* temp test

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update code for torch>=1.7

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* temp tests

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* fixes tests

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* autofix

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* fixes import

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* clear cache

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update based on comments

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* remove temp cmd

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

Make `pixelshuffle` scriptable (Project-MONAI#4109)

* Update the existing functionality to comply with the `torchscript.jit.script` function.

Signed-off-by: Ramon Emiliani <ramon@afxmedical.com>

meta tensor (Project-MONAI#4077)

* meta tensor

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>

4084 Add kwargs for `Tensor.to()` in engines (Project-MONAI#4112)

* [DLMED] add kwargs for to() API

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] fix typo

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix flake8

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

fixes pytorch version tests (Project-MONAI#4127)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

update meta tensor api (Project-MONAI#4131)

* update meta tensor api

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update based on comments

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

runtests.sh isort (Project-MONAI#4134)

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>

update citation (Project-MONAI#4133)

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

`ToMetaTensor` and `FromMetaTensor` transforms (Project-MONAI#4115)

to and from meta

no skip if before pytorch 1.7 (Project-MONAI#4139)

* no skip if before pytorch 1.7

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>

* fix

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>

* fix

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>

[DLMED] fix file name in meta (Project-MONAI#4145)

Signed-off-by: Nic Ma <nma@nvidia.com>

4116 Add support for advanced args of AMP (Project-MONAI#4132)

* [DLMED] fix typo in bundle scripts

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add support for AMP args

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] fix flake8

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>

New wsireader (Project-MONAI#4147)

`MetaTensor`: collate; decollate; dataset; dataloader; out=; indexing and iterating across batches (Project-MONAI#4137)

`MetaTensor`: collate; decollate; dataset; dataloader; out=; indexing and iterating across batches (Project-MONAI#4137)
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.

4 participants