当前位置: 首页>>代码示例>>Python>>正文


Python api.ColortableLayer类代码示例

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


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


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