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.