ImagingDataCommons / highdicom

High-level DICOM abstractions for the Python programming language
https://highdicom.readthedocs.io
MIT License
164 stars 34 forks source link

Use deepcopy for CodedConcept.from_dataset() #205

Closed CPBridge closed 1 year ago

CPBridge commented 1 year ago

This is a fix for #203 , @pieper

The issue was because CodedConcept.from_dataset() manually created a new instance of the class, which means that any attributes of the underlying dataset not supported by the CodedConcept class are lost.

I also had to tweak the __eq__ to defer to the superclass implementation as a fallback as this was creating bizarre bugs when trying to serialize the result. Pydicom-level functionality needs to be able to determine equality of a CodedConcept to any other pydicom.Dataset using its own rules.

Might want to do a patch release for this: potentially a nasty one...

pieper commented 1 year ago

Thanks @CPBridge !