Issues Applying MONAI Transformations Directly to List of DICOM File Paths #7608
Replies: 2 comments 2 replies
-
Hello, your code seems correct, it do not work for every images or only some of them ? If you look at the source code (https://docs.monai.io/en/stable/_modules/monai/transforms/io/array.html#LoadImage) this error is raised if the image is None or if the reader is None. You say that you've checked the file paths and their accessibility. Are you sure that the files are readable as images, for example are you able to really look at the image using pydicom or itk? If it works with pydicom, perhaps try Finally you could look in the logs to get a better idea of the problem. (see the code snippet from the try:
img = reader.read(filename)
except Exception as e:
err.append(traceback.format_exc())
logging.getLogger(self.__class__.__name__).debug(e, exc_info=True)
logging.getLogger(self.__class__.__name__).info(
f"{reader.__class__.__name__}: unable to load {filename}.\n"
) In the hope that it may have provided some clues |
Beta Was this translation helpful? Give feedback.
-
Glad to hear that you're using MONAI for your work, it would be of great help if you could provide more error infomation. From your given information, I suspect that the issue might be caused due to the absence of the ITK library. By default, MONAI uses the ITK toolkit to read DICOM files. Please verify whether the ITK is installed in your working Python environment. Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
Description
I am experiencing difficulties applying MONAI transformations directly to a list of DICOM file paths (filtered_patient_file). Despite using transformations that should handle file paths, such as LoadImage, I encounter errors suggesting a mismatch in expected input types. The issue persists even after upgrading to MONAI version 1.3.0. Here is the error message I receive when trying to apply the transformations to the DICOM file paths:
Environment Details
Monai Version: 1.3
Torch Version: 1.12.1+cu113
Pydicom Version: 2.4.4
Python 3.9.9
Operating System : Windows 11
Code sample:
Expected Behavior
I expected the LoadImage transformation to load each image from the provided file paths and subsequent transformations to be applied successfully.
Actual Behavior
I receive a TypeError, indicating an issue with the input type expected by the transformations, despite the use of LoadImage which should handle file paths.
Additional Context
I have verified that the file paths are correct and the files are accessible. The issue seems to be related to how the transformations are applied to the list of file paths.
Questions:
1.Are there known issues with using LoadImage or other transformations directly with a list of file paths in MONAI?
2.Is there a specific format or preprocessing step required for the file paths before passing them to the MONAI transformations?
3.Could this issue be related to the setup of my MONAI environment or version compatibility?
Any help/suggestions would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions