Exemple #1
0
    def __init__(self,
                 graph=None,
                 hintOverlayFile=None,
                 pmapOverlayFile=None,
                 parent=None):
        super(OpCarving, self).__init__(graph=graph, parent=parent)
        self.opLabelArray = OpDenseLabelArray(parent=self)
        # self.opLabelArray.EraserLabelValue.setValue( 100 )
        self.opLabelArray.MetaInput.connect(self.InputData)

        self._hintOverlayFile = hintOverlayFile
        self._mst = None
        self.has_seeds = (
            False
        )  # keeps track of whether or not there are seeds currently loaded, either drawn by the user or loaded from a saved object

        self.LabelNames.setValue(["Background", "Object"])

        # supervoxels of finished and saved objects
        self._done_seg_lut = None
        self._hints = None
        self._pmap = None
        if hintOverlayFile is not None:
            try:
                f = h5py.File(hintOverlayFile, "r")
            except Exception as e:
                logger.info("Could not open hint overlay '%s'" %
                            hintOverlayFile)
                raise e
            self._hints = f["/hints"].value[numpy.newaxis, :, :, :,
                                            numpy.newaxis]

        if pmapOverlayFile is not None:
            try:
                f = h5py.File(pmapOverlayFile, "r")
            except Exception as e:
                raise RuntimeError("Could not open pmap overlay '%s'" %
                                   pmapOverlayFile)
            self._pmap = f["/data"].value[numpy.newaxis, :, :, :,
                                          numpy.newaxis]

        self._setCurrObjectName("<not saved yet>")
        self.HasSegmentation.setValue(False)

        # keep track of a set of object names that have changed since
        # the last serialization of this object to disk
        self._dirtyObjects = set()
        self.preprocessingApplet = None

        self._opMstCache = OpValueCache(parent=self)
        self.MstOut.connect(self._opMstCache.Output)

        self.InputData.notifyReady(self._checkConstraints)
        self.ObjectPrefix.setValue(DEFAULT_LABEL_PREFIX)
Exemple #2
0
    def __init__(self, *args, **kwargs):
        super(OpLabelPipeline, self).__init__(*args, **kwargs)
        self.opLabelArray = OpDenseLabelArray(parent=self)
        self.opLabelArray.MetaInput.connect(self.RawImage)
        self.opLabelArray.LabelSinkInput.connect(self.LabelInput)
        self.opLabelArray.EraserLabelValue.setValue(100)

        self.opBoxArray = OpDenseLabelArray(parent=self)
        self.opBoxArray.MetaInput.connect(self.RawImage)
        self.opBoxArray.LabelSinkInput.connect(self.BoxLabelInput)
        self.opBoxArray.EraserLabelValue.setValue(100)

        # Initialize the delete input to -1, which means "no label".
        # Now changing this input to a positive value will cause label deletions.
        # (The deleteLabel input is monitored for changes.)
        self.opLabelArray.DeleteLabel.setValue(-1)

        # 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)
Exemple #3
0
    def setup(self):
        graph = Graph()
        
        op = OpDenseLabelArray(graph=graph)
        arrayshape = (1,100,100,10,1)

        op.EraserLabelValue.setValue(100)

        dummyData = vigra.VigraArray(arrayshape, axistags=vigra.defaultAxistags('txyzc'))
        op.MetaInput.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.LabelSinkInput[slicing] = inputData
        data = numpy.zeros(arrayshape, dtype=numpy.uint8)
        data[slicing] = inputData
        
        self.op = op
        self.slicing = slicing
        self.inData = inputData
        self.data = data
Exemple #4
0
    def setup(self):
        graph = Graph()

        op = OpDenseLabelArray(graph=graph)
        arrayshape = (1, 100, 100, 10, 1)

        op.EraserLabelValue.setValue(100)

        dummyData = vigra.VigraArray(arrayshape,
                                     axistags=vigra.defaultAxistags("txyzc"))
        op.MetaInput.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.LabelSinkInput[slicing] = inputData
        data = numpy.zeros(arrayshape, dtype=numpy.uint8)
        data[slicing] = inputData

        self.op = op
        self.slicing = slicing
        self.inData = inputData
        self.data = data