Пример #1
0
    def onExport():
        sourceTags = [True for l in layer.datasources]
        for i, source in enumerate(layer.datasources):
            if not hasattr(source, "dataSlot"):
                 sourceTags[i] = False
        if not any(sourceTags):
            raise RuntimeError("can not export from a non-lazyflow data source (layer=%r, datasource=%r)" % (type(layer), type(layer.datasources[0])) )


        expDlg = ExportDialog(parent = menu, layername = layer.name)
        if not _has_lazyflow:
            raise RuntimeError("lazyflow not installed") 
        import lazyflow
        dataSlots = [slot.dataSlot for (slot, isSlot) in
                     zip(layer.datasources, sourceTags) if isSlot is True]
        op = lazyflow.operators.OpMultiArrayStacker(dataSlots[0].getRealOperator())
        for slot in dataSlots:
            assert isinstance(slot, lazyflow.graph.Slot), "slot is of type %r" % (type(slot))
            assert isinstance(slot.getRealOperator(), lazyflow.graph.Operator), "slot's operator is of type %r" % (type(slot.getRealOperator()))
        op.AxisFlag.setValue("c")
        op.Images.resize(len(dataSlots))
        for i,islot in enumerate(op.Images):
            islot.connect(dataSlots[i])
        expDlg.setInput(op.Output)

        expDlg.show()
Пример #2
0
 def onExport():
     if _has_lazyflow:
         inputArray = layer.datasources[0].request((slice(None),)).wait()
         expDlg = ExportDialog(parent = menu)
         g = Graph()
         piper = OpArrayPiper(graph=g)
         piper.inputs["Input"].setValue(inputArray)
         expDlg.setInput(piper.outputs["Output"],g)
     expDlg.show()
Пример #3
0
    def onExport():
        sourceTags = [True for l in layer.datasources]
        for i, source in enumerate(layer.datasources):
            if not hasattr(source, "dataSlot"):
                sourceTags[i] = False
        if not any(sourceTags):
            raise RuntimeError(
                "can not export from a non-lazyflow data source (layer=%r, datasource=%r)"
                % (type(layer), type(layer.datasources[0])))

        expDlg = ExportDialog(parent=menu, layername=layer.name)
        if not _has_lazyflow:
            raise RuntimeError("lazyflow not installed")
        import lazyflow
        dataSlots = [
            slot.dataSlot
            for (slot, isSlot) in zip(layer.datasources, sourceTags)
            if isSlot is True
        ]
        op = lazyflow.operators.OpMultiArrayStacker(
            dataSlots[0].getRealOperator())
        for slot in dataSlots:
            assert isinstance(
                slot, lazyflow.graph.Slot), "slot is of type %r" % (type(slot))
            assert isinstance(
                slot.getRealOperator(),
                lazyflow.graph.Operator), "slot's operator is of type %r" % (
                    type(slot.getRealOperator()))
        op.AxisFlag.setValue("c")
        op.Images.resize(len(dataSlots))
        for i, islot in enumerate(op.Images):
            islot.connect(dataSlots[i])
        expDlg.setInput(op.Output)

        expDlg.show()
Пример #4
0
 def _save(self):
     exportDlg = ExportDialog()
     exportDlg.setInput(self.workflow.images.outputs["Outputs"][0], self.g)
     exportDlg.exec_()