コード例 #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
ファイル: datasources.py プロジェクト: buotex/volumina
 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
ファイル: datasources.py プロジェクト: buotex/volumina
 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
ファイル: datasources.py プロジェクト: buotex/volumina
 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
ファイル: datasources.py プロジェクト: CVML/volumina
 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
ファイル: datasources.py プロジェクト: lfiaschi/volumina
 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
ファイル: datasources.py プロジェクト: LimpingTwerp/volumina
 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
ファイル: constantsource.py プロジェクト: vibbits/volumina
    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
ファイル: datasources.py プロジェクト: LimpingTwerp/volumina
 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
ファイル: datasources.py プロジェクト: skarale25/volumina
        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
ファイル: lazyflowsource.py プロジェクト: vibbits/volumina
    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
ファイル: datasources.py プロジェクト: ilastik/volumina
    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
ファイル: imagesources.py プロジェクト: buotex/volumina
    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
ファイル: datasources.py プロジェクト: ilastik/volumina
        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
ファイル: datasources.py プロジェクト: buotex/volumina
 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)