示例#1
0
 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)
示例#2
0
 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 )
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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() )
示例#6
0
 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() )
示例#7
0
 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())
示例#8
0
 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 )
示例#9
0
    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])
示例#10
0
 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),))
示例#11
0
        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() )
示例#12
0
 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())
示例#13
0
    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())
示例#14
0
    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),))
示例#15
0
    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),))
示例#16
0
    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))
示例#17
0
    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 ))
示例#18
0
        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())
示例#19
0
 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 )
示例#20
0
 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)
示例#21
0
 def setDirty( self, slicing):
     if not is_pure_slicing(slicing):
         raise Exception('dirty region: slicing is not pure')
     self.isDirty.emit( slicing )
示例#22
0
 def setDirty(self, slicing):
     if not is_pure_slicing(slicing):
         raise Exception("dirty region: slicing is not pure")
     self.isDirty.emit(slicing)