Skip to content

Conversation

@Nic-Ma
Copy link
Contributor

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

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
Copy link
Contributor Author

Nic-Ma commented Nov 24, 2021

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
Copy link
Contributor Author

Nic-Ma commented Nov 24, 2021

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Nov 24, 2021

/build

Copy link
Contributor

@yiheng-wang-nv yiheng-wang-nv left a comment

Choose a reason for hiding this comment

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

Thanks @Nic-Ma

@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