• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.ColortableLayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中volumina.api.ColortableLayer的典型用法代码示例。如果您正苦于以下问题:Python ColortableLayer类的具体用法?Python ColortableLayer怎么用?Python ColortableLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ColortableLayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setupLayers

    def setupLayers(self):
        """The LayerViewer base class calls this function to obtain
        the list of layers that should be displaye in the central
        viewer.

        """
        layers = []

        inputGrid = LazyflowSource(self.topLevelOperatorView.GridOutput)
        colortable = [QColor(0, 0, 0, 0).rgba(), QColor(255, 0, 0).rgba(),]
        gridlayer = ColortableLayer(inputGrid, colortable)
        gridlayer.name = "Grid"
        gridlayer.zeroIsTransparent = True
        layers.insert(0, gridlayer)

        # Show the raw input data as a convenience for the user
        inputImageSlot = self.topLevelOperatorView.RawInput
        if inputImageSlot.ready():
            inputLayer = self.createStandardLayerFromSlot(inputImageSlot)
            inputLayer.name = "Raw Input"
            inputLayer.visible = True
            inputLayer.opacity = 1.0
            layers.append(inputLayer)

        return layers
开发者ID:JensNRAD,项目名称:ilastik_public,代码行数:25,代码来源:patchCreatorGui.py


示例2: setupLayers

    def setupLayers(self):
        layers = []
        op = self.topLevelOperatorView
        binct = [QColor(Qt.black), QColor(Qt.white)]
        #binct[0] = 0
        ct = create_default_16bit()
        # associate label 0 with black/transparent?
        ct[0] = 0

        # Show the cached output, since it goes through a blocked cache
        if op.CachedOutput.ready():
            outputSrc = LazyflowSource(op.CachedOutput)
            outputLayer = ColortableLayer(outputSrc, ct)
            outputLayer.name = "Connected Components"
            outputLayer.visible = False
            outputLayer.opacity = 1.0
            outputLayer.setToolTip("Results of connected component analysis")
            layers.append(outputLayer)

        if op.Input.ready():
            rawSrc = LazyflowSource(op.Input)
            rawLayer = ColortableLayer(outputSrc, binct)
            #rawLayer = self.createStandardLayerFromSlot(op.Input)
            rawLayer.name = "Raw data"
            rawLayer.visible = True
            rawLayer.opacity = 1.0
            layers.append(rawLayer)

        return layers
开发者ID:JaimeIvanCervantes,项目名称:ilastik,代码行数:29,代码来源:connectedComponentsGui.py


示例3: createLabelLayer

    def createLabelLayer(self, direct=False):
        """
        Return a colortable layer that displays the label slot data, along with its associated label source.
        direct: whether this layer is drawn synchronously by volumina
        """
        labelOutput = self._labelingSlots.labelOutput
        if not labelOutput.ready():
            return (None, None)
        else:
            # Add the layer to draw the labels, but don't add any labels
            labelsrc = LazyflowSinkSource( self._labelingSlots.labelOutput,
                                           self._labelingSlots.labelInput)

            labellayer = ColortableLayer(labelsrc, colorTable = self._colorTable16, direct=direct)
            labellayer.name = "Labels"
            labellayer.ref_object = None

            labellayer.contexts.append(QAction("Import...", None,
                                        triggered=partial(import_labeling_layer, labellayer, self._labelingSlots, self)))

            labellayer.shortcutRegistration = ("0", ShortcutManager.ActionInfo(
                                                        "Labeling",
                                                        "LabelVisibility",
                                                        "Show/Hide Labels",
                                                        labellayer.toggleVisible,
                                                        self.viewerControlWidget(),
                                                        labellayer))

            return labellayer, labelsrc
开发者ID:ilastik,项目名称:ilastik,代码行数:29,代码来源:labelingGui.py


示例4: _initPredictionLayers

    def _initPredictionLayers(self, predictionSlot):
        layers = []

        opLane = self.topLevelOperatorView
        colors = opLane.PmapColors.value
        names = opLane.LabelNames.value

        # Use a slicer to provide a separate slot for each channel layer
        #opSlicer = OpMultiArraySlicer2( parent=opLane.viewed_operator() )
        #opSlicer.Input.connect( predictionSlot )
        #opSlicer.AxisFlag.setValue('c')

        if predictionSlot.ready() :
            from volumina import colortables
            predictLayer = ColortableLayer(LazyflowSource(predictionSlot), colorTable = colortables.jet(), normalize = 'auto')
            #predictLayer = AlphaModulatedLayer( predictsrc,
            #                                    tintColor=QColor(*colors[channel]),
            #                                    range=(0.0, 1.0),
            #                                    normalize=(0.0, 1.0) )
            predictLayer.opacity = 0.25
            predictLayer.visible = True
            predictLayer.name = "Prediction"
            layers.append(predictLayer)

        return layers
开发者ID:JensNRAD,项目名称:ilastik_public,代码行数:25,代码来源:countingBatchResultsGui.py


示例5: setupLayers

    def setupLayers(self):
        layers = []
        
        predictionSlot = self.topLevelOperatorView.PredictionImage
        if predictionSlot.ready():
            predictlayer = ColortableLayer( LazyflowSource(predictionSlot),
                                                 colorTable=self._colorTable16 )
            predictlayer.name = "Prediction"
            predictlayer.visible = True
            layers.append(predictlayer)

        rawSlot = self.topLevelOperatorView.RawImage
        if rawSlot.ready():
            rawLayer = self.createStandardLayerFromSlot(rawSlot)
            rawLayer.name = "Raw data"
            layers.append(rawLayer)

        binarySlot = self.topLevelOperatorView.BinaryImage
        if binarySlot.ready():
            ct_binary = [QColor(0, 0, 0, 0).rgba(),
                         QColor(255, 255, 255, 255).rgba()]
            binaryLayer = ColortableLayer(LazyflowSource(binarySlot), ct_binary)
            binaryLayer.name = "Binary Image"
            layers.append(binaryLayer)

        return layers
开发者ID:jennyhong,项目名称:ilastik,代码行数:26,代码来源:blockwiseObjectClassificationGui.py


示例6: setupLayers

    def setupLayers(self):
        """
        Called by our base class when one of our data slots has changed.
        This function creates a layer for each slot we want displayed in the volume editor.
        """
        # Base class provides the label layer.
        layers = super(Counting3dGui, self).setupLayers()

        # Add each of the predictions
        labels = self.labelListData
     


        slots = {'density' : self.op.Density}

        for name, slot in slots.items():
            if slot.ready():
                from volumina import colortables
                layer = ColortableLayer(LazyflowSource(slot), colorTable = colortables.jet(), normalize = 'auto')
                layer.name = name
                layers.append(layer)


        boxlabelsrc = LazyflowSinkSource(self.op.BoxLabelImages,self.op.BoxLabelInputs )
        boxlabellayer = ColortableLayer(boxlabelsrc, colorTable = self._colorTable16, direct = False)
        boxlabellayer.name = "boxLabels"
        boxlabellayer.opacity = 0.3
        layers.append(boxlabellayer)
        self.boxlabelsrc = boxlabelsrc


        inputDataSlot = self.topLevelOperatorView.InputImages
        if inputDataSlot.ready():
            inputLayer = self.createStandardLayerFromSlot( inputDataSlot )
            inputLayer.name = "Input Data"
            inputLayer.visible = True
            inputLayer.opacity = 1.0

            def toggleTopToBottom():
                index = self.layerstack.layerIndex( inputLayer )
                self.layerstack.selectRow( index )
                if index == 0:
                    self.layerstack.moveSelectedToBottom()
                else:
                    self.layerstack.moveSelectedToTop()

            inputLayer.shortcutRegistration = (
                "Prediction Layers",
                "Bring Input To Top/Bottom",
                QShortcut( QKeySequence("i"), self.viewerControlWidget(), toggleTopToBottom),
                inputLayer )
            layers.append(inputLayer)
        
        self.handleLabelSelectionChange()
        return layers
开发者ID:bheuer,项目名称:ilastik,代码行数:55,代码来源:counting3dGui.py


示例7: _initSegmentationlayer

 def _initSegmentationlayer(self, segSlot):
     if not segSlot.ready():
         return None
     opLane = self.topLevelOperatorView
     colors = opLane.PmapColors.value
     colortable = []
     colortable.append( QColor(0,0,0).rgba() )
     for color in colors:
         colortable.append( QColor(*color).rgba() )
     segsrc = LazyflowSource( segSlot )
     seglayer = ColortableLayer( segsrc, colortable )
     seglayer.name = "Simple Segmentation"
     return seglayer
开发者ID:sc65,项目名称:ilastik,代码行数:13,代码来源:pixelClassificationDataExportGui.py


示例8: addCCOperator

 def addCCOperator(self):
     self.opCC = OpConnectedComponents(self.g)
     self.opCC.inputs["Input"].connect(self.opThreshold.outputs["Output"])
     #we shouldn't have to define these. But just in case...
     self.opCC.inputs["Neighborhood"].setValue(6)
     self.opCC.inputs["Background"].setValue(0)
     
     ccsrc = LazyflowSource(self.opCC.outputs["Output"][0])
     ccsrc.setObjectName("Connected Components")
     ctb = colortables.create_default_16bit()
     ctb.insert(0, QColor(0, 0, 0, 0).rgba()) # make background transparent
     ccLayer = ColortableLayer(ccsrc, ctb)
     ccLayer.name = "Connected Components"
     self.layerstack.insert(1, ccLayer)
开发者ID:LimpingTwerp,项目名称:techpreview,代码行数:14,代码来源:classificationWorkflow_cc.py


示例9: createLabelLayer

    def createLabelLayer(self, direct=False):
        """
        Return a colortable layer that displays the label slot data, along with its associated label source.
        direct: whether this layer is drawn synchronously by volumina
        """
        labelOutput = self._labelingSlots.labelOutput
        if not labelOutput.ready():
            return (None, None)
        else:
            traceLogger.debug("Setting up labels")
            # Add the layer to draw the labels, but don't add any labels
            labelsrc = LazyflowSinkSource(self._labelingSlots.labelOutput, self._labelingSlots.labelInput)

            labellayer = ColortableLayer(labelsrc, colorTable=self._colorTable16, direct=direct)
            labellayer.name = "Labels"
            labellayer.ref_object = None

            return labellayer, labelsrc
开发者ID:jennyhong,项目名称:ilastik,代码行数:18,代码来源:labelingGui.py


示例10: createCropLayer

    def createCropLayer(self, direct=False):
        """
        Return a colortable layer that displays the crop slot data, along with its associated crop source.
        direct: whether this layer is drawn synchronously by volumina
        """
        cropOutput = self._croppingSlots.cropOutput
        if not cropOutput.ready():
            return (None, None)
        else:
            # Add the layer to draw the crops, but don't add any crops
            cropsrc = LazyflowSinkSource( self._croppingSlots.cropOutput,
                                           self._croppingSlots.cropInput)

            croplayer = ColortableLayer(cropsrc, colorTable = self._colorTable16, direct=direct )
            croplayer.name = "Crops"
            croplayer.ref_object = None

            return croplayer, cropsrc
开发者ID:ilastik,项目名称:ilastik,代码行数:18,代码来源:croppingGui.py


示例11: setupLayers

    def setupLayers(self):
        mainOperator = self.topLevelOperatorView
        layers = []

        if mainOperator.ObjectCenterImage.ready():
            self.centerimagesrc = LazyflowSource(mainOperator.ObjectCenterImage)
            #layer = RGBALayer(red=ConstantSource(255), alpha=self.centerimagesrc)
            redct = [0, QColor(255, 0, 0).rgba()]
            layer = ColortableLayer(self.centerimagesrc, redct)
            layer.name = "Object Centers"
            layer.visible = False
            layers.append(layer)

        ct = colortables.create_default_16bit()
        if mainOperator.LabelImage.ready():
            self.objectssrc = LazyflowSource(mainOperator.LabelImage)
            self.objectssrc.setObjectName("LabelImage LazyflowSrc")
            ct[0] = QColor(0, 0, 0, 0).rgba() # make 0 transparent
            layer = ColortableLayer(self.objectssrc, ct)
            layer.name = "Label Image"
            layer.visible = False
            layer.opacity = 0.5
            layers.append(layer)

        # white foreground on transparent background
        binct = [QColor(0, 0, 0, 0).rgba(), QColor(255, 255, 255, 255).rgba()]
        if mainOperator.BinaryImage.ready():
            self.binaryimagesrc = LazyflowSource(mainOperator.BinaryImage)
            self.binaryimagesrc.setObjectName("Binary LazyflowSrc")
            layer = ColortableLayer(self.binaryimagesrc, binct)
            layer.name = "Binary Image"
            layers.append(layer)

        ## raw data layer
        self.rawsrc = None
        self.rawsrc = LazyflowSource(mainOperator.RawImage)
        self.rawsrc.setObjectName("Raw Lazyflow Src")
        layerraw = GrayscaleLayer(self.rawsrc)
        layerraw.name = "Raw"
        layers.insert(len(layers), layerraw)

        mainOperator.RawImage.notifyReady(self._onReady)
        mainOperator.RawImage.notifyMetaChanged(self._onMetaChanged)

        if mainOperator.BinaryImage.meta.shape:
            self.editor.dataShape = mainOperator.BinaryImage.meta.shape
        mainOperator.BinaryImage.notifyMetaChanged(self._onMetaChanged)

        return layers
开发者ID:bheuer,项目名称:ilastik,代码行数:49,代码来源:objectExtractionGui.py


示例12: addThresholdOperator

 def addThresholdOperator(self):
     if self.opThreshold is None:
         self.opThreshold = OpThreshold(self.g)
         self.opThreshold.inputs["Input"].connect(self.pCache.outputs["Output"])
     #channel, value = ThresholdDlg(self.labelListModel._labels)
     channel = 0
     value = 0.5
     ref_label = self.labelListModel._labels[channel]
     self.opThreshold.inputs["Channel"].setValue(channel)
     self.opThreshold.inputs["Threshold"].setValue(value)
     threshsrc = LazyflowSource(self.opThreshold.outputs["Output"][0])
     
     threshsrc.setObjectName("Threshold for %s" % ref_label.name)
     transparent = QColor(0,0,0,0)
     white = QColor(255,255,255)
     colorTable = [transparent.rgba(), white.rgba()]
     threshLayer = ColortableLayer(threshsrc, colorTable = colorTable )
     threshLayer.name = "Threshold for %s" % ref_label.name
     self.layerstack.insert(1, threshLayer)
     self.CCButton.setEnabled(True)
开发者ID:LimpingTwerp,项目名称:techpreview,代码行数:20,代码来源:classificationWorkflow_cc.py


示例13: createLabelLayer

    def createLabelLayer(self, direct=False):
        """
        Return a colortable layer that displays the label slot data, along with its associated label source.
        direct: whether this layer is drawn synchronously by volumina
        """
        labelOutput = self._labelingSlots.labelOutput
        if not labelOutput.ready():
            return (None, None)
        else:
            # Add the layer to draw the labels, but don't add any labels
            labelsrc = LazyflowSinkSource( self._labelingSlots.labelOutput,
                                           self._labelingSlots.labelInput)

            labellayer = ColortableLayer(labelsrc, colorTable = self._colorTable16, direct=direct )
            labellayer.name = "Labels"
            labellayer.ref_object = None

            labellayer.contexts.append(("Import...",
                                        partial( import_labeling_layer, labellayer, self._labelingSlots, self )))

            return labellayer, labelsrc
