No BSD License  

Highlights from
Dicom directory (of slices) to 3D volume image

3.33333

3.3 | 3 ratings Rate this file 59 Downloads (last 30 days) File Size: 11.8 KB File ID: #23455

Dicom directory (of slices) to 3D volume image

by Ariel Balter

 

27 Mar 2009 (Updated 07 Apr 2009)

Read a series of dicom slice images to a 3D volume image and meta data.

| Watch this File

File Information
Description

This function reads all good dicom files in a given directory and outputs a volume image. The slices are sorted by the SliceLocation tag in the image header. If no directory is specified, it opens a folder browser.

It also collects user specified (or default) header information for each slice and calculates some additional data for each slice such as the physical width and height of the image (e.g. PhysicalWidth = PixelWidth(1)*Rows). It also determines some meta data about the image such as the physical aspect ratio which is useful for volume rendering utilities.

Finally, it saves all the data to the dicom directory as a MAT file. In the future, the user will be able to switch the file saving on and off, and also specify alternate formats.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
3D Free Form Image Registration Toolbox (GUI), Read and write single file dicom volumes, isdicom

MATLAB release MATLAB 7.7 (R2008b)
Other requirements isdicom http://www.mathworks.com/matlabcentral/fileexchange/11431
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (12)
31 Mar 2009 WILLIAM

Hey, I'm really excited about the prospect of having a DICOM file viewer in MATLAB. Unfortunately, I get the following error when running dicom23D:

?? Index exceeds matrix dimensions.

Error in ==> dicom23D at 218
    if isfield(slice_data(1), 'SliceLocation')

31 Mar 2009 Ariel Balter

I think it is possible that you tried it on an empty directory -- at least that is how I could reproduce the error you got.

In any case, I just uploaded an updated version with improvements and more catches. Please let me know how it works for you. --AB

02 Sep 2009 Tangarua Tangarua

Hi Unfortunately, I am getting a similar error:
ans =

header did not contain the field SpacingBetweenSlices

??? Index exceeds matrix dimensions.

Error in ==> dicom23D at 270
    [rows, cols] = size(slice_data(1).SliceData);

Could you please help me to figure that out?
If you need my DICOM files, just send me an email and I'll send them to you.

Best Regards

05 Oct 2009 Hakan Gustafsson

Hi,
I also have the same problem :-( DICOM from a Philips achieva.

Best regards,
HÃ¥kan

02 Dec 2010 Crtistian Capannini

THIS MUST BE FIXED!!

05 Dec 2010 Ariel Balter

Sorry, I made that for a project I have long since abandoned. I don't use dicom or do any imaging stuff any more at all.

Nevertheless, I will try to take a look and see if I can fix it. At the very least I will extensively comment in the hopes that someone else can debug.

Again, sorry for it not working out of the box.

02 Feb 2011 helena  
08 Feb 2011 Haseeb

Hi,
I was able to get a mat file running the dicom23D function. How do I use this output? Can I visualize the data?
Thanks,
Haseeb

21 Jun 2011 Mitchell Blenden

Will this code allow me to take Philips 3D data from their 3D echo and play it in matlab? Also will this allow me to make a 3D image from their data. The rep says the file is 3D dicom native data and I can not find out how to load it in as a 3D image, it only comes into matlab as a 2D image.
Thanks!

21 Jun 2011 Mitchell Blenden  
01 Sep 2011 Ariel Balter

Folks, I'm sorry, but I can't support this script at this time. I'm inclined to pull it, but since some folks are getting some use out of it, I'll leave it up for the time being.

The code is pretty well commented, so I think it should be possible for someone to get it working, and I'd be happy to update with bug fixes as they come in.

I wrote this code a long time ago when I was doing a specific project with dicom files. That was the last time I looked at such files, and I no longer have any to test with.

Good luck!

14 Jan 2012 bahar cham  
Please login to add a comment or rating.
Updates
30 Mar 2009

Fixed a bug.

31 Mar 2009

Fixed a few bugs. Better handling of empty directories or insufficient header info for some calculations. Slight improvements to documentation and organization.

07 Apr 2009

Added robustness in handling directories with subdirectories (Mac OSIRIX users end up with these), very large data sets (>2GB), and missing header info. Changed screen outputs to fprintf in case user wants to compile.

Tag Activity for this File
Tag Applied By Date/Time
dicom Ariel Balter 30 Mar 2009 13:46:08
3d Ariel Balter 30 Mar 2009 13:46:09
volume Ariel Balter 30 Mar 2009 13:46:09
medical Ariel Balter 30 Mar 2009 13:46:09
3d ErasmusMC 01 Sep 2010 11:57:01
3d Roberto Laurita 05 Sep 2010 10:10:34
dicom gooface16 05 Jun 2011 10:49:42
3d Agata 22 Nov 2011 10:19:56
3d SRIDHAR 10 Jan 2012 06:48:30
3d UPV 14 May 2012 09:35:06

Contact us at files@mathworks.com