Skip to content

SR content items with value type WAVEFORM cannot be decoded #472

Closed

Description

@DG47

highdicom.sr.WaveformContentItem can be constructed, but WAVEFORM items cannot be read back, and the referenced_waveform_channels property never returns the stored channels.

Minimal reproduction:

from highdicom.sr import CodedConcept, ContentSequence, WaveformContentItem

item = WaveformContentItem(
    name=CodedConcept('260753009', 'SCT', 'Source'),
    referenced_sop_class_uid='1.2.840.10008.5.1.4.1.1.9.1.1',  # 12-lead ECG
    referenced_sop_instance_uid='1.2.3.4',
    referenced_waveform_channels=[(1, 1), (1, 2)],
    relationship_type='CONTAINS',
)

print(item.ReferencedSOPSequence[0].ReferencedWaveformChannels)  # [1, 1, 1, 2]
print(item.referenced_waveform_channels)  # None

WaveformContentItem.from_dataset(item)
# ValueError: Dataset is not an SR Content Item with value type "IMAGE"

ContentSequence.from_sequence([item])
# KeyError: <ValueTypeValues.WAVEFORM: 'WAVEFORM'>

Expected:

  • referenced_waveform_channels returns [(1, 1), (1, 2)].
  • WaveformContentItem.from_dataset() accepts a dataset with Value Type WAVEFORM (and rejects one with Value Type IMAGE; at the moment it does the reverse).
  • ContentSequence.from_sequence() decodes WAVEFORM items into WaveformContentItem instances.

Actual: as shown in the comments above. Because ContentSequence.from_sequence() is used when reading documents, any SR or Key Object Selection document whose content tree contains a WAVEFORM item (for example a KOS that selects an ECG, which TID 2010 encodes with Value Type WAVEFORM) fails to load with srread(), KeyObjectSelectionDocument.from_dataset(), etc. KeyObjectSelection.get_references() already lists WAVEFORM as a supported value type, but it cannot get that far.

Environment: highdicom master (0.28.2, 847fea5), pydicom 3.0.2, numpy 2.5.4, Python 3.12, macOS.

Activity

  1. CPBridge commented on Oct 21, 2026

    @CPBridge
    Collaborator

    Oh dear! Certainly an unfortunate one. I guess we can conclude that in the 6 years since this library was released, no-one has actually tried to read SRs/KOs with waveform items before (myself included)! Your adventurousness is commended

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions