How can I convert an rtstruct to an nrrd

Operating system: Windows
Slicer version:4.6.2
Expected behavior:
Actual behavior:

In Segmentations module change Master representation to binary labelmap (click Make master button in the Binary labelmap row in Representations section) then save the scene. Structure sets may overlap, therefore the nrrd file will be a 4-dimensional volume, each segment is stored in a separate 3D subvolume.

Use latest nightly build, it’s stable and contains many fixes and improvements.

Thank you for the help

Andras, is there a way to create a separate 3D volume file for each segment?

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Andras, is there a way to get my segmentation and my image to both be the
same dimensions?

This option is not easily available for the user. You can load the .seg.nrrd file as a volume sequence if you choose “Volume Sequence” in the Add data dialog and then save it, but by default it is saved again as a 4D sequence. You would need to change the default storage node to vtkMRMLSequenceStorageNode to save as a zip file that contains each volume as a separate file.

ITK and VTK can both read volume sequences from 4D files, we also have a Matlab reader/writer that supports 4D volumes, so we never needed them as separate volumes.

Segmentation will have the same origin, axis direction, and spacing as the input image, but extent usually does not match the input image.

Note that the nrrd header contains SegmentN_Extent:=imin imax jmin jmax kmin kmax field that you can use to efficiently extract only that part of the 3D volume where your particular segment is. You can copy that extent into a larger volume that matches extent of your image.

2 posts were split to a new topic: Convert image and segmentation to DICOM

A post was merged into an existing topic: Convert image and segmentation to DICOM

Andras,

Is there a way to share the code with us? I have been trying to figure out how to read my segmented nrrd file however i has been giving me a lot of issues so I couldn’t… I would appreciate if you could possible share your code with me.

Thanks!

Segmentation is a 4D image in standard nrrd format. You can read it using either VTK or ITK nrrd reader or any nrrd reader that supports 4D volumes. See for example how Slicer reads it: https://github.com/Slicer/Slicer/blob/0ab294089b4827fea3272417a23c321d57e391b4/Libs/MRML/Core/vtkMRMLSegmentationStorageNode.cxx#L290