BatchProcessing RT structure to label maps

Hi I am trying to convert many dicom RT structure to labelmaps,
and I found that I can use the BatchStructureSetConversion.py
(SlicerRT/BatchProcessing/BatchStructureSetConversion.py at master · SlicerRt/SlicerRT · GitHub)

However, I got an error while doing it,
TODO: implement cloud fingerprint store
Traceback (most recent call last):
File “”, line 7, in
File “./project/
BatchStructureSetConversion.py”, line 99
logging.info(f’ Converting structure set {segmentationNode.GetName()} to labelmap’)
^
SyntaxError: invalid syntax

I am a bit lost about what I can change and what to do? Would appreciate any help. Thank you.

The line in question seems fine to me, the error is quite strange. What Slicer version do you use?

I am currently using Slicer 4.10.2, do I need to upgrade my slicer to use the function? Thanks! I running the command in Linux with something like this: Slicer —no-main-window —python-script BatchStructure.py -i image/folder -o image/folder

Please try it on the latest Slicer, we can only help with recent versions. 4.10 is kind of ancient by now.

I already tried it with the newest version 5.6.2, however there are still these errors:

qSlicerMarkupsModulePrivate::addToolBar: no main window is available, toolbar is not added
qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added

appreciate any pointers. :slight_smile: thank you

Please disregard my previous post, I forgot to download the RT plugins.

I do have one question regarding how the files were supposed to be placed, if there is more than 1 RT structure in the folder, will it be okay to run?

My folder consists of several folders:

  • 1st RT structure folder
  • 2nd RT structure folder
  • CT dicom folder
  • RTdose folder
  • RTplan folder

Do I need to separate them? because I still have these errors:
When loading module “DicomRtImportExport” , the dependency “Volumes” failed to be loaded.
When loading module “BatchStructureSetConversion” , the dependency “DicomRtImportExport” failed to be loaded.
When loading module “Beams” , the dependency “Models” failed to be loaded.
When loading module “DicomRtImportExport” , the dependency “Volumes” failed to be loaded.
error: [/home/Slicer-5.6.2-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem.

Thank you very much!

There must be some problem with your installation. The dependencies that cannot be found, Volumes and Models are basic Slicer modules. Can you find them in the module list?

By module list, do you mean if I can use the module? I can find both modules when I use the UI version of 3D Slicer.

Yes this is what I mean.

The error message When loading module “DicomRtImportExport” , the dependency “Volumes” failed to be loaded. means that some basic SlicerRT modules are not available because it cannot find some parts of the Volumes module. This usually means binary files (.dll on Windows, .so on linux), and if that happens the module does not work at all. So if you can switch to the Volumes module and use it too, then I’m out of ideas. Maybe the extension binaries are somehow not compatible with the Slicer ones.

One last thing that occurs to me is to ask you to try the very latest Slicer preview. Since we usually only fix issues in the latest version, it would help me see if the issue is still present, and if it is, I’ll try it on my Linux machine. I use Ubuntu 22.04. What is your distribution?

I actually also tried the latest Slicer preview (5.7.0), but the same issue is still there. I am using Ubuntu 20.04.6 LTS.

The module is working perfectly in the UI platform. I have no idea why that doesn’t work in the terminal

Other than using a command line, do you have tips or examples if I could script it in python? I actually only need the segmentation with certain names from the segment files.

Thank you so much for your input so far.

You could cannibalize the BatchProcessing python file and run it from the Python console if it’s urgent! For now what I can do is to try it myself on Linux (I’m usually on Windows so it will take a bit of time).

1 Like

Let me try to see if I can butcher it correctly, or find myself a windows computer to run the code. Tho if you have any update about running it in Linux, please kindly update us. Thank you very much!

Note that I am also unsure if it runs on Windows. I’ll given an update if I have one.

1 Like