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.
I used the code and it worked well for me. It took the the dicom slices from the directory and created a volume_image.mat file in same directory. But can you please tell me how to visualize the output 3D volume made by stacking 2d slices. Is there any command for it??
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.
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.
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')
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.