How to use batch to convert .dcm to .mat files?
6 ビュー (過去 30 日間)
古いコメントを表示
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
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.
採用された回答
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!