You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using a custom loader (in my example .npy loader), if the data is loaded lazily (i.e.: not with subject.load(), but during the application of a transformation for example) Torchio doesnt seem to use the provided thee custom loader, and instead tries to find a fitting SimpleITIKIO reader
This throws an error in this case because no such reader exists for .npy files.
Throws error: Unable to determine ImageIO reader for "/mnt/disk_2//Sarco///mask.npy"
Error messages
/home/<user>/.local/lib/python3.11/site-packages/torchio/data/inference/aggregator.py:229: RuntimeWarning: Medical image frameworks such as ITK do not support int64. Casting to int32...
warnings.warn(message, RuntimeWarning)
Traceback (most recent call last):
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/data/subject.py", line 309, in check_consistent_spaceself.check_consistent_attribute('spacing')
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/data/subject.py", line 273, in check_consistent_attribute
current_attribute =getattr(image, attribute)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/data/image.py", line 317, in spacing
_, spacing = get_rotation_and_spacing_from_affine(self.affine)
^^^^^^^^^^^
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/data/image.py", line 253, in affine
affine = read_affine(self.path)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/data/io.py", line 119, in read_affine
reader = get_reader(path)
^^^^^^^^^^^^^^^^
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/data/io.py", line 128, in get_reader
reader.ReadImageInformation()
File "/home/<user>/.local/lib/python3.11/site-packages/SimpleITK/SimpleITK.py", line 8455, in ReadImageInformationreturn _SimpleITK.ImageFileReader_ReadImageInformation(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^RuntimeError: Exception thrown in SimpleITK ImageFileReader_ReadImageInformation: /tmp/SimpleITK/Code/IO/src/sitkImageReaderBase.cxx:105:
sitk::ERROR: Unable to determine ImageIO reader for "/mnt/disk_2/<user>/<data>/<patient>/mask.npy"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/<user>/example.py", line 34, in <module>
sub = pad_tr(sub)
^^^^^^^^^^^
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/transforms/transform.py", line 158, in __call__
transformed =self.apply_transform(subject)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/transforms/preprocessing/spatial/crop_or_pad.py", line 278, in apply_transform
subject.check_consistent_space()
File "/home/<user>/.local/lib/python3.11/site-packages/torchio/data/subject.py", line 320, in check_consistent_spaceraiseRuntimeError(message) from e
RuntimeError: As described above, some images in the subject are not in the same space. You probably can use the transforms ToCanonical and Resample to fix this, as explained at https://github.com/fepegar/torchio/issues/647#issuecomment-913025695
Is there an existing issue for this?
Bug summary
While using a custom loader (in my example .npy loader), if the data is loaded lazily (i.e.: not with subject.load(), but during the application of a transformation for example) Torchio doesnt seem to use the provided thee custom loader, and instead tries to find a fitting SimpleITIKIO reader
This throws an error in this case because no such reader exists for .npy files.
Code for reproduction
Actual outcome
Throws error: Unable to determine ImageIO reader for "/mnt/disk_2//Sarco///mask.npy"
Error messages
Expected outcome
No error
System info
The text was updated successfully, but these errors were encountered: