Project

General

Profile

Actions

Bug #3092

open

Individual Curation: Pyradiomics

Added by Andrew Miller 2 months ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
Start date:
30/05/2026
Due date:
% Done:

0%

Estimated time:

Description

After opening a patient, trying to run Pyradiomics results in a dialogue box for 'create nrrd file' and then the following error message:

Error calling Python override of QThread::run(): <class 'KeyError'> 0 <traceback object at 0x77c136ae2140>
Traceback (most recent call last):
File "/home/andrewm/OnkoDICOM/src/View/PyradiProgressBar.py", line 38, in run
ct_file = dcmread(self.filepaths0, force=True)
~~~~~~~~~~~~^^^
KeyError: 0
Exception ignored in atexit callback: <cyfunction _unregister_py_extension_types at 0x77c2d5b51560>
Traceback (most recent call last):
File "pyarrow/types.pxi", line 6113, in pyarrow.lib._unregister_py_extension_types
File "pyarrow/types.pxi", line 2357, in pyarrow.lib.unregister_extension_type
File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowKeyError: No type extension with name arrow.py_extension_type found
Segmentation fault

OnkoDICOM does not crash.

Actions #1

Updated by Andrew Miller 2 months ago

  • Assignee set to Andrew Miller
Actions #2

Updated by Andrew Miller 2 months ago

Please Note

The Pyradiomics function PyRad2PyRadSR in Batch Processing does work.
The Pyradiomics export function PyRadSR2CSV in Batch Processing also works.

Actions #3

Updated by ashley maher about 2 months ago

When running Pyradiomics radiomics feature extraction interactively (rather than in batch mode), the software crashed with an internal error if the loaded dataset lacked CT image slices. No results were produced.

The software now correctly identifies the patient from whichever DICOM data is available (CT images, RT Structure Set, or any other loaded dataset), aligning with the logic already used by the working batch processing path. The Pyradiomics calculations themselves are unchanged — only the patient identification step was corrected.

Actions #4

Updated by Andrew Miller about 2 months ago

andrewm@andrew-nucboxm7ultra:~$ cd OnkoDICOM/
andrewm@andrew-nucboxm7ultra:~/OnkoDICOM$ source .venv/bin/activate
(.venv) andrewm@andrew-nucboxm7ultra:~/OnkoDICOM$ git checkout deps-safe-batch-20260214
Already on 'deps-safe-batch-20260214'
Your branch is up-to-date with 'origin/deps-safe-batch-20260214'.
(.venv) andrewm@andrew-nucboxm7ultra:~/OnkoDICOM$ python main.py
PDPI: 87.65603948940262
Multithreading with maximum 16 threads
2026-06-19 15:13:23,931 - WARNING - The PN component length (65) exceeds the maximum allowed length of 64.
Error calling Python override of QThread::run(): <class 'KeyError'> 'rtss' <traceback object at 0x7667ba358280>
Traceback (most recent call last):
File "/home/andrewm/OnkoDICOM/src/View/PyradiProgressBar.py", line 38, in run
rtss_path = self.filepaths['rtss']
~~~~~~~~~~~~^^^^^^^^
KeyError: 'rtss'


This is the output when I run the Export PyRadiomics command from the folder with down arrow icon at the top right. When I clear the nrrd advisory box, the program is still running.

Actions #5

Updated by Andrew Miller about 2 months ago

When running the BCAA910312C34903D1EBB87F16B383E2 dataset (see Files), attempting to generate PyRadionics prouced the following error messgae AND termination:

Error calling Python override of QThread::run(): <class 'KeyError'> 'rtss' <traceback object at 0x7667c0c26580>
Traceback (most recent call last):
File "/home/andrewm/OnkoDICOM/src/View/PyradiProgressBar.py", line 38, in run
rtss_path = self.filepaths['rtss']
~~~~~~~~~~~~^^^^^^^^
KeyError: 'rtss'
QThread: Destroyed while thread is still running
Aborted (core dumped) python main.py

Actions #6

Updated by ashley maher about 1 month ago

Working with AI, it wrote a full proposal for you. Let me know what you want to do.

  1. Proposal: PyRadiomics Export Behaviour When No RT Structure Set Is Present

Date: 2026-06-22
Raised by: Development team
Requires approval from: Clinical lead / Doctor
Status: Awaiting clinical decision


  1. What happened

When a doctor opens a patient dataset that contains no RT Structure Set (RTSS) file
and then selects File > Export > Export Pyradiomics, the application crashes silently.
The progress bar opens and does not move. No error is shown to the user.
The crash is only visible in the developer terminal:

```
KeyError: 'rtss'
File "src/View/PyradiProgressBar.py", line 38, in run
rtss_path = self.filepaths['rtss']
```


  1. Why this matters clinically

