def request(self, slicing): if not is_pure_slicing(slicing): raise Exception("ArraySource: slicing is not pure") assert len(slicing) == len( self._array.shape ), "slicing into an array of shape=%r requested, but slicing is %r" % (slicing, self._array.shape) return ArrayRequest(self._array, slicing)
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 ): if not is_pure_slicing(slicing): raise Exception('ArraySource: slicing is not pure') assert(len(slicing) == len(self._array.shape)), \ "slicing into an array of shape=%r requested, but slicing is %r" \ % (slicing, self._array.shape) return ArrayRequest(self._array, slicing)
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 ): 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') return LazyflowRequest( self._op5, slicing, self._priority, objectName=self.objectName() )
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') assert self._op5 is not None, "Underlying operator is None. Are you requesting from a datasource that has been cleaned up already?" return LazyflowRequest( self._op5, slicing, self._priority, objectName=self.objectName() )
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') return LazyflowRequest(self._op5, slicing, self._priority, objectName=self.objectName())
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, 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 not is_pure_slicing(slicing): raise Exception('ArraySource: slicing is not pure') assert(len(slicing) == len(self._array.shape)), \ "slicing into an array of shape=%r requested, but slicing is %r" \ % (self._array.shape, slicing) a = self._array[slicing] oldDtype = a.dtype if self._relabeling is not None: a = self._relabeling[a] assert a.dtype == oldDtype return ArrayRequest(a, 5*(slice(None),))
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') assert self._op5 is not None, "Underlying operator is None. Are you requesting from a datasource that has been cleaned up already?" start, stop = sliceToRoi(slicing, self._op5.Output.meta.shape) clipped_roi = np.maximum(start, (0,0,0,0,0)), np.minimum(stop, self._op5.Output.meta.shape) clipped_slicing = roiToSlice(*clipped_roi) return LazyflowRequest( self._op5, clipped_slicing, self._priority, objectName=self.objectName() )
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') assert self._op5 is not None, "Underlying operator is None. Are you requesting from a datasource that has been cleaned up already?" return LazyflowRequest(self._op5, slicing, self._priority, objectName=self.objectName())
def request(self, slicing): if CONFIG.verbose_pixelpipeline: logger.info("%s '%s' requests %s'", type(self).__name__, self.objectName(), strSlicing(slicing)) if not is_pure_slicing(slicing): raise Exception("LazyflowSource: slicing is not pure") assert ( self._op5 is not None ), "Underlying operator is None. Are you requesting from a datasource that has been cleaned up already?" start, stop = sliceToRoi(slicing, self._op5.Output.meta.shape) clipped_roi = np.maximum(start, (0, 0, 0, 0, 0)), np.minimum(stop, self._op5.Output.meta.shape) clipped_slicing = roiToSlice(*clipped_roi) return LazyflowRequest(self._op5, clipped_slicing, self._priority, objectName=self.objectName())
def request(self, slicing): if not is_pure_slicing(slicing): raise Exception("ArraySource: slicing is not pure") assert len(slicing) == len( self._array.shape ), "slicing into an array of shape=%r requested, but slicing is %r" % (self._array.shape, slicing) a = ArrayRequest(self._array, slicing) a = a.wait() # oldDtype = a.dtype if self._relabeling is not None: a = self._relabeling[a] # assert a.dtype == oldDtype return ArrayRequest(a, 5 * (slice(None),))
def setDirty(self, slicing): """Mark a region of the image as dirty. slicing -- if one ore more slices in the slicing are unbounded, the whole image is marked dirty; since an image has two dimensions, only the first two slices in the slicing are used """ if not is_pure_slicing(slicing): raise Exception("dirty region: slicing is not pure") if not is_bounded(slicing): self.isDirty.emit(QRect()) # empty rect == everything is dirty else: self.isDirty.emit(slicing2rect(slicing))
def setDirty( self, slicing ): '''Mark a region of the image as dirty. slicing -- if one ore more slices in the slicing are unbounded, the whole image is marked dirty; since an image has two dimensions, only the first two slices in the slicing are used ''' if not is_pure_slicing(slicing): raise Exception('dirty region: slicing is not pure') if not is_bounded( slicing ): self.isDirty.emit(QRect()) # empty rect == everything is dirty else: self.isDirty.emit(slicing2rect( slicing ))
def request(self, slicing): if CONFIG.verbose_pixelpipeline: logger.info( "%s '%s' requests %s'", type(self).__name__, self.objectName(), volumina.strSlicing(slicing) ) if not is_pure_slicing(slicing): raise Exception("LazyflowSource: slicing is not pure") assert ( self._op5 is not None ), "Underlying operator is None. Are you requesting from a datasource that has been cleaned up already?" start, stop = sliceToRoi(slicing, self._op5.Output.meta.shape) clipped_roi = np.maximum(start, (0, 0, 0, 0, 0)), np.minimum(stop, self._op5.Output.meta.shape) clipped_slicing = roiToSlice(*clipped_roi) return LazyflowRequest(self._op5, clipped_slicing, self._priority, objectName=self.objectName())
def setDirty( self, slicing ): assert isinstance(slicing, tuple) if not is_pure_slicing(slicing): raise Exception('dirty region: slicing is not pure') self.areaDirty.emit( slicing )
def setDirty(self, slicing): assert isinstance(slicing, tuple) if not is_pure_slicing(slicing): raise Exception("dirty region: slicing is not pure") self.isDirty.emit(slicing)
def setDirty( self, slicing): if not is_pure_slicing(slicing): raise Exception('dirty region: slicing is not pure') self.isDirty.emit( slicing )
def setDirty(self, slicing): if not is_pure_slicing(slicing): raise Exception("dirty region: slicing is not pure") self.isDirty.emit(slicing)