Skip to content

Convert the PROSTATEx-Seg-HiRes dataset to nii format.

License

Notifications You must be signed in to change notification settings

zagoli/ProstateX2nii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProstateX2nii

I used these scripts to convert the PROSTATEx-Seg-HiRes DICOM dataset to a more friendly nii format. This dataset is not straightforward to convert for various reasons, for example, you can use dcm2niix to convert the mri images but not the segmentations, there isn't a one-to-one relation between segmentation slices and mri slices and so on. Remember: this code is far from perfect, it's not well engineered, and it was written for personal necessity. For a much cleaner code with automated downloads of data and tools see this gist.

Usage

  1. Download the dataset with classic directory names option (both mri and segmentations).

  2. Create a new folder (for example named ProstateX) with two sub-folders in it, one for the mri images and one for the segmentations.

  3. Place all the folders (ProstateX-0004, ecc...) in the respective sub-folder. Do this for both the mri images and the segmentations. Your folder structure should look like this (truncated for clarity):

    ProstateX
    ├───mri
    │   ├───ProstateX-0004
    │   ├───ProstateX-0007
    │   ├───ProstateX-0009
    │   └───ProstateX-...
    └───seg
        ├───ProstateX-0004
        ├───ProstateX-0007
        ├───ProstateX-0009
        └───ProstateX-...
    
  4. Run rename_all_folders.py two times: the first time the dcm_path variable should point to the mri sub-folder, the second time it should point to the segmentations sub-folder.

  5. Download the dcm2niix executable (dcm2niix.exe) and store it where you can use it.

  6. Run mri2nii.py adjusting the various paths in it. dcm_dataset_path should point to the mri sub-folder, nii_dataset_path to your preferred output folder and converter to dcm2niix.exe.

  7. Run seg2nii.py adjusting the various paths in it. dcm_dataset_path should point to the segmentations sub-folder, and nii_dataset_path should point to the same location as before.

  8. Enjoy the converted dataset!

About

Convert the PROSTATEx-Seg-HiRes dataset to nii format.

Topics

Resources

License

Stars

Watchers

Forks

Languages