-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
LoadImageD and MetaTensor #5509
Comments
it's possible to globally turn off the metatensor... >>> from monai.data import set_track_meta
>>> set_track_meta(False)
>>> from monai.transforms import LoadImage
>>> x = LoadImage(image_only=True)("IBSR_01_ana.nii.gz")
>>> type(x)
<class 'torch.Tensor'> but these are not systematically tested for end-to-end workflows, for example, some transform inverting pipelines might not work properly... |
I see, thank you. what about the last question: lines 487 and 504 seems both convert to tensor internally, or can we remove line 487 |
I think it is about returning a fresh copy of the input, @rijobro perhaps can confirm |
Looking at the code, I'm not 100% sure if both are needed. I'm also not 100% which of them would create a deepcopy of the data. Feel free to mess around with it for a variety of inputs ( If they can be combined into one, I'm happy for us to do that. |
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
thanks, now the repeated MONAI/monai/data/meta_tensor.py Lines 545 to 552 in b592164
|
It's more of question to clarify, not a bug. can you help clarify plz
LoadImage() and LoadImaged() always return MetaTensor. Is it by design? I'm okay either way, just want to clarify. So we can't return the original data format ?
line 281
return img, img.meta if isinstance(img, MetaTensor) else meta_data
. The img seems to be always a MetaTensor, is that check necessary?MONAI/monai/transforms/io/array.py
Lines 273 to 281 in c27ab36
img = convert_to_tensor(im)
andreturn MetaTensor(img, meta=meta)
will internally call torch.as_tensor on img.MONAI/monai/data/meta_tensor.py
Lines 487 to 504 in c27ab36
Thank you
The text was updated successfully, but these errors were encountered: