예제 #1
0
    def fullReconstruction(self):
        from .widgets.volumeviewer import VolumeViewer
        volumeviewer = VolumeViewer()
        self.recontabs.addTab(volumeviewer, '????')

        currentitem = self.headermodel.item(self.rawtabview.currentIndex())
        if not currentitem:
            msg.showMessage(
                'Error: You must open files before reconstructing.')
        try:
            msg.showBusy()
            msg.showMessage('Running slice reconstruction...', level=msg.INFO)
            currentheader = self.headermodel.item(
                self.rawtabview.currentIndex()).header
            readprocess = self.workflow.processes[
                0]  # hopefully! TODO: require a readprocess first
            readprocess.path.value = currentheader.startdoc['path']

            numofsinograms = currentheader.meta_array('primary').shape[1]

            self.workflow.execute_all(None,
                                      readprocess=range(
                                          0, int(numofsinograms),
                                          int(readprocess.chunksize.value)))

        except Exception as ex:
            msg.logError(ex)
            msg.showReady()
            msg.clearMessage()
예제 #2
0
    def fullReconstruction(self):

        from xicam.Tomography.widgets.volumeviewer import VolumeViewer
        volumeviewer = VolumeViewer()
        self.recontabs.addTab(volumeviewer, '????')

        currentitem = self.headermodel.item(self.rawtabview.currentIndex())
        if not currentitem: msg.showMessage('Error: You must open files before reconstructing.')
        try:
            msg.showBusy()
            msg.showMessage('Running slice reconstruction...', level=msg.INFO)
            currentheader = self.headermodel.item(self.rawtabview.currentIndex()).header
            readprocess = self.workflow.processes[0]  # hopefully! TODO: require a readprocess first
            readprocess.path.value = currentheader.startdoc['path']

            numofsinograms = currentheader.meta_array('primary').shape[1]

            executor = DaskExecutor()
            client = distributed.Client()

            def chunkiterator(workflow):
                for i in range(0, int(numofsinograms), int(readprocess.chunksize.value)):
                    readprocess.sinoindex.value = i
                    yield executor.execute(workflow)

            _reconthread = QThreadFutureIterator(chunkiterator, self.workflow,
                                                 callback_slot=partial(self.showReconstruction, mode=self.fullrecon),
                                                 except_slot=self.exceptionCallback)
            _reconthread.start()
        except Exception as ex:
            msg.logError(ex)
            msg.showReady()
            msg.clearMessage()
예제 #3
0
    def showReconstruction(self, result, mode):
        print('result:', result)
        if mode == self.slice:
            sliceviewer = SliceViewer()
            sliceviewer.setImage(list(result.values())[0].value.squeeze())
            self.recontabs.addTab(sliceviewer, '????')

        if mode == self.fullrecon:
            self.recontabs.widget(self.recontabs.count() - 1).appendData(
                list(result.values())[0].value[::4, ::4, ::4])
        msg.showReady()
예제 #4
0
 def sliceReconstruct(self):
     currentitem = self.headermodel.item(self.rawtabview.currentIndex())
     if not currentitem: msg.showMessage('Error: You must open files before reconstructing.')
     try:
         msg.showBusy()
         msg.showMessage('Running slice reconstruction...', level=msg.INFO)
         paths = self.headermodel.item(self.rawtabview.currentIndex()).header.startdoc['paths']
         self.workflow.execute(None, paths=paths, threadkey='slicereconstruct',
                               callback_slot=partial(self.showReconstruction, mode=self.slice),
                               except_slot=self.exceptionCallback)
     except Exception as ex:
         msg.logError(ex)
         msg.showReady()
         msg.clearMessage()
예제 #5
0
    def process_queue(self):
        while True:
            try:
                priority_plan = self.queue.get(
                    block=True,
                    timeout=.1)  # timeout is arbitrary, we'll come right back
            except Empty:
                continue
            priority, (args,
                       kwargs) = priority_plan.priority, priority_plan.args

            self.sigStart.emit()
            msg.showBusy()
            try:
                self.RE(*args, **kwargs)
            except Exception as ex:
                msg.showMessage(
                    "An error occured during a Bluesky plan. See the Xi-CAM log for details."
                )
                msg.logError(ex)
                self.sigException.emit(ex)
            finally:
                msg.showReady()
            self.sigFinish.emit()
예제 #6
0
 def exceptionCallback(self, ex):
     msg.notifyMessage("Reconstruction failed;\n see log for error")
     msg.showMessage("Reconstruction failed; see log for error")
     msg.logError(ex)
     msg.showReady()