No BSD License  

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

4.14286
4.1 | 7 ratings Rate this file 55 Downloads (last 30 days) File Size: 11.8 KB File ID: #23455 Version: 1.3

Dicom directory (of slices) to 3D volume image

by

Ariel Balter (view profile)

 

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.

This file inspired Dicomfolder.

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 (16)
19 Aug 2015 SHERRY

SHERRY (view profile)

great

04 Aug 2015 Dylan

Dylan (view profile)

 
23 Jan 2015 Füsun Er

Hi,

Thank you for nice tool. It worked for me.
Could you help me about to save the produced variables into one 3D .dcm file?

Best,
Fusun

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

Ariel Balter (view profile)

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!

Comment only
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!

Comment only
08 Feb 2011 Haseeb

Haseeb (view profile)

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

Comment only
02 Feb 2011 helena

helena (view profile)

 
05 Dec 2010 Ariel Balter

Ariel Balter (view profile)

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.

Comment only
02 Dec 2010 Crtistian Capannini

THIS MUST BE FIXED!!

Comment only
05 Oct 2009 Hakan Gustafsson

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

Best regards,
Håkan

Comment only
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

Comment only
31 Mar 2009 Ariel Balter

Ariel Balter (view profile)

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

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

Comment only
Updates
30 Mar 2009 1.1

Fixed a bug.

31 Mar 2009 1.2

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 1.3

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