PyRadiomics extracts quantitative imaging features from defined regions of interest
(ROIs)
. Those ROIs are stored in the RTSS file. Without an RTSS, there are no ROI
contours to analyse.

This is not an edge case. The DICOM standard does not require an RTSS to be present
in a patient dataset. Real-world clinical data commonly arrives without one — for example:

- Diagnostic CT studies with no treatment planning performed
- Pre-contouring datasets awaiting a radiation oncologist's review
- Research datasets where contouring is done in a separate system

The test data already reflects this reality. This will happen in normal clinical use.


  1. The technical fix is straightforward — the clinical question is not

From a software perspective, the simplest fix is to show an error message and stop.
However, this decision has clinical implications that the development team cannot make
unilaterally. The behaviour chosen here will shape what research output is valid.


  1. Options
  1. Option A — Block with a clear error message

When the doctor clicks Export Pyradiomics and no RTSS is present, show a dialog:

"No RT Structure Set was found for this patient. PyRadiomics requires ROI contours
to extract features from. Please load or create an RTSS before exporting."

The export does not proceed.

Pros: Simple. Prevents meaningless output. Clear to the user.
Cons: Does not guide the doctor toward a solution.
Clinical implication: Safe. No data is produced without ROI contours.


  1. Option B — Grey out the menu item when no RTSS is loaded

Disable Export Pyradiomics in the menu whenever no RTSS is present in the
loaded dataset. Add a tooltip explaining why it is unavailable.

Pros: Prevents the problem before it starts. Standard UI pattern.
Cons: The doctor may not understand why the option is unavailable.
Clinical implication: Safe. Same as Option A but communicated earlier in the workflow.


  1. Option C — Run PyRadiomics on the full CT volume (no ROI mask)

Ask the doctor whether they wish to proceed without an RTSS, running PyRadiomics
across the entire CT volume with no region mask applied.

Pros: Does not block the workflow.
Cons: PyRadiomics output on a whole CT volume has a fundamentally different
clinical meaning from output on a defined ROI. The two should not be mixed in a
research dataset without clear labelling.
Clinical implication: HIGH RISK of producing ambiguous or misleading research data
unless the doctor explicitly understands and intends this.


  1. Option D — Prompt the doctor to draw contours first

Show a message directing the doctor to use the contouring tools to define ROIs,
then retry the export.

Pros: Guides the user toward the correct workflow.
Cons: Requires the contouring workflow to be accessible and functional in the
current version. Adds steps for the doctor.
Clinical implication: Correct workflow. Output would be clinically grounded.


  1. Development team recommendation

Option B as the primary safeguard, with Option A as a fallback.

Disable the menu item when no RTSS is present (Option B) so the problem is
communicated before the doctor opens the export screen. Keep an in-code guard
(Option A) as a safety net in case the RTSS is removed or unloaded after the
menu is already enabled.

Option C is not recommended without explicit clinical direction, as it risks
producing research output that cannot be compared with RTSS-based output.


  1. Questions for the clinical lead

1. Is there any scenario in your workflow where running PyRadiomics without an
RTSS is clinically intended or valid?

2. When a dataset arrives without an RTSS, should PyRadiomics simply be
unavailable until contours are defined?

3. If the doctor loads a CT-only dataset, should the application guide them to
create contours (Option D), or simply inform them the feature is unavailable
(Option A/B)?

4. Should the behaviour differ between single-patient export and batch processing?


  1. Next step

Please review the options above and advise which behaviour is clinically appropriate.
The development team will implement once approval is received.

Actions #7

Updated by Andrew Miller about 1 month ago

Questions for the technical lead

1. when loading a dataset with an rtss.dcm file present, is that rtss.dcm file recognised as being present? [Note: Each of the files provided in Redmine OnkoDICOM.2026/Files has a rtss.dcm file present.]

Questions for the clinical lead

1. Is there any scenario in your workflow where running PyRadiomics without an
RTSS is clinically intended or valid?

NO

2. When a dataset arrives without an RTSS, should PyRadiomics simply be
unavailable until contours are defined?

YES, in fact if a dataset without an RTSS arrives, opening it has OnkoDICOM create a temporary, empty RTSS file that needs to be saved (autoprompt occurs) after something has been added to it (won't save an empty rtss file).

3. If the doctor loads a CT-only dataset, should the application guide them to
create contours (Option D), or simply inform them the feature is unavailable
(Option A/B)?

MAYBE, when a dataset without an RTSS is opened, the ROI list will be empty. It is my presumption that if they are using OnkoDICOM, they will know this to be the case.

4. Should the behaviour differ between single-patient export and batch processing?

NO, in neither case should an dataset devoid of a rtss be running PyRadiomics, or even have the option to.


Interestingly, when I run PyRadiomics without a RTSS, I get the same error message.

Actions

Also available in: Atom PDF