File Exchange

image thumbnail

fast_dcm_head

version 1.0.0 (4.58 KB) by Jon Dudley
Basically, it's MATLAB's built-in "dicominfo.m" but up to 100x faster.

1 Download

Updated 02 Oct 2019

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 sometimes that is not 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 (2020). fast_dcm_head (https://www.mathworks.com/matlabcentral/fileexchange/72923-fast_dcm_head), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags