File Exchange

image thumbnail

Dicom Toolbox

version (7.88 KB) by Dirk-Jan Kroon
Search/Read/Write dicom folders and dicom volumes


Updated 17 May 2011

View Version History

View License

Toolbox with Dicom Search/Read/Write tools ...

- dicom_folder_info, search a folder and sub-folders for all dicom files and gives a structure back with the information of all datasets present in that folder.

- dicom_read_volume, read a dicom volume, it doesn't matter if the dicom volume consist of a single file or multiple files, or is in a sub-folder

- dicom_write_volume, write a dicom volume

- SiemensInfo, reads the MRI and DTI information from the Siemens Private tag 0029 1020

Example Dicom_Folder_info:


datasets = 1x7 struct array with fields

datasets(1) =
Filenames: {24x1 cell}
Sizes: [512 512 24]
Scales: [0.3320 0.3320 4.4992]
DicomInfo: [1x1 struct]
SeriesInstanceUID: '1.2.840.113619.2.176.2025'
SeriesDescription: 'AX. FSE PD'
SeriesDate: '20070101'
SeriesTime: '120000.000000'
Modality: 'MR'

datasets(1).Filenames =

Cite As

Dirk-Jan Kroon (2021). Dicom Toolbox (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (17)


Is it possible to show the Dicominfo of all the ".dcm" files in a folder? When I try it, it only shows the Dicominfo for the first dcm file. Wish there was more detailed instruction.

Ali Aghaeifar

'SiemensInfo' function was very helpful for me. Thanks

lily liu

Thank you very much,It`s wonderfull

Daniel Gillett

Excellent toolbox.
I think there's a typo in function dicom_read_header it's says dicom_read_volume in the code.

neenu prakash

Thanks. Very helpful. But I am getting an error as recurssion limit reached 500. It can crash your system.

hang phan

thank you


Thank you so much!!


Thanks. Very helpful but, it sorts the dicom files strangely, e.g., IMG0, IMG11, 22, 33, 44, 47, 49, 50, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, ....

shari shari


shari shari



Great Submission! However, I also can't get the SiemensInfo to work. This creates problems when trying to write the Dicom files. Has anyone figured out how to fix this yet? I get errors:
Attempted to access name(0); index must be a positive integer or logical.
Error in SiemensInfo (line 21)
while(name(end)==' '); name=name(1:end-1); end

Matt J

Working pretty well, so far. Thanks.

I was a bit tripped up at the beginning on the difference between dicom_folder_info and dicom_read_header, since both functions can accept a folder name as input. It could be worthwhile adding a word of emphasis in the documentation about the differences between the two...

Georg Stillfried

This submission seems to require the image processing toolbox. At least it uses "dicominfo", which AFAIK is part of the image processing toolbox. If that's the case, it would be nice if it was indicated on this page.


Thanks, the dicom_write_volume function came in handy.


Very helpful.
Thank you.
Unfortunately the SiemensInfo seems not to work for me. At least not for projection data in the AX environment.

Andrew Davis

I guess it chokes on GE data?

>> series27 = dicom_folder_info('s27-T1-map-TR50_3acqs');
>> vol = dicom_read_volume(series27);
??? Reference to non-existent field 'ImageType'.

Error in ==> dicom_read_volume at 20

Stanislas Rapacchi

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: dicomfolder

Community Treasure Hunt

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

Start Hunting!