Skip to content

3387 Fix 0.0 or None value in AsDiscrete#3393

Merged
wyli merged 7 commits into
Project-MONAI:devfrom
Nic-Ma:3387-fix-threshold-none
Nov 24, 2021
Merged

3387 Fix 0.0 or None value in AsDiscrete#3393
wyli merged 7 commits into
Project-MONAI:devfrom
Nic-Ma:3387-fix-threshold-none

Conversation

@Nic-Ma

@Nic-Ma Nic-Ma commented Nov 24, 2021

Copy link
Copy Markdown
Contributor

Fixes #3387 .

Description

This PR fixed the None or 0.0 value of to_onehot and threshold at runtime.

Status

Ready

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.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@Nic-Ma

Nic-Ma commented Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

Hi @yiheng-wang-nv ,

Please note that, we don't support the case that: set the to_onehot or threshold not to None at init(), and set the to_onehot or threshold to None at call() to disable the ToOneHot or Threshold actions.
It can only support to enable the action at runtime.
I think it's same as all the align_corners arg of call() in the spatial transforms:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/transforms/spatial/array.py#L552

Thanks.

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma Nic-Ma changed the title [WIP] 3387 Fix 0.0 or None value in AsDiscrete 3387 Fix 0.0 or None value in AsDiscrete Nov 24, 2021
@Nic-Ma Nic-Ma marked this pull request as ready for review November 24, 2021 07:07
@Nic-Ma

Nic-Ma commented Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

/build

@yiheng-wang-nv yiheng-wang-nv 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 @Nic-Ma

Comment thread tests/test_as_discrete.py
@wyli wyli merged commit 721f6f7 into Project-MONAI:dev Nov 24, 2021
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.

AsDiscreted bug when threshold=0.0

3 participants