Example #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)
Example #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 )
Example #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)
Example #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)
Example #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() )
Example #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() )
Example #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())
Example #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 )
Example #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])
Example #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),))
Example #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() )
Example #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())
Example #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())
Example #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),))
Example #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),))
Example #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))
Example #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 ))
Example #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())
Example #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 )
Example #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)
Example #21
0
 def setDirty( self, slicing):
     if not is_pure_slicing(slicing):
         raise Exception('dirty region: slicing is not pure')
     self.isDirty.emit( slicing )
Example #22
0
 def setDirty(self, slicing):
     if not is_pure_slicing(slicing):
         raise Exception("dirty region: slicing is not pure")
     self.isDirty.emit(slicing)