Converts a GDCM image to a numpy array.

        :param image: GDCM.ImageReader.GetImage()

def _gdcm_to_numpy(self, image):
        """ Converts a GDCM image to a numpy array.

        :param image: GDCM.ImageReader.GetImage()
        """
        gdcm_typemap = {
            gdcm.PixelFormat.INT8:     numpy.int8,
            gdcm.PixelFormat.UINT8:    numpy.uint8,
            gdcm.PixelFormat.UINT16:   numpy.uint16,
            gdcm.PixelFormat.INT16:    numpy.int16,
            gdcm.PixelFormat.UINT32:   numpy.uint32,
            gdcm.PixelFormat.INT32:    numpy.int32,
            gdcm.PixelFormat.FLOAT32:  numpy.float32,
            gdcm.PixelFormat.FLOAT64:  numpy.float64
        }
        pixel_format = image.GetPixelFormat().GetScalarType()
        if pixel_format in gdcm_typemap:
            self.data_type = gdcm_typemap[pixel_format]
        else:
            raise KeyError(''.join(pixel_format, \
                " is not a supported pixel format"))

        #dimension = image.GetDimension(0), image.GetDimension(1)
        self.dimensions = image.GetDimension(1), image.GetDimension(0)
        gdcm_array = image.GetBuffer()

        # GDCM returns char* as type str. This converts it to type bytes
        if sys.version_info >= (3, 0):
            gdcm_array = gdcm_array.encode(sys.getfilesystemencoding(), "surrogateescape")

        # use float for accurate scaling
        dimensions = image.GetDimensions()
        result = numpy.frombuffer(gdcm_array, dtype=self.data_type).astype(float)
        if len(dimensions) == 3:
            # for cine (animations) there are 3 dims: x, y, number of frames
            result.shape = dimensions[2], dimensions[0], dimensions[1]
        else:
            result.shape = dimensions
        return result