Replies: 1 comment 4 replies
-
|
Hi, @vedal. Thanks for your kind words and for sharing this. We could consider switching to In [15]: %timeit torch.tensor(pydicom.dcmread('IMG0001.dcm').pixel_array)
1.94 ms ± 728 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
In [16]: %timeit torch.tensor(tio.ScalarImage('IMG0001.dcm').data)
<magic-timeit>:1: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
1.65 ms ± 484 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Versions:
Hi!
Thanks for this great package!
I find that loading a dicom using
pydicom.dcmreadis much faster thantorchio.ScalarImage. I tried avoiding the NaN-check. Is there any other method to speed it up?The dicom data has shape
(80, 758, 1016, 3), whichtorchio.ScalarImageautomatically reshapes totorch.Size([3, 1016, 758, 80]).Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions