Skip to content

3581 Enhance slice_channels utility function#3585

Merged
Nic-Ma merged 11 commits into
Project-MONAI:devfrom
Nic-Ma:3581-enhance-onehot
Jan 7, 2022
Merged

3581 Enhance slice_channels utility function#3585
Nic-Ma merged 11 commits into
Project-MONAI:devfrom
Nic-Ma:3581-enhance-onehot

Conversation

@Nic-Ma

@Nic-Ma Nic-Ma commented Jan 5, 2022

Copy link
Copy Markdown
Contributor

Fixes #3581 .

Description

This PR enhanced the slice_channels utility function to select channels on specified dim.

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

@Nic-Ma

Nic-Ma commented Jan 5, 2022

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Jan 5, 2022

Copy link
Copy Markdown
Contributor Author

/build

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma Nic-Ma force-pushed the 3581-enhance-onehot branch from ec468ce to a274e48 Compare January 5, 2022 16:18
@Nic-Ma

Nic-Ma commented Jan 5, 2022

Copy link
Copy Markdown
Contributor Author

/build

@Nic-Ma

Nic-Ma commented Jan 5, 2022

Copy link
Copy Markdown
Contributor Author

Hi @wyli @holgerroth ,

Do you think I also need to enhance the DiceLoss and AsDiscrete transform to support slice_channels in them?
Or just leave this logic to users to call slice_channels directly (current status of this PR)?
I prefer to not change loss and post transform so far.

Thanks in advance.

@Nic-Ma Nic-Ma requested review from ericspod, rijobro and wyli January 5, 2022 16:21
Comment thread monai/networks/utils.py Outdated
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma Nic-Ma requested a review from wyli January 5, 2022 23:19
@Nic-Ma

Nic-Ma commented Jan 5, 2022

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Jan 5, 2022

Copy link
Copy Markdown
Contributor Author

/build

Comment thread tests/test_sample_slices.py Outdated
Comment thread monai/networks/utils.py
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jan 6, 2022

Copy link
Copy Markdown
Contributor Author

Hi @wyli ,

BTW, I think maybe something wrong updated in the CI configs?

Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Thanks.

@wyli wyli 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.

looks good to me, I put some minor comments

Comment thread monai/networks/utils.py
Comment thread tests/test_sample_slices.py Outdated
@wyli

wyli commented Jan 6, 2022

Copy link
Copy Markdown
Contributor

Hi @wyli ,

BTW, I think maybe something wrong updated in the CI configs?

Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Thanks.

looks like it's from setuptools and the new version is yanked https://pypi.org/project/setuptools/60.3.0/

@Nic-Ma

Nic-Ma commented Jan 6, 2022

Copy link
Copy Markdown
Contributor Author

Hi @wyli ,
BTW, I think maybe something wrong updated in the CI configs?

Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Thanks.

looks like it's from setuptools and the new version is yanked https://pypi.org/project/setuptools/60.3.0/

Hi @wyli ,

I see your PR #3597 passed the CI tests, so you have updated something to fix the CI software issue?

Thanks.

@wyli

wyli commented Jan 6, 2022

Copy link
Copy Markdown
Contributor

Hi @wyli ,
BTW, I think maybe something wrong updated in the CI configs?

Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Thanks.

looks like it's from setuptools and the new version is yanked https://pypi.org/project/setuptools/60.3.0/

Hi @wyli ,

I see your PR #3597 passed the CI tests, so you have updated something to fix the CI software issue?

Thanks.

I rerun the tests and it should work fine, I think the error version has been removed by the maintainers.

Nic-Ma added 3 commits January 6, 2022 22:13
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jan 6, 2022

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Jan 6, 2022

Copy link
Copy Markdown
Contributor Author

/build

@wyli wyli 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, it looks good to me.

@Nic-Ma Nic-Ma enabled auto-merge (squash) January 6, 2022 23:54
@Nic-Ma Nic-Ma merged commit 91777d0 into Project-MONAI:dev Jan 7, 2022
Can-Zhao pushed a commit to Can-Zhao/MONAI that referenced this pull request Jan 10, 2022
* [DLMED] enhance slice_channels

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] remove test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add flag

Signed-off-by: Nic Ma <nma@nvidia.com>
wyli pushed a commit that referenced this pull request Jan 10, 2022
* [DLMED] enhance slice_channels

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] remove test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add flag

Signed-off-by: Nic Ma <nma@nvidia.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.

Add support to only keep selected classes in one_hot

2 participants