Commit 28c59197 authored by Robert's avatar Robert Committed by ohmacht@zwei-g.de

-adds progress dialog for merging of particle scout and gepard segmentation data

parent 7d9c56ff
......@@ -138,9 +138,15 @@ class SpecScanUI(QtWidgets.QWidget):
# if imported from particle scout
if self.dataset.stickToSeedPoints:
progress = QtWidgets.QProgressDialog('Applying ParticleScout data. Please wait.', '', 0, 100)
progress.setMinimumDuration(0)
progress.setCancelButton(None)
progress.setWindowModality(QtCore.Qt.WindowModal)
spectra = []
appointments = []
specScanIndex = 0
stepsDone = 0
step = 50/len(self.dataset.contourSeedMapping)
for contourIdx, seedpoints in self.dataset.contourSeedMapping.items():
# associate spectrum idx with measurement/particle/contour
# in some rare cases, multiple particle scout scan results lie within one gepard contour
......@@ -171,6 +177,10 @@ class SpecScanUI(QtWidgets.QWidget):
measurement.specScanIndex = specScanIndex
specScanIndex += 1
appointments.append(f"Spectrum {specScanIndex};100;{seedParticle['material']};yes;\n")
stepsDone += step
progress.setValue(math.floor(stepsDone))
step = 50/len(appointments)
# delete empty measurements
m2Del = [i for i, m in enumerate(self.dataset.particleContainer.measurements) if math.isnan(m.specScanIndex)]
self.dataset.particleContainer.measurements\
......@@ -189,8 +199,17 @@ class SpecScanUI(QtWidgets.QWidget):
fp.write("Search Spectrum Name;HQI 1;Found Spectrum Name 1;IsMarked;\n")
for line in appointments:
fp.write(line)
stepsDone += step
progress.setValue(math.floor(stepsDone))
progress.setValue(100)
self.dataset.stickToSeedPoints = False
progress.close()
QtWidgets.QMessageBox.information(
self, "Information",
'gepard can be closed now. Open result in gepardevaluation.',
QtWidgets.QMessageBox.Ok
)
@QtCore.pyqtSlot()
def cancelScan(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment