dicomwrite error in copying metadata: "Undefined function 'fieldnames' for input arguments of type 'uint8'."

1 view (last 30 days)
I'm trying to modify the metadata of a DICOM file and copy ALL the fields over to a new file. The default dicomwrite does not copy all the fields. I tried to use 'createmode','copy' and I get the following error: Undefined function 'fieldnames' for input arguments of type 'uint8'.
The DICOM dictionary has all the fields I need to copy over, so thats not the issue! Any help would be greatly appreciated. My code is below:
X=dicomread(filename); hdr.PatientName=subjid;
dicomwrite(X,'file_copy.dcm',hdr,'CreateMode','Copy');
%% Using dicomwrite(X,'file_copy.dcm',hdr) successfully copies, but leaves some fields out in the metadata.

Answers (0)

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!