开发者ID:jenspetersen,项目名称:ilastik,代码行数:21,代码来源:labelingGui.py


示例14: _initPredictionLayers

    def _initPredictionLayers(self, predictionSlot):
        layers = []

        opLane = self.topLevelOperatorView
        if predictionSlot.ready() and self.topLevelOperatorView.UpperBound.ready():
            upperBound = self.topLevelOperatorView.UpperBound.value
            layer = ColortableLayer(LazyflowSource(predictionSlot), colorTable = countingColorTable, normalize =
                               (0,upperBound))
            layer.name = "Density"
            layers.append(layer)

    

#    def _initPredictionLayers(self, predictionSlot):
#        layers = []
#
#        opLane = self.topLevelOperatorView
#        colors = opLane.PmapColors.value
#        names = opLane.LabelNames.value
#
#        # Use a slicer to provide a separate slot for each channel layer
#        opSlicer = OpMultiArraySlicer2( parent=opLane.viewed_operator() )
#        opSlicer.Input.connect( predictionSlot )
#        opSlicer.AxisFlag.setValue('c')
#
#        for channel, channelSlot in enumerate(opSlicer.Slices):
#            if channelSlot.ready() and channel < len(colors) and channel < len(names):
#                drange = channelSlot.meta.drange or (0.0, 1.0)
#                predictsrc = LazyflowSource(channelSlot)
#                predictLayer = AlphaModulatedLayer( predictsrc,
#                                                    tintColor=QColor(*colors[channel]),
#                                                    # FIXME: This is weird.  Why are range and normalize both set to the same thing?
#                                                    range=drange,
#                                                    normalize=drange )
#                predictLayer.opacity = 0.25
#                predictLayer.visible = True
#                predictLayer.name = names[channel]
#                layers.append(predictLayer)

        return layers
开发者ID:JensNRAD,项目名称:ilastik_public,代码行数:40,代码来源:countingDataExportGui.py


示例15: setupLayers

    def setupLayers(self):
        layers = []

        fromDiskSlot = self.topLevelOperatorView.ImageOnDisk
        if fromDiskSlot.ready():
            exportLayer = ColortableLayer( LazyflowSource(fromDiskSlot), colorTable=self.ct )
            exportLayer.name = "Tracking - Exported"
            exportLayer.visible = True
            layers.append(exportLayer)

        previewSlot = self.topLevelOperatorView.ImageToExport
        if previewSlot.ready():
            previewLayer = ColortableLayer( LazyflowSource(previewSlot), colorTable=self.ct )
            previewLayer.name = "Tracking - Preview"
            previewLayer.visible = False
            layers.append(previewLayer)

        rawSlot = self.topLevelOperatorView.RawData
        if rawSlot.ready():
            rawLayer = self.createStandardLayerFromSlot(rawSlot)
            rawLayer.name = "Raw Data"
            rawLayer.opacity = 1.0
            layers.append(rawLayer)

        return layers 
开发者ID:JensNRAD,项目名称:ilastik_public,代码行数:25,代码来源:trackingBaseDataExportGui.py


示例16: createLabelLayer

    def createLabelLayer(self, direct=False):
        """Return a colortable layer that displays the label slot
        data, along with its associated label source.

        direct: whether this layer is drawn synchronously by volumina

        """
        labelInput = self._labelingSlots.labelInput
        labelOutput = self._labelingSlots.labelOutput

        if not labelOutput.ready():
            return (None, None)
        else:
            self._colorTable16[15] = QColor(Qt.black).rgba() #for the objects with NaNs in features


            labelsrc = LazyflowSinkSource(labelOutput,
                                          labelInput)
            labellayer = ColortableLayer(labelsrc,
                                         colorTable=self._colorTable16,
                                         direct=direct)

            labellayer.segmentationImageSlot = self.op.SegmentationImagesOut
            labellayer.name = "Labels"
            labellayer.ref_object = None
            labellayer.zeroIsTransparent  = False
            labellayer.colortableIsRandom = True

            clickInt = ClickInterpreter(self.editor, labellayer,
                                        self.onClick, right=False,
                                        double=False)
            self.editor.brushingInterpreter = clickInt

            return labellayer, labelsrc
开发者ID:CVML,项目名称:ilastik,代码行数:34,代码来源:objectClassificationGui.py


示例17: setupLayers

    def setupLayers(self):
        layers = []
        opLane = self.topLevelOperatorView

        labelSlot = opLane.LabelImage
        if labelSlot.ready():
            labelImageLayer = ColortableLayer( LazyflowSource(labelSlot),
                                               colorTable=self._colorTable16 )
            labelImageLayer.name = "Label Image"
            labelImageLayer.visible = True
            layers.append(labelImageLayer)
        
        # If available, also show the raw data layer
        rawSlot = opLane.RawImage
        if rawSlot.ready():
            rawLayer = self.createStandardLayerFromSlot( rawSlot )
            rawLayer.name = "Raw Data"
            rawLayer.visible = True
            rawLayer.opacity = 1.0
            layers.append( rawLayer )

        return layers
开发者ID:bheuer,项目名称:ilastik,代码行数:22,代码来源:labelImageViewerGui.py


示例18: setupLayers

    def setupLayers(self):
        layers = []        
        op = self.topLevelOperatorView
        binct = [QColor(Qt.black), QColor(Qt.white)]
        ct = self._createDefault16ColorColorTable()
        ct[0]=0
        # Show the cached output, since it goes through a blocked cache
        
        if op.CachedOutput.ready():
            outputSrc = LazyflowSource(op.CachedOutput)
            outputLayer = ColortableLayer(outputSrc, binct)
            outputLayer.name = "Output (Cached)"
            outputLayer.visible = False
            outputLayer.opacity = 1.0
            layers.append(outputLayer)

        #FIXME: We have to do that, because lazyflow doesn't have a way to make an operator partially ready
        curIndex = self._drawer.tabWidget.currentIndex()
        if curIndex==1:
            if op.BigRegions.ready():
                lowThresholdSrc = LazyflowSource(op.BigRegions)
                lowThresholdLayer = ColortableLayer(lowThresholdSrc, binct)
                lowThresholdLayer.name = "Big Regions"
                lowThresholdLayer.visible = False
                lowThresholdLayer.opacity = 1.0
                layers.append(lowThresholdLayer)
    
            if op.FilteredSmallLabels.ready():
                filteredSmallLabelsLayer = self.createStandardLayerFromSlot( op.FilteredSmallLabels )
                filteredSmallLabelsLayer.name = "Filtered Small Labels"
                filteredSmallLabelsLayer.visible = False
                filteredSmallLabelsLayer.opacity = 1.0
                layers.append(filteredSmallLabelsLayer)
    
            if op.SmallRegions.ready():
                highThresholdSrc = LazyflowSource(op.SmallRegions)
                highThresholdLayer = ColortableLayer(highThresholdSrc, binct)
                highThresholdLayer.name = "Small Regions"
                highThresholdLayer.visible = False
                highThresholdLayer.opacity = 1.0
                layers.append(highThresholdLayer)
        elif curIndex==0:
            if op.BeforeSizeFilter.ready():
                thSrc = LazyflowSource(op.BeforeSizeFilter)
                thLayer = ColortableLayer(thSrc, binct)
                thLayer.name = "Thresholded Labels"
                thLayer.visible = False
                thLayer.opacity = 1.0
                layers.append(thLayer)
        
        # Selected input channel, smoothed.
        if op.Smoothed.ready():
            smoothedLayer = self.createStandardLayerFromSlot( op.Smoothed )
            smoothedLayer.name = "Smoothed Input"
            smoothedLayer.visible = True
            smoothedLayer.opacity = 1.0
            layers.append(smoothedLayer)
        
        # Show the selected channel
        if op.InputChannel.ready():
            drange = op.InputChannel.meta.drange
            if drange is None:
                drange = (0.0, 1.0)
            channelSrc = LazyflowSource(op.InputChannel)
            channelLayer = AlphaModulatedLayer( channelSrc,
                                                tintColor=QColor(self._channelColors[op.Channel.value]),
                                                range=drange,
                                                normalize=drange )
            channelLayer.name = "Input Ch{}".format(op.Channel.value)
            channelLayer.opacity = 1.0
            #channelLayer.visible = channelIndex == op.Channel.value # By default, only the selected input channel is visible.    
            layers.append(channelLayer)
        
        # Show the raw input data
        rawSlot = self.topLevelOperatorView.RawInput
        if rawSlot.ready():
            rawLayer = self.createStandardLayerFromSlot( rawSlot )
            rawLayer.name = "Raw Data"
            rawLayer.visible = True
            rawLayer.opacity = 1.0
            layers.append(rawLayer)

        return layers
