View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

3.5 | 20 ratings Rate this file 30 Downloads (last 30 days) File Size: 10.6 KB File ID: #7926 Version: 1.2



Laszlo Balkay (view profile)


27 Jun 2005 (Updated )

Select dicom series under a directory or CD using the DICOMDIR file.

| Watch this File

File Information

dcmSeries = loaddcmdir(directoryname)

LOADDICOMDIR reads metadata from DICOMDIR file and shows a list of the different DICOM SERIES in a Pop-up menus. After selecting a dicom
series the program creates the dcmSeries structure containig the related file names and path.
The zip file also contains the loaddcm.m program which enable to generate the relating 3D image array using the names of dicom slices.


Reading DICOMDIR folder using the directory browser GUI:
   dcmSeries = loaddcmdir;

Generating 3D array by selecting a dicom series:
   [imaVOL, scaninfo, dcminfo] = loaddcm(loaddcmdir);

To preview the 3D array you can use the orthogonalslicer tool: (


To check the dicom header:


This file inspired Calculo De Caídas De Tensión En Redes Eléctricas 3f 1f, Dicomdir Parser, and Dicomfolder.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (32)
09 Jul 2012 Claudio

You should write in the description that the function saves a "dicomdir.mat" file!

I also got the following error:
Undefined function or variable "StudyDescription".
Error in loaddcmdir (line 229)

I just changed line 229 to the following and it works now:
SeriesList{SeriesListNum} = [Pname,', ',Modality,', SeriesDesc: ', SeriesDescription, ', Number of Images: ',NumOfImages];

21 Mar 2011 Shrinivas

You have done a very great piece of work.Still I have an error it is giving me
?? function [dcmSeries] = loaddcmdir(directoryname)
Error: Function definitions are not permitted at the prompt or in scripts.
Some how I will work on this but my problem lies when I need to calculate the Hounfied density for each pixel Please let me know how am i suppose to get the hounsfield density for each and every pixel value.

27 May 2009 Matt Thorpe

Good work - thank you.

Our protocol tends to store images in a series across multiple directories, so I changed line 102 ( ...
ImageNames{CurrentImage,1} = dcmfname ; )

... = CurrentItem.ReferencedFileID;

And adjusted accompanying load m-files accordingly.

This keeps each image associated with the correct path.


Comment only
27 May 2009 Matt Thorpe

12 Sep 2008 Laszlo Balkay

comment to Cristina Suárez-Varela:
Send your CT dicom series (or one instace from the series) directly to my email:

Comment only
11 Sep 2008 Cristina Suárez-Varela

I've tryed this dicomdir read, and it's ok but I've a problem with CT images. I must find the Hounsfield unit of each pixel to fix the window and I´ve find that the expresion is:
hu = pixel * RescaleSlope + RescaleIntercept
But I don't find these fields in the metadata info.
Could you help me?

Comment only
07 Aug 2008 Laszlo Balkay

Comment to Pratik Chhatbar: This means matlab cannot find the 'dicominfo' function. It seems the Image Processing Toolbox is not installed in your PC, or the version is fairly old.

Comment only
04 Aug 2008 Pratik Chhatbar

anyone had this error?

Undefined function or method dicominfo' for input arguments of type 'char'

31 Jul 2008 ani shiv


20 Jul 2008 sujeet poudyal


22 Apr 2008 Laszlo Balkay

Comment to Daniel Polders: The cause of your problem may be the version of your Img.Proc toolbox. See the link:

I hope this help,

Comment only
18 Apr 2008 Daniel Polders

Good initiative!
I'm trying to read a dicomdir generated by a Philips Achieva MR system, but I get the following error:

??? Operands to the || and && operators must be convertible to logical scalar values.
Error in ==> loaddcmdir at 64 (dcmhdr = dicominfo(dcmdir_path);)

Any suggestions?

29 Mar 2008 Laszlo Balkay

Comments to Kalyani Mallela: DICOMDIR is a "catalog" file in the DICOM CD. This is a well known "standard" in this field. If you only want to read dicom series (including 250 slices or whatever you want) you may use the "loaddcm.m" script from the package. I hope this help. LAszlo

Comment only
27 Mar 2008 Kalyani Mallela

I am still unclear on what your DICOMDIR is in the file "loaddcmdir". I have a folder say,data, that has 250 slices of CT. Each of the .dcm file has some name tag. Now, from this if I want to generate a 3D, can you tell me what should my DICOMDIR be. Thank you

Comment only
11 Feb 2008 pedro aguiar

no coment

04 Feb 2008 Balaji Pillai

22 Oct 2007 mohamed KHAFAGY


27 Sep 2007 mohammed ashour

nice program

04 Apr 2007 osae qafeas


Comment only
06 Dec 2006 Laszlo Balkay

Comments to "pin press":
As far as I know, officialy there is no different type of dicomdir files. Nevertheless I have gone into problem with Philips type dicomdir file. The only think I could suggest you, send me your dicomdir file directly to my email address to check your specific the problem.


Comment only
04 Dec 2006 pin press

Does this only work for specific type of dicomdir? I tried read that from a Philips generate dicomdir, and it reports error:

>> dcmseries=loaddcmdir(fn);

ErrorOnDicomOpening =

Error using ==> struct
Field name must be a string vector.

30 Nov 2006 hamdi issa

11 Oct 2006 Orkopoulos Anestis

05 Oct 2006 George Enrique Figueras Benítez

how can i modifier a especific field in a dicomdir header

06 Aug 2006 zee hai

04 Aug 2006 Joel Dunn

Could not open DICOMDIR from Phillips MRI scanner (tho readable on another program).
Error msg below...

ErrorOnDicomOpening =

Error using ==> medformats\private\dicom_read_attr>read_elt
Error using ==> medformats\private\dicom_read_attr>find_attr_details
Attribute (0070,0000) was not found in the data dictionary.

04 Jul 2006 gabriel berindei

19 Jun 2006 nicu gavanescu


14 Jun 2006 Bob Alvarez

Also could not get it to work. Line 49 is definitely weird. I have used dicominfo many times and never for a directory.

Comment only
12 Dec 2005 Ravi Seethamraju

There is a bug in the script. The field PatientName should be replaced with PatientsName in order for the script to work

17 Nov 2005 Vihang Patil

The program does not work. You have specified "dcmhdr = dicominfo(dcmdir_path);"
It is not applicable as dicominfo cannot read the directory. It only reads the dicom images. PLease let me know how to make it run

Comment only
07 Oct 2005 YAVUZ BAYRAM


Comment only
05 Oct 2011 1.2

Fixed the bugs that were reported on comments list previously.

Contact us