Example #1
0
    def testNonEmptyLayerStackModel(self):
        lsm = LayerStackModel()

        lsm.append(self.layer1)
        lsm.append(self.layer2)
        lsm.append(self.layer3)

        ip = ImagePump(lsm, SliceProjection())
        self.assertEqual(len(lsm), 3)
        self.assertEqual(len(ip.stackedImageSources), 3)
        self.assertEqual(len(ip.syncedSliceSources), 3)

        self.assertEqual(len(ip.stackedImageSources.getRegisteredLayers()), 3)
        for layer in lsm:
            self.assertTrue(ip.stackedImageSources.isRegistered(layer))

        lsm.deleteSelected()
        self.assertEqual(len(lsm), 2)
        self.assertEqual(len(ip.stackedImageSources), 2)
        self.assertEqual(len(ip.syncedSliceSources), 2)
        self.assertEqual(len(ip.stackedImageSources.getRegisteredLayers()), 2)
        for layer in lsm:
            self.assertTrue(ip.stackedImageSources.isRegistered(layer))

        lsm.clear()
        self.assertEqual(len(lsm), 0)
        self.assertEqual(len(ip.stackedImageSources), 0)
        self.assertEqual(len(ip.syncedSliceSources), 0)
        self.assertEqual(len(ip.stackedImageSources.getRegisteredLayers()), 0)
Example #2
0
    def setUp( self ):
        dataShape = (1, 900, 400, 10, 1) # t,x,y,z,c
        data = np.indices(dataShape)[3].astype(np.uint8) # Data is labeled according to z-index
        self.ds1 = ArraySource( data )
        self.CONSTANT = 13
        self.ds2 = ConstantSource( self.CONSTANT )

        self.layer1 = GrayscaleLayer( self.ds1, normalize=False )
        self.layer1.visible = True
        self.layer1.opacity = 1.0

        self.layer2 = GrayscaleLayer( self.ds2, normalize=False )

        self.lsm = LayerStackModel()
        self.pump = ImagePump( self.lsm, SliceProjection(), sync_along=(0,1,2) )