study instance uid changes when using save_as

Skip to first unread message


Apr 20, 2020, 9:11:47 AM4/20/20
to pydicom

Disclaimer - I'm pretty new to dealing with DICOM data and am just getting familiar with the various tags.

I am involved in a project building an application for analysing medical imaging data (image processing) which is received directly from a hospital PACS. We use pydicom (thank you!) for storing DICOM files when received (we also use pynetdicom to handle receiving - thanks for that too!).

A series is received one file at a time and is stored using the file `SOPInstanceUID` as the filename. I have a test data set that I am working from that contains 176 images in the series. When using


to save each file in the series with the `SOPInstanceUID` I end up with files where the `StudyInstanceUID` no longer matches that in the original file and is different for each file in the series.

Can somebody explain what is going here please? Where did I go wrong?

Many thanks for your help in advance!



Darcy Mason

Apr 20, 2020, 12:42:03 PM4/20/20
to pydicom
Hi Dan,

Pydicom should never change the StudyInstanceUID unless it is done in user code.  Perhaps a pynetdicom example code was used that modified the StudyInstanceUID?  I'd suggest a global search through your code used for any occurrence of "StudyInstanceUID" to make sure.  

Also, do the new values start with the pydicom root UID '1.2.826.0.1.3680043.8.498.'?

Daniel Matthews

Apr 20, 2020, 2:44:31 PM4/20/20
Hi Darcy

Thanks for getting back to me so quickly. It was of course something in our code... I wouldn't have found it without your hint though so thank you!



You received this message because you are subscribed to the Google Groups "pydicom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages