How to solve the error?
3 次查看(过去 30 天)
显示 更早的评论
clc;
clear all;
close all;
I = dicomread('C:\Users\Click Me\Desktop\NIELIT\images output\try.dcm');
info = dicominfo('C:\Users\Click Me\Desktop\NIELIT\images output\try.dcm');
imshow(I,'DisplayRange',[]);
II = imread('rice.png');
info.PatientID = 'rice';
L = dicomwrite(I,'rice.dcm',info);
I was trying to insert rice.png image into dicom file. But I got this error:
Error using dicom_open_msg (line 31)
Could not open "rice.dcm" for writing
Error in dicomwrite>write_stream (line 659)
file = dicom_open_msg(file, 'w');
Error in dicomwrite>encodeAndWriteAttrs (line 324)
msg = write_stream(destination, data_stream);
Error in dicomwrite>write_message (line 281)
encodeAndWriteAttrs(attrs, options, filename);
Error in dicomwrite (line 208)
[status, options] = write_message(X, filename, map, metadata,
options);
Error in truuu (line 10)
L = dicomwrite(I,'rice.dcm',info);
How to solve this? How to insert a png image into a dicom file?
0 个评论
采纳的回答
Jan
2018-3-8
编辑:Jan
2018-3-8
Could not open "rice.dcm" for writing
This can mean, that the file is write-protected or you do not have the permissions to write in this folder. Check this either in the file explorer of the operating system or by the fileattrib command.
This tries to create the file in the current folder:
dicomwrite(I,'rice.dcm',info)
Better define the folder to write to explicitly. fullfile might be useful here.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!