def setup(self):
        graph = Graph()
        op = OpCompressedUserLabelArray(graph=graph)
        arrayshape = (1, 100, 100, 10, 1)
        op.inputs["shape"].setValue(arrayshape)
        blockshape = (1, 10, 10, 10, 1
                      )  # Why doesn't this work if blockshape is an ndarray?
        op.inputs["blockShape"].setValue(blockshape)
        op.eraser.setValue(100)

        dummyData = vigra.VigraArray(arrayshape,
                                     axistags=vigra.defaultAxistags("txyzc"),
                                     dtype=numpy.uint8)
        op.Input.setValue(dummyData)

        slicing = numpy.s_[0:1, 1:15, 2:36, 3:7, 0:1]
        inDataShape = slicing2shape(slicing)
        inputData = (3 * numpy.random.random(inDataShape)).astype(numpy.uint8)
        op.Input[slicing] = inputData

        data = numpy.zeros(arrayshape, dtype=numpy.uint8)
        data[slicing] = inputData

        # Sanity check...
        assert (op.Output[:].wait()[slicing] == data[slicing]).all()

        self.op = op
        self.slicing = slicing
        self.inData = inputData
        self.data = data
    def setup(self):
        graph = Graph()
        op = OpCompressedUserLabelArray(graph=graph)
        arrayshape = (1,100,100,10,1)
        op.inputs["shape"].setValue( arrayshape )
        blockshape = (1,10,10,10,1) # Why doesn't this work if blockshape is an ndarray?
        op.inputs["blockShape"].setValue( blockshape )
        op.eraser.setValue(100)

        op.Input.meta.axistags = vigra.defaultAxistags('txyzc')
        op.Input.meta.has_mask = True
        dummyData = numpy.zeros(arrayshape, dtype=numpy.uint8)
        dummyData = numpy.ma.masked_array(dummyData, mask=numpy.ma.getmaskarray(dummyData), fill_value=numpy.uint8(0), shrink=False)
        op.Input.setValue( dummyData )

        slicing = sl[0:1, 1:15, 2:36, 3:7, 0:1]
        inDataShape = slicing2shape(slicing)
        inputData = ( 3*numpy.random.random(inDataShape) ).astype(numpy.uint8)
        inputData = numpy.ma.masked_array(inputData, mask=numpy.ma.getmaskarray(inputData), fill_value=numpy.uint8(0), shrink=False)
        inputData[:, 0] = numpy.ma.masked
        op.Input[slicing] = inputData
        data = numpy.ma.zeros(arrayshape, dtype=numpy.uint8, fill_value=numpy.uint8(0))
        data[slicing] = inputData

        self.op = op
        self.slicing = slicing
        self.inData = inputData
        self.data = data
    def setup(self):
        graph = Graph()
        op = OpCompressedUserLabelArray(graph=graph)
        arrayshape = (1,100,100,10,1)
        op.inputs["shape"].setValue( arrayshape )
        blockshape = (1,10,10,10,1) # Why doesn't this work if blockshape is an ndarray?
        op.inputs["blockShape"].setValue( blockshape )
        op.eraser.setValue(100)

        dummyData = vigra.VigraArray(arrayshape, axistags=vigra.defaultAxistags('txyzc'))
        op.Input.setValue( dummyData )

        slicing = sl[0:1, 1:15, 2:36, 3:7, 0:1]
        inDataShape = slicing2shape(slicing)
        inputData = ( 3*numpy.random.random(inDataShape) ).astype(numpy.uint8)
        op.Input[slicing] = inputData
        
        data = numpy.zeros(arrayshape, dtype=numpy.uint8)
        data[slicing] = inputData

        # Sanity check...
        assert (op.Output[:].wait()[slicing] == data[slicing]).all()

        self.op = op
        self.slicing = slicing
        self.inData = inputData
        self.data = data
Example #4
0
    def __init__(self, *args, **kwargs):
        super(OpLabelPipeline, self).__init__(*args, **kwargs)
        self.opLabelArray = OpCompressedUserLabelArray(parent=self)
        self.opLabelArray.Input.connect(self.LabelInput)
        self.opLabelArray.eraser.setValue(100)

        self.opBoxArray = OpCompressedUserLabelArray(parent=self)
        self.opBoxArray.Input.connect(self.BoxLabelInput)
        self.opBoxArray.eraser.setValue(100)

        self.opLabelArray.deleteLabel.connect(self.DeleteLabel)

        # Connect external outputs to their internal sources
        self.Output.connect(self.opLabelArray.Output)
        self.nonzeroBlocks.connect(self.opLabelArray.nonzeroBlocks)
        # self.MaxLabel.connect( self.opLabelArray.MaxLabelValue )
        self.BoxOutput.connect(self.opBoxArray.Output)
Example #5
0
    def __init__(self, blockDims=None, *args, **kwargs):
        """
        Instantiate all internal operators and connect them together.
        """
        super(OpLabelingSingleLane, self).__init__(*args, **kwargs)

        # Configuration options
        if blockDims is None:
            blockDims = {'t': 1, 'x': 100, 'y': 100, 'z': 100, 'c': 1}
        assert isinstance(blockDims, dict)
        self._blockDims = blockDims

        # Create internal operator
        self.opLabelArray = OpCompressedUserLabelArray(parent=self)
        self.opLabelArray.Input.connect(self.LabelInput)
        self.opLabelArray.eraser.connect(self.LabelEraserValue)
        self.opLabelArray.deleteLabel.connect(self.LabelDelete)

        # Connect our internal outputs to our external outputs
        self.LabelImage.connect(self.opLabelArray.Output)
        self.NonzeroLabelBlocks.connect(self.opLabelArray.nonzeroBlocks)

        self.LabelNames.setValue(['Negative', 'Positive'])
        self.LabelColors.setValue([])
Example #6
0
    def __init__(self, blockDims=None, *args, **kwargs):
        """
        Instantiate all internal operators and connect them together.
        """
        super(OpCroppingSingleLane, self).__init__(*args, **kwargs)

        # Configuration options
        if blockDims is None:
            blockDims = {"t": 1, "x": 100, "y": 100, "z": 100, "c": 1}
        assert isinstance(blockDims, dict)
        self._blockDims = blockDims

        # Create internal operator
        self.opCropArray = OpCompressedUserLabelArray(parent=self)
        self.opCropArray.Input.connect(self.CropInput)
        self.opCropArray.eraser.connect(self.CropEraserValue)
        self.opCropArray.deleteCrop.connect(self.CropDelete)

        # Connect our internal outputs to our external outputs
        self.CropImage.connect(self.opCropArray.Output)
        self.NonzeroCropBlocks.connect(self.opCropArray.nonzeroBlocks)

        self.CropNames.setValue([])
        self.CropColors.setValue([])