mueller-franzes / TraBS

Transformer Breast Segmentation (TraBS)
GNU General Public License v3.0
15 stars 1 forks source link

Duke dataset loading #1

Open amirhamidihd opened 1 year ago

amirhamidihd commented 1 year ago

I have some issues in loading the Duke dataset in your code. when I downloaded the dataset from the link mentioned on the TraBS Github page, format of images are DICOM while you utilized nii format on the data loader part. I wanna ask you about how did you convert DICOM to nii format.

mueller-franzes commented 1 year ago

Hi, I used the SimpleITK library to read the DICOM files and convert them to NIFIT files. Here is a minimal pseudo-code example:

import SimpleITK as sitk

for path_seq_dir in path_dir_series.iterdir():
      dicom_names = reader.GetGDCMSeriesFileNames(str(path_seq_dir))
      reader.SetFileNames(dicom_names) 
      img_nii = reader.Execute()
      sitk.WriteImage(img_nii, str(path_out_dir/(seq_name+'.nii.gz')) )

I hope this helps you :)