开发者ID:bheuer,项目名称:ilastik,代码行数:83,代码来源:thresholdTwoLevelsGui.py


示例19: setupLayers

    def setupLayers( self ):        
        layers = []
                        
        self.ct[0] = QColor(0,0,0,0).rgba() # make 0 transparent        
        self.ct[255] = QColor(0,0,0,255).rgba() # make -1 black
        self.ct[-1] = QColor(0,0,0,255).rgba()
        self.trackingsrc = LazyflowSource( self.topLevelOperatorView.TrackImage )
        trackingLayer = ColortableLayer( self.trackingsrc, self.ct )
        trackingLayer.name = "Manual Tracking"
        trackingLayer.visible = True
        trackingLayer.opacity = 0.8

        def toggleTrackingVisibility():
            trackingLayer.visible = not trackingLayer.visible
            
        trackingLayer.shortcutRegistration = (
                "Layer Visibilities",
                "Toggle Manual Tracking Layer Visibility",
                QtGui.QShortcut( QtGui.QKeySequence("e"), self.viewerControlWidget(), toggleTrackingVisibility),
                trackingLayer )
        layers.append(trackingLayer)
        
        
        ct = colortables.create_random_16bit()
        ct[1] = QColor(230,0,0,150).rgba()
        ct[0] = QColor(0,0,0,0).rgba() # make 0 transparent
        self.untrackedsrc = LazyflowSource( self.topLevelOperatorView.UntrackedImage )
        untrackedLayer = ColortableLayer( self.untrackedsrc, ct )
        untrackedLayer.name = "Untracked Objects"
        untrackedLayer.visible = False
        untrackedLayer.opacity = 0.8
        layers.append(untrackedLayer)
        
        self.objectssrc = LazyflowSource( self.topLevelOperatorView.BinaryImage )
        ct = colortables.create_random_16bit()
        ct[0] = QColor(0,0,0,0).rgba() # make 0 transparent
        ct[1] = QColor(255,255,0,100).rgba() 
        objLayer = ColortableLayer( self.objectssrc, ct )
        objLayer.name = "Objects"
        objLayer.opacity = 0.8
        objLayer.visible = True
        
        def toggleObjectVisibility():
            objLayer.visible = not objLayer.visible
            
        objLayer.shortcutRegistration = (
                "Layer Visibilities",
                "Toggle Objects Layer Visibility",
                QtGui.QShortcut( QtGui.QKeySequence("r"), self.viewerControlWidget(), toggleObjectVisibility),
                objLayer )
        
        layers.append(objLayer)


        ## raw data layer
        self.rawsrc = None
        self.rawsrc = LazyflowSource( self.mainOperator.RawImage )
        rawLayer = GrayscaleLayer( self.rawsrc )
        rawLayer.name = "Raw"        
        layers.insert( len(layers), rawLayer )   
        
        
        if self.topLevelOperatorView.LabelImage.meta.shape:
            self.editor.dataShape = self.topLevelOperatorView.LabelImage.meta.shape    
        
        self.topLevelOperatorView.RawImage.notifyReady( self._onReady )
        self.topLevelOperatorView.RawImage.notifyMetaChanged( self._onMetaChanged )
        
        self._setDivisionsList()
        self._setActiveTrackList()
        
        return layers
