Hi all,
I have Dicom file that contains
- Dicom volume
- grid transform
so, I want to read Dicom with that transformation.
now I can only read raw Dicom
My code:
def readDCM(folder_path, win_level=50, win_width=100):
series_reader = sitk.ImageSeriesReader()
series_IDs = series_reader.GetGDCMSeriesIDs(folder_path)
if not series_IDs:
raise Exception("No DICOMs were found in the directory. Please select a different directory.")
series_file_names = series_reader.GetGDCMSeriesFileNames(folder_path, series_IDs[0])
series_reader.SetFileNames(series_file_names)
image = series_reader.Execute()
image_array = sitk.GetArrayFromImage(image)
image_array = np.clip(image_array, win_level - 0.5 - (win_width - 1) / 2, win_level - 0.5 + (win_width - 1) / 2)
image_array = (image_array - (win_level - 0.5)) / (win_width - 1)
return image_array
Best,
Thirawat