Example #1
0
        def setUp( self ):
            GenericArraySourceTest.setUp(self)
            self.lena = np.load(os.path.join(volumina._testing.__path__[0], 'lena.npy'))
            self.raw = np.zeros((1,512,512,1,1), dtype=np.uint8)
            self.raw[0,:,:,0,0] = self.lena

            g = Graph()
            self.op = OpDataProvider(self.raw, graph=g)
            self.source = LazyflowSinkSource(self.op.Data, self.op.Changedata)

            self.samesource = LazyflowSinkSource(self.op.Data, self.op.Changedata)
            opOtherData = OpDataProvider(self.raw, graph=g)
            self.othersource = LazyflowSinkSource(opOtherData.Data, self.op.Changedata)
Example #2
0
    class LazyflowSinkSourceTest( ut.TestCase, GenericArraySourceTest ):
        def setUp( self ):
            GenericArraySourceTest.setUp(self)
            self.lena = np.load(os.path.join(volumina._testing.__path__[0], 'lena.npy'))
            self.raw = np.zeros((1,512,512,1,1), dtype=np.uint8)
            self.raw[0,:,:,0,0] = self.lena

            g = Graph()
            self.op = OpDataProvider(self.raw, graph=g)
            self.source = LazyflowSinkSource(self.op.Data, self.op.Changedata)

            self.samesource = LazyflowSinkSource(self.op.Data, self.op.Changedata)
            opOtherData = OpDataProvider(self.raw, graph=g)
            self.othersource = LazyflowSinkSource(opOtherData.Data, self.op.Changedata)
        
        def testPut(self):
            slicing = sl[0:1, 0:100, 0:100, 0:1, 0:1]
            inData = (255*np.random.random( slicing2shape(slicing) )).astype(np.uint8)

            # Put some data into the source and get it back out again
            self.source.put(slicing, inData)
            req = self.source.request(slicing)
            assert (req.wait() == inData).all()