开发者ID:jennyhong,项目名称:ilastik,代码行数:72,代码来源:manualTrackingGui.py


示例20: setupLayers

    def setupLayers(self):
        mainOperator = self.topLevelOperatorView
        layers = []

        if mainOperator.ObjectCenterImage.ready():
            self.centerimagesrc = LazyflowSource(mainOperator.ObjectCenterImage)
            redct = [0, QColor(255, 0, 0).rgba()]
            layer = ColortableLayer(self.centerimagesrc, redct)
            layer.name = "Object centers"
            layer.setToolTip("Object center positions, marked with a little red cross")
            layer.visible = False
            layers.append(layer)

        ct = colortables.create_default_16bit()
        if mainOperator.LabelImage.ready():
            self.objectssrc = LazyflowSource(mainOperator.LabelImage)
            self.objectssrc.setObjectName("LabelImage LazyflowSrc")
            ct[0] = QColor(0, 0, 0, 0).rgba() # make 0 transparent
            layer = ColortableLayer(self.objectssrc, ct)
            layer.name = "Objects (connected components)"
            layer.setToolTip("Segmented objects, shown in different colors")
            layer.visible = False
            layer.opacity = 0.5
            layers.append(layer)

        # white foreground on transparent background, even for labeled images
        binct = [QColor(255, 255, 255, 255).rgba()]*65536
        binct[0] = 0
        if mainOperator.BinaryImage.ready():
            self.binaryimagesrc = LazyflowSource(mainOperator.BinaryImage)
            self.binaryimagesrc.setObjectName("Binary LazyflowSrc")
            layer = ColortableLayer(self.binaryimagesrc, binct)
            layer.name = "Binary image"
            layer.setToolTip("Segmented objects, binary mask")
            layers.append(layer)

        ## raw data layer
        self.rawsrc = None
        self.rawsrc = LazyflowSource(mainOperator.RawImage)
        self.rawsrc.setObjectName("Raw Lazyflow Src")
        layerraw = GrayscaleLayer(self.rawsrc)
        layerraw.name = "Raw data"
        layers.insert(len(layers), layerraw)

        mainOperator.RawImage.notifyReady(self._onReady)
        self.__cleanup_fns.append( partial( mainOperator.RawImage.unregisterReady, self._onReady ) )

        mainOperator.RawImage.notifyMetaChanged(self._onMetaChanged)
        self.__cleanup_fns.append( partial( mainOperator.RawImage.unregisterMetaChanged, self._onMetaChanged ) )

        if mainOperator.BinaryImage.meta.shape:
            self.editor.dataShape = mainOperator.BinaryImage.meta.shape

        mainOperator.BinaryImage.notifyMetaChanged(self._onMetaChanged)
        self.__cleanup_fns.append( partial( mainOperator.BinaryImage.unregisterMetaChanged, self._onMetaChanged ) )

        return layers
开发者ID:burcin,项目名称:ilastik,代码行数:57,代码来源:objectExtractionGui.py



注:本文中的volumina.api.ColortableLayer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python api.GrayscaleLayer类代码示例发布时间:2022-05-26
下一篇:
Python api.AlphaModulatedLayer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap