Exemplo n.º 1
0
    def on_btnChooseOverlay_clicked(self):
        dlg = OverlaySelectionDialog(self.parent, singleSelection=True)
        answer = dlg.exec_()

        if len(answer) > 0:
            import ilastik.core.overlays.selectionOverlay
            if self.parent.project.dataMgr[
                    self.parent._activeImageNumber].overlayMgr[
                        "Objects/Selection Result"] is None:
                ov = ilastik.core.overlays.selectionOverlay.SelectionOverlay(
                    answer[0]._data,
                    color=long(QtGui.QColor(0, 255, 255).rgba()))
                ov.displayable3D = True
                ov.backgroundClasses = set([0])
                ov.smooth3D = True

                self.parent.project.dataMgr[
                    self.parent._activeImageNumber].overlayMgr[
                        "Objects/Selection Result"] = ov
                ov = self.parent.project.dataMgr[
                    self.parent.
                    _activeImageNumber].overlayMgr["Objects/Selection Result"]

            ref = answer[0].getRef()
            ref.setAlpha(0.4)
            self.parent.labelWidget.overlayWidget.addOverlayRef(ref)

            self.parent.project.dataMgr[
                self.parent.project.dataMgr.
                _activeImageNumber].Object_Picking.setInputData(
                    answer[0]._data)

            self.parent.labelWidget.repaint()
 def on_btnChooseWeights_clicked(self):
     #First question: Which overlay?
     dlg = OverlaySelectionDialog(self.ilastik,  singleSelection = True)
     answer = dlg.exec_()
     if len(answer) == 0: return #dialog was dismissed
     
     s = self.ilastik._activeImage.Interactive_Segmentation
     
     overlay = answer[0]
     self.parent.labelWidget.overlayWidget.addOverlayRef(overlay.getRef())
     volume = overlay._data[0,:,:,:,0]
     
     #Second question: Which border indicator?            
     borderIndicator = QtGui.QInputDialog.getItem(self.ilastik, \
                       "Select Border Indicator",  "Indicator",  \
                       ["Brightness",  "Darkness", "Gradient Magnitude"], \
                       editable = False)
     if not borderIndicator[1]: return #Dialog was dismissed
     
     borderIndicator = str(borderIndicator[0])
     
     #Write the choice of weights to a file so that they can be reproduced
     if s.outputPath:
         f = open(s.outputPath+'/'+'config.txt', 'w')
         f.write("overlay=%s\n" % (dlg.selectedOverlayPaths[0]))
         f.write("borderIndicator=%s" % (borderIndicator))
         f.close()
     
     #calculate the weights
     #this will call on_setupWeights via a signal/slot connection
     s.calculateWeights(volume, borderIndicator)
Exemplo n.º 3
0
    def on_btnChooseWeights_clicked(self):
        dlg = OverlaySelectionDialog(self.ilastik, singleSelection=True)
        answer = dlg.exec_()

        if len(answer) > 0:
            overlay = answer[0]
            self.parent.labelWidget.overlayWidget.addOverlayRef(
                overlay.getRef())

            volume = overlay._data[0, :, :, :, 0]

            borderIndicator = QtGui.QInputDialog.getItem(
                self.ilastik,
                "Select border indicator type",
                "Select the border probability type : \n (Normal: bright pixels mean high border probability, Inverted: dark pixels mean high border probability) ",
                ["Normal", "Inverted"],
                editable=False)
            borderIndicator = str(borderIndicator[0])
            if borderIndicator == "Normal":
                weights = volume[:, :, :]
            elif borderIndicator == "Inverted":
                weights = self.parent.project.dataMgr.Automatic_Segmentation.invertPotential(
                    volume)
            weights = self.parent.project.dataMgr.Automatic_Segmentation.normalizePotential(
                weights)

            self.weights = weights
Exemplo n.º 4
0
 def on_btnInputOverlay_clicked(self):
     dlg = OverlaySelectionDialog(self.ilastik,  singleSelection = True)
     answer = dlg.exec_()
     
     if len(answer) > 0:
         overlay = answer[0]
         self.parent.labelWidget.overlayWidget.addOverlayRef(overlay.getRef())
         print overlay.key
         self.parent.project.dataMgr.connCompBackgroundKey = overlay.key
         
     self.btnCC.setEnabled(True)
     self.btnCCBack.setEnabled(True)
 def on_btnInputOverlay_clicked(self):
     dlg = OverlaySelectionDialog(self.ilastik,  singleSelection = True)
     answer = dlg.exec_()
     
     if len(answer) > 0:
         ref = answer[0].getRef()
         ref.setAlpha(0.4)
         self.inputOverlay = answer[0]
         self.parent.labelWidget.overlayWidget.addOverlayRef(ref)
         self.parent.project.dataMgr[self.parent.project.dataMgr._activeImageNumber].Connected_Components.setInputData(answer[0]._data)
         self.parent.labelWidget.repaint()
         self.btnCC.setEnabled(True)
         self.btnCCBack.setEnabled(True)
Exemplo n.º 6
0
    def on_btnInputOverlay_clicked(self):
        dlg = OverlaySelectionDialog(self.ilastik, singleSelection=True)
        answer = dlg.exec_()

        if len(answer) > 0:
            ref = answer[0].getRef()
            ref.setAlpha(0.4)
            self.inputOverlay = answer[0]
            self.parent.labelWidget.overlayWidget.addOverlayRef(ref)
            self.parent.project.dataMgr[
                self.parent.project.dataMgr.
                _activeImageNumber].Connected_Components.setInputData(
                    answer[0]._data)
            self.parent.labelWidget.repaint()
            self.btnCC.setEnabled(True)
            self.btnCCBack.setEnabled(True)
Exemplo n.º 7
0
 def on_btnChooseOverlays_clicked(self):
     dlg = OverlaySelectionDialog(self.parent,  singleSelection = False)
     overlays = dlg.exec_()
     
     if len(overlays) > 0:
         self.overlays = overlays
         # add all overlays
         for overlay in overlays:
             ref = overlay.getRef()
             ref.setAlpha(0.4)
             self.parent.labelWidget.overlayWidget.addOverlayRef(ref)
             
         self.parent.labelWidget.repaint()
         self.btnDecompose.setEnabled(True)
     else:
         self.btnDecompose.setEnabled(False)         
    def on_btnChooseWeights_clicked(self):
        dlg = OverlaySelectionDialog(self.ilastik,  singleSelection = True)
        answer = dlg.exec_()
        
        if len(answer) > 0:
            overlay = answer[0]
            self.parent.labelWidget.overlayWidget.addOverlayRef(overlay.getRef())
            
            volume = overlay._data[0,:,:,:,0]
            
            borderIndicator = QtGui.QInputDialog.getItem(self.ilastik, "Select border indicator type", "Select the border probability type : \n (Normal: bright pixels mean high border probability, Inverted: dark pixels mean high border probability) ",  ["Normal",  "Inverted"],  editable = False)
            borderIndicator = str(borderIndicator[0])
            if borderIndicator == "Normal":
                weights = volume[:,:,:]
            elif borderIndicator == "Inverted":            
                weights = self.parent.project.dataMgr.Automatic_Segmentation.invertPotential(volume)
            weights = self.parent.project.dataMgr.Automatic_Segmentation.normalizePotential(weights)

            self.weights = weights
 def on_btnChooseOverlay_clicked(self):
     dlg = OverlaySelectionDialog(self.parent,  singleSelection = True)
     answer = dlg.exec_()
     
     if len(answer) > 0:
         import ilastik.core.overlays.selectionOverlay
         if self.parent.project.dataMgr[self.parent._activeImageNumber].overlayMgr["Objects/Selection Result"] is None:
             ov = ilastik.core.overlays.selectionOverlay.SelectionOverlay(answer[0]._data, color = long(QtGui.QColor(0,255,255).rgba()))
             ov.displayable3D = True
             ov.backgroundClasses = set([0])
             ov.smooth3D = True
             
             self.parent.project.dataMgr[self.parent._activeImageNumber].overlayMgr["Objects/Selection Result"] = ov
             ov = self.parent.project.dataMgr[self.parent._activeImageNumber].overlayMgr["Objects/Selection Result"]
         
         ref = answer[0].getRef()
         ref.setAlpha(0.4)
         self.parent.labelWidget.overlayWidget.addOverlayRef(ref)
         
         self.parent.project.dataMgr[self.parent.project.dataMgr._activeImageNumber].Object_Picking.setInputData(answer[0]._data)
             
         self.parent.labelWidget.repaint()