'Export data from the ImageView to a file, or to a stack of files if
the data is 3D. Saving an image stack will result in index numbers
being added to the file name. Images are saved as they would appear
onscreen, with levels and lookup table applied.'

def export(self, fileName):

    img = self.getProcessedImage()
    if self.hasTimeAxis():
        (base, ext) = os.path.splitext(fileName)
        fmt = ('%%s%%0%dd%%s' % int((np.log10(img.shape[0]) + 1)))
        for i in range(img.shape[0]):
            self.imageItem.setImage(img[i], autoLevels=False)
            self.imageItem.save((fmt % (base, i, ext)))
        self.updateImage()
    else:
        self.imageItem.save(fileName)
