'dicomwrite' produces random errors
Show older comments
I am trying to write a dicom file using the following code:
dicomwrite(dicomframe,currOutFile, dcminfo,'CreateMode', 'copy', 'WritePrivate', true);
This line is within a loop over a series of images.
dicomframe is a 2D image, currOutFile is my output file name, dcminfo is a struct containing the information for the header (generated with the dicominfo function).
When this line is executed, I sometimes get the following error messages:
Error using dicom_generate_uid>guid_to_uid (line 114)
Index of element to remove exceeds matrix dimensions.
Error in dicom_generate_uid (line 35)
uid = guid_to_uid(ipt_root, guid_32bit);
Error in dicomuid (line 14)
uid = dicom_generate_uid('instance');
Error in dicom_prep_SOPCommon (line 10)
metadata.(dicom_name_lookup('0008', '0018', dictionary)) = dicomuid;
Error in dicom_copy_IOD (line 30)
metadata = dicom_prep_SOPCommon(metadata, IOD_UID, dictionary);
Error in dicomwrite>write_message (line 268)
[attrs, status] = dicom_copy_IOD(X, map, ...
Error in dicomwrite (line 200)
[status, options] = write_message(X, filename, map, metadata, options);
By "sometimes", I mean that usually the code runs smoothly but for about one in every 200 runs (with the same code and the same input data), the error occurs, which makes processing large amounts of data quite tedious.
If anyone has an idea where this comes from and how it can be solved (preferably without trying to hack the guid_to_uid function), that would be very helpful. Thank you in advance.
Answers (0)
Categories
Find more on Read and Write Image Data from Files 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!