Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix RandomWeightedCrop for Integer Weightmap Handling#8097

Merged
KumoLiu merged 6 commits into
Project-MONAI:devfrom
Han123su:Fix-issue-7949
Sep 20, 2024
Merged

Fix RandomWeightedCrop for Integer Weightmap Handling#8097
KumoLiu merged 6 commits into
Project-MONAI:devfrom
Han123su:Fix-issue-7949

Conversation

@Han123su

@Han123su Han123su commented Sep 19, 2024

Copy link
Copy Markdown
Contributor

Fixes #7949 .

Description

Regardless of the type of weight map, random numbers should be kept as floating-point numbers for calculating the sampling location. However, searchsorted requires matching data structures. I have modified convert_to_dst_type to control converting only the data structure while maintaining the original data type. Additionally, I have included an example with integer weight maps in the test file.

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.

Comment thread monai/transforms/utils.py Outdated
Signed-off-by: Han123su <[email protected]>
Signed-off-by: Han123su <[email protected]>

@ericspod ericspod left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is fine as it is now, thanks.

@ericspod ericspod requested a review from KumoLiu September 19, 2024 21:33

@KumoLiu KumoLiu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix, LGTM.

@KumoLiu

KumoLiu commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

/build

2 similar comments
@KumoLiu

KumoLiu commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

/build

@KumoLiu

KumoLiu commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

/build

@KumoLiu

KumoLiu commented Sep 20, 2024

Copy link
Copy Markdown
Contributor

/build

@KumoLiu KumoLiu merged commit fa1c1af into Project-MONAI:dev Sep 20, 2024
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.

RandomWeightedCrop doesn't randomly generate crops for a weightmap of integers

3 participants