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 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 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 ))