CTK
CTK copied to clipboard
DICOM tag string handling issues
Reference commits and discussions
- Discourse thread
- https://github.com/commontk/CTK/commit/84187713304e4ed5a457ee9758de1af4a22d8dbd
- https://github.com/commontk/CTK/pull/1154
- https://github.com/commontk/CTK/pull/1203
Description
The current DICOM tag string handling implementation may have sneaky errors due to the storage of DICOM tags as strings. This can lead to various manifestations of bugs, especially when comparing tag strings. While storing these tags as int
could address these issues, the codebase might need to support private tags in the future, necessitating a string representation.
Proposed Solution
Given these considerations, we need to:
-
String Handling:
- Keep the tag representation as a string to support potential private tags.
- Ensure consistent conversion methods across the codebase to avoid string comparison issues, such as capitalization and zero-padding.
- Add normalization for tag strings to ensure consistency in tagcache methods.
-
Documentation:
- Improve documentation for tagcache to describe how tag strings are formatted.
- Update
dicomTagToString
method documentation to clarify string formatting expectations (and just have only one static method in the ctkDICOMDatabase class). - Include thorough documentation in
get/set
methods describing input formatting and output formats.
-
Unit Testing:
- Create robust unit tests for DICOM tag handling to prevent regressions.
Reference Information
A regression related to https://github.com/commontk/CTK/pull/1154 was identified in this Discourse thread and a simple fix was proposed in https://github.com/commontk/CTK/pull/1203.