How to use batch to convert .dcm to .mat files?

조회 수: 7 (최근 30일)
Ti Wu
Ti Wu 2020년 8월 17일
답변: Ti Wu 2020년 12월 25일
Morning everyone,
I am studying AGE relate to human macromolecules by qMT.
I am just a beginner and trying to run dcm2mat_batch to convert .dcm to .mat for getting T1 maps.
I got a code and open in Matlab but cannot output any .mat file.
Here is the code:
files = dir('*MR*');
filesOrder = {files.name};
D = filesOrder;
% % organizing files based on the last number
% reg = regexp(filesOrder,'\d+$','match','once');
% [~,idx] = sort(str2double(reg));
% D = filesOrder(idx);
for i = 1:length(D)
thisfile = D{i};
dicom = double(dicomread(thisfile));
% num2str to identify slice, change name of file for your preference
save([ 'VFA_DATA_FA_14_250ms_sl_' num2str(i) '.mat'], 'dicom');
end
I did try change
files = dir('*MR*');
to.
files = dir('*IM*');
But shows
Error in dcm2mat_batch (line 12)
dicom = double(dicomread(thisfile));
Does anyone can tell me which part I need to changed than this code will work?
Thank you
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 8월 18일
If MATLAB is able to do the dicomread, but is not able to do the save, then that means you do not have permission to write to the current directory.

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

채택된 답변

Ti Wu
Ti Wu 2020년 8월 23일
My problem is solved, I didn't install Image Processing Toolbox.
After I install Image Processing Toolbox, I can convert dcm2mat batch now.
Thank you for answering that, I am too primitive.
Ti WU
  댓글 수: 1
mohd akmal masud
mohd akmal masud 2020년 12월 25일
Hi Ti Wu, can you share with me how to convert dcm to mat ?

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

추가 답변 (1개)

Ti Wu
Ti Wu 2020년 12월 25일
Yes, I can share with you.
But to clarify the batch owner is not me.
I want to make a clarification.
This batch was made by San DIego State University Graduate Student "John Cameron White".
If he consider this is his patent and don't want to share to anyone.
I will not send it to you.
Give me few days to get his permission.
Then I will send the batch to you.
Use Matlab open it and select folder you want to change then run.
I believe you can make it.
Sincerely
TI WU

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by