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

warning to truncate affine #6819

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

a-parida12
Copy link
Contributor

Fixes #6809 .

Description

A few sentences describing the changes proposed in this pull request.

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.

@wyli
Copy link
Contributor

wyli commented Aug 4, 2023

/black

Signed-off-by: monai-bot <[email protected]>
@wyli
Copy link
Contributor

wyli commented Aug 4, 2023

/build

@wyli
Copy link
Contributor

wyli commented Aug 7, 2023

could you please help verify this PR @kretes if you have time? the existing tests work fine, but I'm not sure if it addresses #6809

@kretes
Copy link
Contributor

kretes commented Aug 7, 2023

I will have limited time for the next 2 weeks to give it a test-through to reproduce.
And if we talk about whether this is enough to address #6809 - I would say a warning is a bare minimum. In case of 3D tensor and 4x4 affine - I would go for a clear exception or assuming there is no channel dimension and acting accordingly.

@@ -499,6 +499,13 @@ def __call__(
warnings.warn("`data_array` is not of type MetaTensor, assuming affine to be identity.")
# default to identity
input_affine = np.eye(sr + 1, dtype=np.float64)
input_affine_shape = input_affine.shape[0]
if input_affine_shape != sr + 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel we can compare the length of self.pixdim and sr+1; otherwise, there might always be a WARNING for 2D data. Also, users may not modify the affine_matrix, perhaps we should just mention it in the warning message for users who are unfamiliar with MONAI and don't know they need to add a channel.
What do you think?

@KumoLiu
Copy link
Contributor

KumoLiu commented Nov 9, 2023

Hi @a-parida12, is there any more progress on this PR so far, do you plan to finish this one?
Thanks!

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.

Resample operations should fail when no channels
5 participants