# DICOMProcesses.py error

**URL:** https://discourse.slicer.org/t/dicomprocesses-py-error/36963
**Category:** Development
**Tags:** segmentation, python, segmentations, segment-editor
**Created:** [June 23, 2024, 6:48am UTC](https://discourse.slicer.org/t/dicomprocesses-py-error/36963 "2024-06-23T06:48:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jennieyy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jennieyy/32/77066_2.png) [@Jennieyy](https://discourse.slicer.org/u/Jennieyy)
#### Post date: [June 23, 2024, 6:48am UTC](https://discourse.slicer.org/t/dicomprocesses-py-error/36963/1 "2024-06-23T06:48:33Z")

</div>

Operating system:Windows11  
Slicer version:5.6  
Expected behavior: run a python script using 3D slicer  
Actual behavior: the 3D slicer source code give me a error

I run a python script that creates a valid dataset from the source data found on TCIA using 3D Slicer. [VS\_Seg/preprocessing/data\_conversion.py at master · KCL-BMEIS/VS\_Seg · GitHub](https://github.com/KCL-BMEIS/VS_Seg/blob/master/preprocessing/data_conversion.py)  
but raise an error:  
AttributeError: module ‘qt’ has no attribute ‘QProcess’

in Slicer\_5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\DICOMProcesses.py

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [June 23, 2024, 5:00pm UTC](https://discourse.slicer.org/t/dicomprocesses-py-error/36963/2 "2024-06-23T17:00:50Z")

</div>

Please provide the exact steps that lead to the issue you are having. Ideally, describe how to reproduce the issue with publicly available data.

---

<div class="post-metadata">

### Author: ![Jennieyy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jennieyy/32/77066_2.png) [@Jennieyy](https://discourse.slicer.org/u/Jennieyy)
#### Post date: [June 24, 2024, 2:51am UTC](https://discourse.slicer.org/t/dicomprocesses-py-error/36963/3 "2024-06-24T02:51:17Z")

</div>

Firstly, I open the python script as a Pycharm Project, and I change the Python Interpreter (System Interpreter) to the D:/Slicer5.6.2/bin/PythonSlicer.exe, the path in 3D Slicer archive.  
Secondly, I run the python script aforementioned.  
Then, I encounter the error

```auto
"D:\Slicer 5.6.2\bin\PythonSlicer.exe" D:\Dataset_preprocess\TCIA_VS_SEG\data_conversion.py -i D:/Dataset/VS_SEG/ -o D:/Dataset/VS_SEG1/ 
No module named 'logic'
Traceback (most recent call last):
  File "D:\Dataset_preprocess\TCIA_VS_SEG\data_conversion.py", line 48, in <module>
    from DICOMLib import DICOMUtils
  File "D:\Slicer 5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\ __init__.py", line 1, in <module>
    from .DICOMProcesses import *
  File "D:\Slicer 5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\DICOMProcesses.py", line 38, in <module>
    class DICOMProcess:
  File "D:\Slicer 5.6.2\lib\Slicer-5.6\qt-scripted-modules\DICOMLib\DICOMProcesses.py", line 84, in DICOMProcess
    def start(self, cmd: str, args: list[str]) -> qt.QProcess:
AttributeError: module 'qt' has no attribute 'QProcess'

Process finished with exit code 1

```

---

<div class="post-metadata">

### Author: ![Jennieyy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jennieyy/32/77066_2.png) [@Jennieyy](https://discourse.slicer.org/u/Jennieyy)
#### Post date: [June 24, 2024, 3:15am UTC](https://discourse.slicer.org/t/dicomprocesses-py-error/36963/4 "2024-06-24T03:15:19Z")

</div>

I use the public dataset from TCIA. The raw data includes  
every patient’s **T1 and T2 DICOM files** ,  
**RT\_Structure.dcm**  **RT\_Dose.dcm**  **RT\_Plan.dcm** and **metadata.csv**  
and tumor segmentation label **contour.json**  
and T1toT2 and T2toT1 registration matrices **inv\_T1\_LPS\_to\_T2\_LPS.tfm** or **inv\_T2\_LPS\_to\_T1\_LPS.tfm**  
In proprecessing raw data, Firstly, **TCIA\_data\_convert\_into\_convenient\_folder\_structure.py** makes the raw data to a convenient folder structure which puts the every patient’s T1 folder and T2 folder  
Secondly, **data\_conversion.py** converts the DICOM images and contour.json to NIFTI using the 3D Slicer. The error happens in this step.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [June 24, 2024, 12:42pm UTC](https://discourse.slicer.org/t/dicomprocesses-py-error/36963/5 "2024-06-24T12:42:07Z")

</div>

PythonSlicer doesn’t have the application context needed to run all the DICOM options. See the warning here:

[https://slicer.readthedocs.io/en/latest/developer\_guide/python\_faq.html#what-is-the-pythonslicer-executable](https://slicer.readthedocs.io/en/latest/developer_guide/python_faq.html#what-is-the-pythonslicer-executable)

You probably can just run the regular Slicer application instead.

---

<div class="post-metadata">

### Author: ![Jennieyy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jennieyy/32/77066_2.png) [@Jennieyy](https://discourse.slicer.org/u/Jennieyy)
#### Post date: [June 24, 2024, 2:04pm UTC](https://discourse.slicer.org/t/dicomprocesses-py-error/36963/6 "2024-06-24T14:04:14Z")

</div>

Thanks a lot!! I run the data\_conversion.py in the Python Console 3D Slicer application. It works!! Thanks again.
