def read_dicom_dir_as_volume(dirname):
    """
    https://pyscience.wordpress.com/2014/10/19/image-segmentation-with-python-and-simpleitk/
    """
    import SimpleITK
    reader = SimpleITK.ImageSeriesReader()
    filenamesDICOM = reader.GetGDCMSeriesFileNames(dirname)
    reader.SetFileNames(filenamesDICOM)
    imgOriginal = reader.Execute()
    img = SimpleITK.GetArrayFromImage(imgOriginal).swapaxes(0, 2)
    return img
