Created
May 10, 2021 22:22
-
-
Save sarthakpati/1cc4739aeba15f61ed0b5c1ed072facf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Ref: https://github.com/razorx89/pydicom-seg#getting-started | |
import pydicom | |
import pydicom_seg | |
import SimpleITK as sitk | |
dcm_path = pydicom.dcmread('/path/to/segmentation.dcm') | |
reader = pydicom_seg.MultiClassReader() | |
result = reader.read(dcm_path) | |
image_data = result.data # directly available | |
image = result.image # lazy construction | |
sitk.WriteImage(image, '/path/for/saving/segmentation.nii.gz', True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment