No BSD License  

3.5

3.5 | 4 ratings Rate this file 60 Downloads (last 30 days) File Size: 11.8 KB File ID: #23455

Dicom directory (of slices) to 3D volume image

by

 

27 Mar 2009 (Updated )

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

3 D Free Form Image Registration Toolbox (Gui), Read And Write Single File Dicom Volumes, and Isdicom inspired this file.

MATLAB release MATLAB 7.7 (R2008b)
Other requirements isdicom http://www.mathworks.com/matlabcentral/fileexchange/11431
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (13)
26 Nov 2013 Leighton Warmington

So i was looking through this and it looks like it give this message when you are using some kind of dicom dir with multiple image sets. The MR localizer image for example might not have the same resolution as your main image and it complains when you try an assign the image from one set to the matrix that was defined based on a different image set. You might want to separate the acquisitions to avoid this.

14 Jan 2012 bahar cham  
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!

21 Jun 2011 Mitchell Blenden  
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!

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

02 Feb 2011 helena  
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 Dec 2010 Crtistian Capannini

THIS MUST BE FIXED!!

05 Oct 2009 Hakan Gustafsson

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

Best regards,
HÃ¥kan

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

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

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')

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.

Contact us