我是圖像處理的新手,想知道如何使用 python 預處理 dicom 圖像。我正在關注以下教程:python 中的 dicom我的數據中沒有 SliceThickness 屬性。我該如何計算?這是我擁有的示例數據集:這是我的代碼:import pydicomimport osimport numpyfrom matplotlib import pyplot, cmPathDicom = "xyz\images"lstFilesDCM = [] # creating an empty listfor dirName, subdirList, fileList in os.walk(PathDicom): for filename in fileList: if ".dcm" in filename.lower(): # checking whether the file's DICOM lstFilesDCM.append(os.path.join(dirName,filename))RefDs = pydicom.read_file(lstFilesDCM[0])ConstPixelDims = (int(RefDs.Rows), int(RefDs.Columns), len(lstFilesDCM)) #Load dimensions based on the number of rows, columns, and slices (along the Z axis)ConstPixelSpacing = (float(RefDs.PixelSpacing[0]), float(RefDs.PixelSpacing[1]), float(RefDs.SliceThickness)) # Load spacing values (in mm)這是我得到的錯誤:'FileDataset' object has no attribute 'SliceThickness'
使用 pydicom 處理 X 射線圖像(.dcm 文件)
慕的地6264312
2021-06-06 07:17:10
