Export volume with burnt-in segmentation

Returning to the original topic of this post, I have been trying to export the segmentations made in Slicer as a DICOM dataset. What I would like to do is burn in my segmentation as an outline over the original CT dataset and then export that as a new uneditable DICOM dataset.

Orignal CT ------> Segmentation ------> New CT with Segmentation burned in

From the above discussion, it seems that based on the program that the end user will be viewing the file in, I need to export my segmentation as a DICOM RTSTRUCT file. I tried to replicate this tutorial (Create DICOM files from CT volume and segmentation - YouTube) but I keep receiving an error on the export.

Below is the error log corresponding to the screenshot:

Application log

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - Session start time …: 2018-12-28 10:40:01

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - Slicer version …: 4.11.0-2018-12-16 (revision 27662) macosx-amd64 - installed release

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - Operating system …: Mac OS X / 10.13.6 / 17G65 - 64-bit

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - Memory …: 8192 MB physical, 3072 MB virtual

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - CPU …: GenuineIntel Intel(R) Core™ i5-7500 CPU @ 3.40GHz, 4 cores, 4 logical processors

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - VTK configuration …: OpenGL2 rendering, Sequential threading

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - Developer mode enabled …: no

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - Prefer executable CLI …: yes

[DEBUG][Qt] 28.12.2018 10:40:01 (unknown:0) - Additional module paths …: /Applications/Slicer Nightly.app/Contents/Extensions-27662/QuantitativeReporting/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerDevelopmentToolbox/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/PETDICOMExtension/lib/Slicer-4.11/cli-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/PETDICOMExtension/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/DCMQI/lib/Slicer-4.11/cli-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/AnglePlanesExtension/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/EasyClip/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/MarkupsToModel/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/MatlabBridge/lib/Slicer-4.11/cli-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/MatlabBridge/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerOpenIGTLink/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerOpenIGTLink/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/MeshToLabelMap/lib/Slicer-4.11/cli-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/ModelToModelDistance/lib/Slicer-4.11/cli-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/PedicleScrewSimulator/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SegmentEditorExtraEffects/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SegmentRegistration/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/MeshStatisticsExtension/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerProstate/lib/Slicer-4.11/cli-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerProstate/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerFab/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/Sequences/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/Sequences/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerIGT/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerIGT/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerVMTK/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerVMTK/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/TCIABrowser/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/VolumeClip/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerHeart/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerHeart/lib/Slicer-4.11/qt-scripted-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerRT/lib/Slicer-4.11/cli-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerRT/lib/Slicer-4.11/qt-loadable-modules, /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerRT/lib/Slicer-4.11/qt-scripted-modules

[DEBUG][Python] 28.12.2018 10:40:09 [Python] (/Applications/Slicer Nightly.app/Contents/lib/Slicer-4.11/qt-scripted-modules/SubjectHierarchyPlugins/AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: Annotations

[DEBUG][Qt] 28.12.2018 10:40:14 (unknown:0) - MatlabExecutablePath not found, default path used: /Applications/MATLAB_XXXXX.app/bin/matlab

[DEBUG][Python] 28.12.2018 10:40:16 [Python] (/Applications/Slicer Nightly.app/Contents/lib/Slicer-4.11/qt-scripted-modules/SubjectHierarchyPlugins/AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: SegmentEditor

[DEBUG][Python] 28.12.2018 10:40:16 [Python] (/Applications/Slicer Nightly.app/Contents/lib/Slicer-4.11/qt-scripted-modules/SubjectHierarchyPlugins/AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: SegmentStatistics

[DEBUG][Qt] 28.12.2018 10:40:17 (unknown:0) - Switch to module: “Welcome”

[INFO][VTK] 28.12.2018 10:40:19 [vtkMRMLVolumeArchetypeStorageNode (0x7fed52b43f10)] (/Volumes/Dashboards/Preview/Slicer-0/Libs/MRML/Core/vtkMRMLVolumeArchetypeStorageNode.cxx:465) - Loaded volume from file: /Applications/Slicer Nightly.app/Contents/Extensions-27662/SlicerVMTK/lib/Slicer-4.11/qt-scripted-modules/Resources/Vesselness.png. Dimensions: 65x50x1. Number of components: 3. Pixel type: unsigned char.

[INFO][Stream] 28.12.2018 10:40:20 (unknown:0) - Loading Slicer RC file [/Users/AVarghese11/.slicerrc.py]

[INFO][VTK] 28.12.2018 10:40:31 [vtkMRMLVolumeArchetypeStorageNode (0x7fed529ad4a0)] (/Volumes/Dashboards/Preview/Slicer-0/Libs/MRML/Core/vtkMRMLVolumeArchetypeStorageNode.cxx:465) - Loaded volume from file: /Users/AVarghese11/Documents/3D Slicer Segmentation Practice/AAA2/Panoramix-cropped.nrrd. Dimensions: 441x321x215. Number of components: 1. Pixel type: short.

[INFO][VTK] 28.12.2018 10:40:32 [vtkMRMLVolumeArchetypeStorageNode (0x7fed529aa490)] (/Volumes/Dashboards/Preview/Slicer-0/Libs/MRML/Core/vtkMRMLVolumeArchetypeStorageNode.cxx:465) - Loaded volume from file: /Users/AVarghese11/Documents/3D Slicer Segmentation Practice/AAA2/Segmentation-label.nrrd. Dimensions: 441x321x215. Number of components: 1. Pixel type: short.

[DEBUG][Qt] 28.12.2018 10:40:32 (unknown:0) - “MRML Scene” Reader has successfully read the file “/Users/AVarghese11/Documents/3D Slicer Segmentation Practice/AAA2/2018-12-26-Scene.mrml” “[1.76s]”

[DEBUG][Qt] 28.12.2018 10:40:44 (unknown:0) - Switch to module: “Data”

[CRITICAL][Stream] 28.12.2018 10:41:13 (unknown:0) - Traceback (most recent call last):

[CRITICAL][Stream] 28.12.2018 10:41:13 (unknown:0) - File “<string>”, line 1, in <module>

[CRITICAL][Stream] 28.12.2018 10:41:13 (unknown:0) - KeyError: ‘DicomRtImportExportPlugin’

Please let me know if you have any suggestions

You can only export segmentation as a DICOM RT Structure Set or Segmentation Object. You need to put segmentation node in the subject hierarchy directly under the study (the screenshot shows that you have the segmentation node under the image volume). To visualize this data, you need a DICOM viewer that can display RT Structure Set or Segmentation Object.

You can burn in contours in the volume using Segment Editor:

  • Use Hollow effect to create thin contours from solid segments
  • Use Mask volume effect (in SegmentEditorExtraEffects extension) with Fill inside, Fill value = 3000, Output volume = same as master volume, to burn in the contour in the image.
  • Repeat the above steps for each segment.
  • Export the CT volume (you can choose “Scalar Volume” export type in the DICOM Export window)
1 Like

@lassoan Reported this issue in SlicerRT. I fixed it now, so @avarghes23 when you try again then please use the nightly on the 31st or later.

1 Like

Thank you both for your input. I was able to follow @lassoan’s steps, but when I execute the LabelOverlayImageFilter, I get a weird looking result (see screenshot)

Sorry, that was a typo, if you use Hollow and Mask volume effects then there is no need to use LabelOverlayImageFilter.

1 Like