Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in_mm3 in remove_small_objects #7137

Merged
merged 15 commits into from
Oct 18, 2023
Merged

Conversation

KumoLiu
Copy link
Contributor

@KumoLiu KumoLiu commented Oct 17, 2023

Fixes #7034.

Description

Add in_mm3 in remove_small_objects, if in_mm3=True, min_size will be divided by pixdim when the image is MetaTensor.

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.

Signed-off-by: KumoLiu <yunl@nvidia.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
@KumoLiu
Copy link
Contributor Author

KumoLiu commented Oct 18, 2023

In this PR, I added the physical_scale option.

  • If "physical_scale=True," "min_size" will be represented by physical scale, which means, if "min_size" is 2, the min-size will be divided by pixdim to represent the number of pixels in 2mm^3. Then this transform will remove the objects smaller than 2mm^3.

@AHarouni, could you please check whether this one can help address your issue?

cc @wyli @ericspod

KumoLiu and others added 5 commits October 18, 2023 16:19
Signed-off-by: KumoLiu <yunl@nvidia.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
@KumoLiu KumoLiu marked this pull request as ready for review October 18, 2023 09:09
Signed-off-by: KumoLiu <yunl@nvidia.com>
@KumoLiu KumoLiu requested review from Nic-Ma, wyli and ericspod October 18, 2023 09:34
monai/transforms/utils.py Outdated Show resolved Hide resolved
KumoLiu and others added 3 commits October 18, 2023 20:27
Co-authored-by: Wenqi Li <831580+wyli@users.noreply.github.com>
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Co-authored-by: Wenqi Li <831580+wyli@users.noreply.github.com>
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
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, it looks good to me.

@KumoLiu KumoLiu changed the title Add physical_scale in remove_small_objects Add in_mm3 in remove_small_objects Oct 18, 2023
Signed-off-by: KumoLiu <yunl@nvidia.com>
@wyli
Copy link
Contributor

wyli commented Oct 18, 2023

/build

@ericspod
Copy link
Member

This assumes the images are 3D, what about 2D? mm^3 isn't the unit being used in that case. Also we haven't specified what units we're working in, I would just state that the measure is in unit area or volume and not assume units are mm. Typically we resample in terms of square or cubic mm but not always and we don't encode in types or anywhere else what units we're dealing with, they've elsewhere always been implicit.

Signed-off-by: KumoLiu <yunl@nvidia.com>
@wyli
Copy link
Contributor

wyli commented Oct 18, 2023

/build

@wyli wyli enabled auto-merge (squash) October 18, 2023 15:16
@wyli
Copy link
Contributor

wyli commented Oct 18, 2023

/build

@wyli wyli merged commit 2c9f44c into Project-MONAI:dev Oct 18, 2023
23 checks passed
@KumoLiu KumoLiu deleted the remove-small-objects branch October 19, 2023 02:42
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 min_size_in_mm to RemoveSmallObjects transform
3 participants