Skip to content
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

6007 reverse_indexing for PILReader #6008

Merged
merged 3 commits into from
Feb 16, 2023
Merged

Conversation

wyli
Copy link
Member

@wyli wyli commented Feb 15, 2023

Fixes #6007

Description

  • reverse_indexing = False:
    to support consistency with PIL/torchvision
img = LoadImage(image_only=True, ensure_channel_first=True, reverse_indexing=False)("MONAI-logo_color.png")  # PILReader
torchvision.utils.save_image(img, "MONAI-logo_color_torchvision.png", normalize=True)
  • reverse_indexing = True:
    to support consistency with other backends in monai
img = LoadImage(image_only=True, ensure_channel_first=True, reader="PILReader", reverse_indexing=True)(filename)  # PIL backend
img_1 = LoadImage(image_only=True, ensure_channel_first=True, reader="ITKReader")(filename)  # itk backend
np.testing.assert_allclose(img, img_1)  # true

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.

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

@holgerroth holgerroth left a comment

Choose a reason for hiding this comment

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

That's useful. Thanks!

@wyli
Copy link
Member Author

wyli commented Feb 15, 2023

/build

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
@wyli
Copy link
Member Author

wyli commented Feb 16, 2023

/build

@wyli wyli enabled auto-merge (squash) February 16, 2023 07:45
@wyli
Copy link
Member Author

wyli commented Feb 16, 2023

/build

@wyli wyli merged commit 94e9e17 into Project-MONAI:dev Feb 16, 2023
@wyli wyli deleted the 6007-pil-reader branch February 16, 2023 08:45
wyli added a commit to Project-MONAI/tutorials that referenced this pull request Feb 16, 2023
follow-up of Project-MONAI/MONAI#6008, adding
more examples

### Checks
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Avoid including large-size files in the PR.
- [x] Clean up long text outputs from code cells in the notebook.
- [x] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [x] Ensure (1) hyperlinks and markdown anchors are working (2) use
relative paths for tutorial repo files (3) put figure and graphs in the
`./figure` folder
- [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>`

---------

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
boneseva pushed a commit to boneseva/MONAI-tutorials that referenced this pull request Apr 21, 2024
follow-up of Project-MONAI/MONAI#6008, adding
more examples

### Checks
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Avoid including large-size files in the PR.
- [x] Clean up long text outputs from code cells in the notebook.
- [x] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [x] Ensure (1) hyperlinks and markdown anchors are working (2) use
relative paths for tutorial repo files (3) put figure and graphs in the
`./figure` folder
- [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>`

---------

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

option for LoadImage to be compatible with torchvision save_image
3 participants