Hello,
I am new to python and ITK.
I want to read a series of Dicom images. For this, I copied the below code snippet from a previous query.
import SimpleITK as sitk
# A file name that belongs to the series we want to read
file_name = '1.dcm'
data_directory = 'CIRS057A_MR_CT_DICOM'
# Read the file's meta-information without reading bulk pixel data
file_reader = sitk.ImageFileReader()
file_reader.SetFileName(file_name)
file_reader.ReadImageInformation()
# Get the sorted file names, opens all files in the directory and reads the meta-information
# without reading the bulk pixel data
series_ID = file_reader.GetMetaData('0020|000e')
sorted_file_names = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(data_directory, series_ID)
# Read the bulk pixel data
img = sitk.ReadImage(sorted_file_names)
I am getting the following error
RuntimeError: Exception thrown in SimpleITK ImageFileReader_ReadImageInformation: C:\Miniconda\envs\bld\conda-bld\work\Code\IO\src\sitkImageReaderBase.cxx:97:
sitk::ERROR: The file "1.dcm" does not exist.
Please explain to me what is happening and how to solve this.