Skip to content
Discussion options

You must be logged in to vote

Hi, @malteekj.

I keep getting the error message "RuntimeError: "path_to_numpy_file" not understood.

This is because NumPy is not a suitable format for medical images, as it doesn't store important spatial metadata. Therefore, it's not supported by SimpleITK and NiBabel, which TorchIO uses for I/O.

I've added a kwarg in Image so you can use your own reader for lazy loading:

import numpy as np
import torchio as tio

def numpy_reader(path):
    return np.load(path), np.eye(4)

subj = tio.Subject(
    ct=tio.ScalarImage(path_to_numpy_CT, reader=numpy_reader),
    label=tio.LabelMap(path_to_numpy_ROI, reader=numpy_reader)
)

I will merge these changes soon, they will be available in v0.18.27.

I…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@malteekj
Comment options

Answer selected by malteekj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants