Segmentation Alignment

Hi everyone,

I have a pre-determined VOI segmentation and DCE MRI sequence in DICOM format, and want to overlay/align them. What is the best way to go about this? I was thinking about converting the VOI segmentation to a labelmap volume matched to reference geometry of the DCE MRI’s. Would this work to align?


Yes, you should be able to load the segmentation as a segmentation node and the MRI as a volume node and Slicer will overlay them correctly. There are many visualization parameters that you can tune in Segmentations module’s Display section.

Hi Andras,

When I try to do this, I load the MRI as a volume using slicer.util.loadVolume(), and then want to use the code below. However, I’m not sure how to (1) get the MRML node of the loaded MRI volume and (2) load the segmentation before getting the segmentation node as below. Thanks!

segmentationNode = getNode('Segmentation')
labelmapVolumeNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLLabelMapVolumeNode')
slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(segmentationNode, labelmapVolumeNode, referenceVolumeNode)

Does everything work correctly using the GUI?

What are the input files on disk that you would like to load using Python?

Hi Andras,

I am able to load the MRI dicom’s as a volume, but I am having trouble loading the segmentation. The segmentation file is also in dicom format, so I am trying to load as labelmap through GUI following instructions ( but I don’t see this option. What do you recommend?


What information object is used for storing the segmentation: DICOM RT structure set or DICOM Segmentation Object?

DICOM segmentation object

DICOM segmentation object must be loaded via DICOM module and it requires Quantitative Reporting extension.

Hi Andras,

Please ignore my last reply, I was able to get it to work by putting the seg files in the same folder. The new problem I have is that 2 of the segmentation files (specifically PE segmentations) are not able to load as a DICOMsegmentation-- do you know why this could be? Thanks

Use the latest Slicer Preview Release. If the import still does not work as expected then check if there are any errors or warnings in the log.

Hi Andras,

Luckily this worked – thank you. I have a follow - up question: to export a labelmap volume (based on the aligned MRI volume reference geometry with the segmentation file) to a file, what are the settings I should use in the segmentations module? Thank you

In general, if you don’t need any special behavior, use default settings. To set a reference geometry for export, select the reference volume in Segmentations module / Export/import… / Advanced / Reference volume.

What is the difference between the section to “export/import models and labelmaps” and “export to files”?

Export/import models and labelmaps exports to nodes in the scene (that you can later save to files using Save data… window). “Export to files” saves directly to files.

@Sunderlandkyl what geometry is used by “Export to files” when exporting nrrd/nifti? Probably we should add a reference volume selector there, too.

Export to file currently uses the reference geometry string. I believe it’s the same with both export to labelmap and export to files (with the exception of the reference volume selector). I’ll add a combo box to choose the reference volume.

That would be great, thank you!