def _reconstruct_pixmaps_fast (self, axis=2) : pal = self.palette() data = self.image() #rotation tr = QTransform() tr.rotate(self._transform) #construct pixmaps pix = [] if len(data.shape) == 4: vdim = data.shape[3] else: vdim = 1 # when viewing in Z and in Z only, we can use # the system's native LUT forceNativeLut = False #True if axis == 2 else False # set to true to copy img to a c_contiguous buffer make_contiguous = False if (vdim == 1 or axis!=2) else True for z in xrange(data.shape[axis]) : if axis == 0 : dat = data[z,:,:] elif axis == 1 : dat = data[:,z,:] else : dat = data[:,:,z] if make_contiguous: dat = dat.copy() dat = to_pix(dat, lut=pal, forceNativeLut=forceNativeLut) pix.append(dat.transformed(tr) ) self._pixmaps = pix self._current_slice = min(max(self._current_slice,0),len(pix) - 1)
def _reconstruct_pixmaps_fast(self, axis=2): pal = self.palette() data = self.image() #rotation tr = QTransform() tr.rotate(self._transform) #construct pixmaps pix = [] if len(data.shape) == 4: vdim = data.shape[3] else: vdim = 1 # when viewing in Z and in Z only, we can use # the system's native LUT forceNativeLut = False #True if axis == 2 else False # set to true to copy img to a c_contiguous buffer make_contiguous = False if (vdim == 1 or axis != 2) else True for z in xrange(data.shape[axis]): if axis == 0: dat = data[z, :, :] elif axis == 1: dat = data[:, z, :] else: dat = data[:, :, z] if make_contiguous: dat = dat.copy() dat = to_pix(dat, lut=pal, forceNativeLut=forceNativeLut) pix.append(dat.transformed(tr)) self._pixmaps = pix self._current_slice = min(max(self._current_slice, 0), len(pix) - 1)
def _reconstruct_pixmaps(self, axis=2): pal = self.palette() data = self.image() #rotation tr = QTransform() tr.rotate(self._transform) #construct pixmaps pix = [] # Manage also colored images. if len(data.shape) == 4 and data.shape[-1] in (3, 4): if data.dtype != uint8: raise Exception( "Only uint8 RGB[A] images supported, got %s instead" % str(data.dtype)) pal = None for z in xrange(data.shape[axis]): if axis == 0: dat = data[z, :, :] elif axis == 1: dat = data[:, z, :] else: dat = data[:, :, z] if pal is not None: dat = pal[dat] if isinstance(data, SpatialImage): dat = SpatialImage(dat) #img = QImage(dat, # data.shape[0], # data.shape[1], # QImage.Format_ARGB32) dat = to_pix(dat) pix.append(dat.transformed(tr)) self._pixmaps = pix self._current_slice = min(max(self._current_slice, 0), len(pix) - 1)
def _reconstruct_pixmaps (self, axis=2) : pal = self.palette() data = self.image() #rotation tr = QTransform() tr.rotate(self._transform) #construct pixmaps pix = [] # Manage also colored images. if len(data.shape) == 4 and data.shape[-1] in (3,4): if data.dtype != uint8: raise Exception("Only uint8 RGB[A] images supported, got %s instead"%str(data.dtype)) pal = None for z in xrange(data.shape[axis]) : if axis == 0 : dat = data[z,:,:] elif axis == 1 : dat = data[:,z,:] else : dat = data[:,:,z] if pal is not None: dat = pal[dat] if isinstance(data, SpatialImage): dat=SpatialImage(dat) #img = QImage(dat, # data.shape[0], # data.shape[1], # QImage.Format_ARGB32) dat = to_pix (dat) pix.append(dat.transformed(tr) ) self._pixmaps = pix self._current_slice = min(max(self._current_slice,0),len(pix) - 1)