Read DICOM images from folder and save them into .mat file?

6 ビュー (過去 30 日間)
Erfaneh
Erfaneh 2014 年 10 月 14 日
コメント済み: Geoff Hayes 2014 年 10 月 16 日
I want to read DICOM images from folder in directory and then save them into mat file in output path. Can any one help me?

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 10 月 15 日
Assuming you have the Image Processing Toolbox, use dicomread to read the data from file, and then save to save the data to a mat file. Something like
inputFilename = 'myDicomFile.dcm';
inputFolder = '/Users/somePath/dicomFiles';
% read the file
[X,map] = dicomread(fullfile(inputFolder,inputFilename));
% now write to a mat file
outputFilename = 'myMatFile.mat';
outputFolder = '/Users/somePath/matFiles';
save(fullfile(outputFolder,outputFilename),'X','map');
If you have several files to read and write, you can choose an appropriate outputFilename for each.
  2 件のコメント
Erfaneh
Erfaneh 2014 年 10 月 16 日
Thanks for your reply. I have 500 DICOM images in inputfolder and I want to save all of them in one file. With your guidance, can I do this job with loop? I have a function for this but It does not save all of them.
Geoff Hayes
Geoff Hayes 2014 年 10 月 16 日
Yes, a loop would do. Why does your function not save all of them?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by