I am trying to create a new DICOM file (instance) from an existing one, where I change the pixel data.
I know that I need to change some of the UIDs while replacing pixel data. Currently I am generating SOPInstanceUID, MediaStorageSOPInstanceUID and ReferencedSOPInstanceUID wherever applicable.
Are there some other UIDs that needs to be changed to get a valid DICOM file? It will be helpful if you can point me where to look for this in the standard.
Following is a quote from specifications discussing about uniqueness of UIDs:
If you are changing pixel data (changing compression (transfer syntax) to lossy or overwriting all together), you must change
SOP Instance UID (0008,0018).About
Media Storage SOP Instance UID (0002,0003), as you notice, it belongs to group 2 i.e. File Meta Information header. These tags only present when you serialize the instance to hard disk. This should have same value as that ofSOP Instance UID (0008,0018). So, if you change one, you should also change other. Please refer to this answer and following part in specifications:The
Referenced SOP Instance UID (0008,1155)is reference to other instance. It depends whether you need to change this or not based on your case; generally should not be needed. Please refer to this answer for more details about Referenced SOP Instance UID.The
Transfer Syntax UID (0002,0010)needs to be changed according to the new Transfer Syntax you applied. While overwriting the pixel data, if you are changing it, change the UID accordingly.The
SOP Class UID (0008,0016)andMedia Storage SOP Class UID (0002,0002)define your SOP Class. By just changing pixel data, you are not changing it. So you do not need to change this UID.The
Implementation Class UID (0002,0012)is associated with creator. No need to change.Decision about
Study Instance UID (0020,000D)andSeries Instance UID (0020,000E)depends on your use case. It depends on how you want user to handle your newly created instance. Say, while creating report for Study, many implementations do not change Study IUID but do create new Series (i.e. new Series IUID).Please refer to following answers for more details:
https://stackoverflow.com/a/46316162/5779732
https://stackoverflow.com/a/53775161/5779732