Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string index out of range error when using the Windows executable #119

Closed
chielmi opened this issue Aug 8, 2024 · 8 comments · Fixed by #120
Closed

string index out of range error when using the Windows executable #119

chielmi opened this issue Aug 8, 2024 · 8 comments · Fixed by #120

Comments

@chielmi
Copy link

chielmi commented Aug 8, 2024

Let me start with saying thanks for creating the packaged Windows executables version 0.6.1 for dump_dcm_info.exe and validate_iods.exe!

Unfortunately they don't work for me. When running these I get an unhandled exception when docbook files are created for the first run. I can see the files being downloaded to the docbook directory, so it doesn't seem to be a permission issue:

.\validate_iods.exe -src .\docbook .\testfile.dcm
Creating JSON excerpts from docbook files...
Traceback (most recent call last):
  File "dicom_validator\validate_iods.py", line 80, in <module>
  File "dicom_validator\validate_iods.py", line 71, in main
  File "dicom_validator\spec_reader\edition_reader.py", line 244, in get_revision
  File "dicom_validator\spec_reader\edition_reader.py", line 200, in create_json_files
  File "dicom_validator\spec_reader\part3_reader.py", line 85, in iod_descriptions
  File "dicom_validator\spec_reader\part3_reader.py", line 88, in <dictcomp>
  File "dicom_validator\spec_reader\part3_reader.py", line 70, in iod_description
  File "dicom_validator\spec_reader\part3_reader.py", line 176, in _parse_iod_node
  File "dicom_validator\spec_reader\part3_reader.py", line 376, in _get_iod_modules
  File "dicom_validator\spec_reader\part3_reader.py", line 357, in _collect_modules
  File "dicom_validator\spec_reader\part3_reader.py", line 108, in module_description
  File "dicom_validator\spec_reader\part3_reader.py", line 204, in _parse_module_description
  File "dicom_validator\spec_reader\part3_reader.py", line 239, in _handle_included_attributes
  File "dicom_validator\spec_reader\part3_reader.py", line 200, in _parse_module_description
  File "dicom_validator\spec_reader\part3_reader.py", line 269, in _handle_regular_attribute
  File "dicom_validator\spec_reader\condition_parser.py", line 109, in parse
  File "dicom_validator\spec_reader\condition_parser.py", line 392, in _parse_tag_expressions
  File "dicom_validator\spec_reader\condition_parser.py", line 141, in _parse_tag_expression
  File "dicom_validator\spec_reader\condition_parser.py", line 303, in _parse_tag_values
  File "dicom_validator\spec_reader\condition_parser.py", line 353, in _get_const_value
IndexError: string index out of range
[17072] Failed to execute script 'validate_iods' due to unhandled exception!

Any suggestion on what I'm doing wrong here?

@mrbean-bremen
Copy link
Member

Thanks for the report!
This sounds more like a bug in the condition parser itself. I actually can see that there is a check missing.
It would be helpful if you could provide the test file (or an anonymized version that still shows this error) to understand when this error occurs.

@chielmi
Copy link
Author

chielmi commented Aug 8, 2024

Thanks for the quick reply! I get this error for any DICOM file, even for the ones that I know don't contain any issues. Also I have the exact same error when I run validate_iods.exe in an Ubuntu VM.

Perhaps it's an issue in the latest version?

@mrbean-bremen
Copy link
Member

Perhaps it's an issue in the latest version?

Could be - would be a bit awkward if no test did catch this... Can you please check with the previous version 0.6.0 (it also has the executable)? I will certainly have a look later today.

@chielmi
Copy link
Author

chielmi commented Aug 8, 2024

You are spot on! I can confirm that 0.6.0 works fine, I only have the issue with 0.6.1!

@mrbean-bremen
Copy link
Member

Right - I just tried it locally, and it is indeed a regression in 0.6.1. Sorry for that...
You can use version 0.6.0 until I fix that.

@chielmi
Copy link
Author

chielmi commented Aug 8, 2024

All clear, indeed I'll use the prior version for now.
Thanks again for the fast confirmation!

mrbean-bremen added a commit to mrbean-bremen/dicom-validator that referenced this issue Aug 9, 2024
- prevents an exception during parsing
- the root cause is a problem with the parser which creates incorrect output,
 the reason is still unknown
- fixes pydicom#119
mrbean-bremen added a commit that referenced this issue Aug 9, 2024
- prevents an exception during parsing
- the root cause is a problem with the parser which creates incorrect output,
 the reason is still unknown
- fixes #119
@mrbean-bremen
Copy link
Member

A new patch release with a fix is out.

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Aug 10, 2024

For my own reference: this was not caught because the tests had been run with the 2023c DICOM standard, while the problem only occurs since 2024a. In a few conditions, a link had been introduced into the condition text instead of the previous text, and as the link is removed during processing, the resulting (incomplete) sentence led to the error due to a change in parsing in 0.6.0.
We shall always use the latest standard for testing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants