Error in Dicomwrite simple matlab code

I have written a simple code for the Reading and Writing of DICOM images which are MRI images but there is an error in Dicomwrite. I have converted images from JPEG to DCM Images using MicroDicom software
X = dicomread('sub-02sub-02.dcm'); dicomwrite(X, 'sub-02sub-02-01.dcm' );
ERROR: Error using dicom_open_msg (line 31) Could not open "sub-02sub-02-01.dcm" for writing
Error in dicomwrite>write_stream (line 660) file = dicom_open_msg(file, 'w');
Error in dicomwrite>encodeAndWriteAttrs (line 325) msg = write_stream(destination, data_stream);
Error in dicomwrite>write_message (line 282) encodeAndWriteAttrs(attrs, options, filename, specificCharacterSet);
Error in dicomwrite (line 208) [status, options] = write_message(X, filename, map, metadata, options);
Error in mricode12 (line 2) dicomwrite(X, 'sub-02sub-02-01.dcm' );
Need your kind suggestions where is the problem I have searched but could not found any solution.

댓글 수: 7

Walter Roberson
Walter Roberson 2018년 9월 3일
Do you have write access to the directory that you are cd to?
abdul hanan taqi
abdul hanan taqi 2018년 9월 3일
Yes I think so how can i check it?
abdul hanan taqi
abdul hanan taqi 2018년 9월 3일
I ran matlab with administrative privileges error is gone but there is no output
Walter Roberson
Walter Roberson 2018년 9월 3일
What directory are you cd'd to ?
If you are under the "C:/program files" then MS Windows will not normally permit you to write there.
abdul hanan taqi
abdul hanan taqi 2018년 9월 3일
Thanks problem solved
jingxu xu
jingxu xu 2018년 12월 27일
how solved?
Walter Roberson
Walter Roberson 2018년 12월 27일
cd to a different directory before doing the dicomwrite(), or else give a full pathname when you dicomwrite()

댓글을 달려면 로그인하십시오.

답변 (0개)

제품

릴리스

R2017a

질문:

2018년 9월 3일

댓글:

2018년 12월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by