Skip to content

Conversation

@Nic-Ma
Copy link
Contributor

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

Fixes #3234 .

Description

This PR added dtype arg to ScaleIntensityRange transforms, same as other intensity scale transforms which may change data type during computation, especially for int or long input.

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 1, 2021

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Nov 1, 2021

/build

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma Nic-Ma requested a review from yiheng-wang-nv November 2, 2021 04:16
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Nov 2, 2021

I also fixed the data in / out type issue in histogram_normalize transform.

Thanks.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Nov 2, 2021

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Nov 2, 2021

/build

@myron
Copy link
Collaborator

myron commented Nov 2, 2021

Thanks for this!

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Nov 2, 2021

/integration-test

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.

I feel in many cases now it's good to use the CastToType to indicate type casting, perhaps this needs more discussion? dtype parameter may be useful to control the memory footprint or float precision of the transform computations.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Nov 2, 2021

I feel in many cases now it's good to use the CastToType to indicate type casting, perhaps this needs more discussion?

Hi @wyli ,

I agree with you, we should use CastToType for most cases. Maybe this PR changed many things that confused you.
Actually, here I didn't add dtype to more transforms, just added to ScaleIntensityRange, because data type may be changed during scaling, just followed the same pattern as ScaleIntensity transform.
All the other changes are to add support for dtype=None.
Could you please help take a look again?

Thanks.

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, we agreed to have this based on the discussions.

@wyli wyli merged commit 223476b into Project-MONAI:dev Nov 2, 2021
@wyli wyli mentioned this pull request Nov 2, 2021
7 tasks
@Nic-Ma Nic-Ma mentioned this pull request Nov 2, 2021
7 tasks
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.

Add dtype arg to ScaleIntensityRange transform for output

4 participants