Skip to content

Rely on copy_patient_and_study_information - #508

Merged
CPBridge merged 2 commits into
v0.29.0devfrom
bug/copy_patient_attributes
Nov 4, 2026
Merged

CPBridge merged 2 commits into
v0.29.0devfrom
bug/copy_patient_attributes

Conversation

@CPBridge

@CPBridge CPBridge commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Upon construction of most IOD classes (those that are derived from existing DICOM files), highdicom copies patient and study-level information from the source dataset. However, the implementation of this currently is duplicated: first the call to SOPClass.__init__() explicitly passes parameters (such as patient_id, study_time etc) copied from the source dataset, then the call to the copy_patient_and_study_information() also copies this information. This is both wasteful and complicated, and also leads to unwanted warnings and errors because the checks on the values passed to SOPClass.__init__() are more strict than the copy operation in copy_patient_and_study_information(), which is generally not desirable when copying information from an existing file. An example is the nuisance warning when providing a source file with an anonymized name that is a single word without a caret character.

This PR standardises on the use of the copy_patient_and_study_information() to simplify code and reduces nuisance warnings and errors. The exception is legacy converted images, where all logic is deferred to its own separate attribute copying mechanism that considers consistency between source instances.

@CPBridge CPBridge added the bug Something isn't working label Nov 4, 2026
@CPBridge
CPBridge merged commit 2979075 into v0.29.0dev Nov 4, 2026
12 checks passed
@CPBridge
CPBridge deleted the bug/copy_patient_attributes branch November 4, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant