def request(self, slicing, through=None): assert is_pure_slicing(slicing) assert is_bounded(slicing) shape = slicing2shape(slicing) result = np.zeros(shape, dtype=self._dtype) result[:] = self._constant return ConstantRequest(result)
def request( self, slicing, through=None ): assert is_pure_slicing(slicing) assert is_bounded(slicing) shape = slicing2shape(slicing) result = np.zeros( shape, dtype = self._dtype ) result[:] = self._constant return ConstantRequest( result )
def __init__(self, op, slicing, prio, objectName="Unnamed LazyflowRequest"): shape = op.Output.meta.shape if shape is not None: slicing = make_bounded(slicing, shape) self._req = op.Output[slicing] self._slicing = slicing self._shape = slicing2shape(slicing) self._objectName = objectName
def __missing__(self, key): if self.p[0].output.meta.shape is not None: reqobj = self.p[0].output[self.p[1]].allocate(priority = self.p[2]) else: reqobj = ArrayRequest( np.zeros(slicing2shape(self.p[1]), dtype=np.uint8 ), self.p[1] ) self[0] = reqobj return reqobj
def __init__(self, op, slicing, prio, objectName="Unnamed LazyflowRequest" ): self._req = LazyflowRequest._req_on_demand(op, slicing, prio) self._slicing = slicing shape = op.output.meta.shape if shape is not None: slicing = make_bounded(slicing, shape) self._shape = slicing2shape(slicing) self._objectName = objectName
def testPut(self): slicing = sl[0:1, 0:100, 0:100, 0:1, 0:1] inData = (255*np.random.random( slicing2shape(slicing) )).astype(np.uint8) # Put some data into the source and get it back out again self.source.put(slicing, inData) req = self.source.request(slicing) assert (req.wait() == inData).all()
def __missing__(self, key): if self.p[0].output.meta.shape is not None: assert(self.p[0].output.ready()) reqobj = self.p[0].output[self.p[1]] else: reqobj = ArrayRequest( np.zeros(slicing2shape(self.p[1]), dtype=np.uint8 ), (slice(None),) * len(self.p[1]) ) self[0] = reqobj return reqobj
def request(self, qrect, along_through=None): assert isinstance(qrect, QRect) s = rect2slicing(qrect) r = self._channels[0].request(s, along_through) g = self._channels[1].request(s, along_through) b = self._channels[2].request(s, along_through) a = self._channels[3].request(s, along_through) shape = list(slicing2shape(s)) assert len(shape) == 2 assert all([x > 0 for x in shape]) return RGBAImageRequest(r, g, b, a, shape, *self._layer._normalize)
def request(self, slicing): assert is_pure_slicing(slicing) assert is_bounded(slicing) shape = slicing2shape(slicing) key = (shape, self._constant, self._dtype) if key not in self._cache: result = np.full(shape, self._constant, dtype=self._dtype) result.setflags(write=False) self._cache[key] = result return ConstantRequest(self._cache[key])
def request( self, slicing ): if cfg.getboolean('pixelpipeline', 'verbose'): volumina.printLock.acquire() print " LazyflowSource '%s' requests %s" % (self.objectName(), volumina.strSlicing(slicing)) volumina.printLock.release() if not is_pure_slicing(slicing): raise Exception('LazyflowSource: slicing is not pure') if self._outslot.meta.shape is not None: reqobj = self._outslot[slicing].allocate(priority = self._priority) else: reqobj = ArrayRequest( np.zeros(slicing2shape(slicing), dtype=np.uint8 ), slicing ) return LazyflowRequest( reqobj )
def request( self, qrect, along_through=None ): if cfg.getboolean('pixelpipeline', 'verbose'): volumina.printLock.acquire() print Fore.RED + " RGBAImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d)" \ % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height()) \ + Fore.RESET volumina.printLock.release() assert isinstance(qrect, QRect) s = rect2slicing( qrect ) r = self._channels[0].request(s, along_through) g = self._channels[1].request(s, along_through) b = self._channels[2].request(s, along_through) a = self._channels[3].request(s, along_through) shape = list( slicing2shape(s) ) assert len(shape) == 2 assert all([x > 0 for x in shape]) return RGBAImageRequest( r, g, b, a, shape, *self._layer._normalize )
def request( self, qrect ): if cfg.getboolean('pixelpipeline', 'verbose'): volumina.printLock.acquire() print Fore.RED + " RGBAImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d)" \ % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height()) \ + Fore.RESET volumina.printLock.release() assert isinstance(qrect, QRect) s = rect2slicing( qrect ) r = self._channels[0].request(s) g = self._channels[1].request(s) b = self._channels[2].request(s) a = self._channels[3].request(s) shape = [] for t in slicing2shape(s): if t > 1: shape.append(t) assert len(shape) == 2 return RGBAImageRequest( r, g, b, a, shape, *self._layer._normalize )
def request( self, qrect, along_through=None ): assert isinstance(qrect, QRect) s = rect2slicing(qrect) shape = slicing2shape( s ) return RandomImageRequest( shape )
def __getitem__( self, slicing ): sl3d = (slicing[1], slicing[2], slicing[3]) ret = np.zeros(slicing2shape(slicing), dtype=self.dtype) ret[0,:,:,:,0] = self.a[tuple(sl3d)] return ret
def __init__(self, op, slicing, prio, objectName="Unnamed LazyflowRequest" ): self._req = LazyflowRequest._req_on_demand(op, slicing, prio) self._slicing = slicing self._shape = slicing2shape(slicing) self._objectName = objectName
def request(self, qrect, along_through=None): assert isinstance(qrect, QRect) s = rect2slicing(qrect) shape = slicing2shape(s) return RandomImageRequest(shape)