fast_dcm_head

Version 1.1.0 (4.95 KB) by Jon Dudley
Basically, it's MATLAB's built-in "dicominfo.m" but up to 100x faster.
26 Downloads
Updated 18 Aug 2021

View License

Function to scan a directory of DICOM files and return a structure variable containing information from a user-defined set of DICOM tags. Basically, it's MATLAB's built-in "dicominfo.m" but up to 100x faster (depending on how many tags you request) with X times more stability issues ¯\_(ツ)_/¯
This code was inspired by Brunno Machado de Campos's "alt_dicominfo" which you should check out as it might suit your needs better:
https://www.mathworks.com/matlabcentral/fileexchange/65606-alt_dicominfo-img-bitrange
Known Issues
1) "Enhanced" DICOM files (i.e. 1 file per N-Dimensional acquisition vs. the 1 file per 2D slice of the "classic" DICOM format) are not (yet?) fully supported. If asked to parse such a file, fast_dcm_head should work for tags that are common across all slices/timepoints/dynamics - like "PatientName" or "Manufacturer" - but not for tags with variable information like "DiffusionBValue" or "ImagePositionPatient"
2) fast_dcm_head gets it's speed from reading the first 50k bytes of a DICOM file as 8-bit unsigned integers and then simply searching this vector for patterns of 4 (or 6) numbers that correspond to user-specified DICOM tags (and VR types). Thus, there is a distinct possibility of getting false positive matches (especially when the file being read has implicit VR encoding and especially when the search pattern has two or three 0's). In these cases, fast_dcm_head assumes the first match is the right one, and that might not be the case.
Unknown Issues (an incomplete list, of course)
1) Endianness: I haven't gotten my hands on any DICOM files that have big-endian encoding, so I can't test whether fast_dcm_head will work properly in that case. If it detects big-endian data, it will warn you and then try in earnest to read the header.

Cite As

Jon Dudley (2024). fast_dcm_head (https://www.mathworks.com/matlabcentral/fileexchange/72923-fast_dcm_head), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on DICOM Format in Help Center and MATLAB Answers
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.1.0

changed the way MATLAB's DICOM dictionary was read to support Windows machines

1.0.0