Image Processing and Brain Slicing

MRI images are typically obtained slice-by-slice, and the 3d volume is reconstructed from this. I got a hold of my own scan and wanted to look at it, but I only had a series of dicom images. Here is my attempt to put together a brain viewer without having to use specialised software or packages.

A reslicing of the dicom images (240px * 240px, 150 slices)

Here's the Matlab code used. The dicom function is found in the image processing toolbox.