- Notifications
You must be signed in to change notification settings - Fork0
Convert the PROSTATEx-Seg-HiRes dataset to nii format.
License
zagoli/ProstateX2nii
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
I used these scripts to convert thePROSTATEx-Seg-HiResDICOM dataset to a more friendly nii format. This dataset is not straightforward to convert for various reasons,for example, you can usedcm2niix to convert the mri images but not thesegmentations, 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 seethis gist.
Download the dataset with classic directory names option (both mri and segmentations).
Create a new folder (for example named ProstateX) with two sub-folders in it, one for the mri images and one for the segmentations.
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-...
Run rename_all_folders.py two times: the first time thedcm_path variableshould point to the mri sub-folder, the second time it should point to the segmentations sub-folder.
Download thedcm2niix executable (dcm2niix.exe) and store itwhere you can use it.
Run mri2nii.py adjusting the various paths in it.dcm_dataset_path shouldpoint to the mri sub-folder,nii_dataset_path to your preferred output folderandconverter to dcm2niix.exe.
Run seg2nii.py adjusting the various paths in it.dcm_dataset_path shouldpoint to the segmentations sub-folder, andnii_dataset_path should pointto the same location as before.
Enjoy the converted dataset!
About
Convert the PROSTATEx-Seg-HiRes dataset to nii format.