MATLAB Answers

Why is dicomanon giving this error?

12 views (last 30 days)
Qinwan Rabbani
Qinwan Rabbani on 10 Jun 2016
Commented: Nasser Hosseini on 11 Dec 2017
I am trying to use dicomanon to anonymize some files. However, with a particular files series, I am getting this error:
Error using dicom_add_attr>validate_data (line 118)
Attribute (0008,9123) has wrong data type.
Error in dicom_add_attr (line 103)
attr_str(pos).Data = validate_data(data, attr_str(pos), specificCharacterSet);
Error in dicom_convert_meta_to_attr (line 39)
attr = dicom_add_attr([], tag(1), tag(2), dictionary, specificCharacterSet, data, VR);
Error in dicom_convert_meta_to_attr>encode_item (line 151)
new_attr = dicom_convert_meta_to_attr(attr_names{p}, item_struct, dictionary, txfr, specificCharacterSet);
Error in dicom_convert_meta_to_attr>encode_SQ (line 125)
data = encode_item(SQ_struct.(items{p}), dictionary, txfr, specificCharacterSet);
Error in dicom_convert_meta_to_attr (line 26)
data = encode_SQ(metadata.(attr_name), dictionary, txfr, specificCharacterSet);
Error in dicom_copy_IOD (line 49)
new_attr = dicom_convert_meta_to_attr(attr_name, metadata, dictionary, options.txfr, specificCharacterSet);
Error in dicomwrite>write_message (line 277)
[attrs, status] = dicom_copy_IOD(X, map, ...
Error in dicomwrite (line 208)
[status, options] = write_message(X, filename, map, metadata, options);
Error in dicomanon (line 157)
dicomwrite(X, filename_out, metadata, ...
I've anonymized other DICOM files (not from the same series) just fine. I have a feeling that there might be a problem in the headers, but I'm not sure. I see that the base error is technically in validating the data. I tried turning of 'UseVRHeuristic,' but that didn't fix it. Does anyone know who to fix this error?
Thanks in advance.

  0 Comments

Sign in to comment.

Answers (1)

Nasser Hosseini
Nasser Hosseini on 8 Dec 2017
Hi Qinwan! I have the same issue with other types of attribute (0028,0060 for instance). Could you find any solution? /Nasser Hosseini

  2 Comments

Qinwan Rabbani
Qinwan Rabbani on 9 Dec 2017
I ended up just manually anonymizing sensitive fields using dicomwrite to replace their values in the header. Hope this helps!
Nasser Hosseini
Nasser Hosseini on 11 Dec 2017
I'm thinking about doing the same, but I'll report this to Mathworks as well. There might actually be a bug in dicomanon!

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!