Dicomwrite - not change SOPInstanceUID
4 views (last 30 days)
Show older comments
Hi folks,
I'm trying to rewrite a dicom file, deleting some fields prior to writing the new file. The problem I found (Matlab R2010a) is that it changes the field 'SOPInstanceUID'...maybe because I use the CreateCopy option. To solve that, each time I run the code, I modify the funciton dicom_prep_SOPCommon following these steps:
- If the RTStruct file has 2 items, delete the second or check with one matches the other files. Also record the SOPInstanceUID and SOPClassUID fields of the file.
- Go to the following dir C:\Program Files (x86)\MATLAB\R2010a\toolbox
- Search the function dicom_prep_SOPCommon, and modify the following line metadata.(dicom_name_lookup('0008', '0018')) = dicomuid;(or comment it), changing it to metadata.(dicom_name_lookup('0008', '0018')) = ‘SOPInstanceUID from the file-manual input’;
- Close Matlab and open it again to be sure that this will work to create the files.
- Use writedicom to create a new structure file using the modified header for the RTReferenceFrame, the new file must have just one ReferencedFrameUID and the SOPInstanceUID should match the original one thanks to step 3. If this works, repeat steps for any other RTStruct that appear in the idx_struct.
- To finish, rewrite the dicom_prep_SOPCommon with the original line.
We have just started to use Matlab R2020b and I'm reviewing my codes so I was wondering if there is any command to avoid that. I'd like to deploy the code so any user could run the program without having to modify the function. I need the same SOPInstanceUID because that field is called by others to find the right file (RTPlan, RTDose,...).
Any comments or ideas are welcome,
Thanks!
0 Comments
Answers (0)
See Also
Categories
Find more on DICOM Format in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!