Skip to content

Spacing MetaTensor#4319

Merged
wyli merged 17 commits intoProject-MONAI:feature/MetaTensorfrom
rijobro:Spacing_MetaTensor
May 24, 2022
Merged

Spacing MetaTensor#4319
wyli merged 17 commits intoProject-MONAI:feature/MetaTensorfrom
rijobro:Spacing_MetaTensor

Conversation

@rijobro
Copy link
Copy Markdown
Contributor

@rijobro rijobro commented May 23, 2022

Spacing compatible with MetaTensor. Array transform now also has inverse method.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • New tests added to cover the changes.

Signed-off-by: Richard Brown <[email protected]>
@rijobro rijobro requested review from Nic-Ma, ericspod and wyli May 23, 2022 10:42
rijobro added 2 commits May 23, 2022 11:46
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
Copy link
Copy Markdown
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 the transform becomes easier to use with MetaTensor

rijobro added 5 commits May 23, 2022 14:11
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
@rijobro
Copy link
Copy Markdown
Contributor Author

rijobro commented May 23, 2022

@wyli Do you think you can help me with this error in the github action? I can't reproduce it locally. I think it's complaining that img_.device doesn't work when img_ is a np.ndarray. But the code before looks like this:

if get_track_meta():
    img_ = img if isinstance(img, MetaTensor) else MetaTensor(img)
    img_, *_ = convert_data_type(img, dtype=_dtype)
else:
    img_, *_ = convert_data_type(img, torch.Tensor, dtype=_dtype)

It seems to me that in all cases, img_ should be of type torch.Tensor and so `device`` should be available.

rijobro added 2 commits May 23, 2022 17:03
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
@wyli
Copy link
Copy Markdown
Contributor

wyli commented May 23, 2022

img_ should be of type torch.Tensor and so `device`` should be available.

looks like you addressed the issue... I'll merge this PR and #4308 and have the full integration tests soon.

@wyli wyli merged commit 361cac3 into Project-MONAI:feature/MetaTensor May 24, 2022
@rijobro rijobro deleted the Spacing_MetaTensor branch May 24, 2022 08:45
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.

3 participants