Commit ab5fab1e authored by Josef Brandt's avatar Josef Brandt

Remove access to particle analysis from main gepard

parent cde94554
......@@ -190,11 +190,6 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.ramanScanAct.setCheckable(True)
self.ramanScanAct.triggered.connect(QtCore.pyqtSlot()(lambda :self.view.switchMode("RamanScan")))
self.particelAnalysisAct = QtWidgets.QAction("Particle analysis", self)
self.particelAnalysisAct.setEnabled(False)
self.particelAnalysisAct.setCheckable(True)
self.particelAnalysisAct.triggered.connect(QtCore.pyqtSlot()(lambda :self.view.switchMode("ParticleAnalysis")))
self.snapshotAct = QtWidgets.QAction("Save Screenshot", self)
self.snapshotAct.triggered.connect(self.view.takeScreenshot)
self.snapshotAct.setDisabled(True)
......@@ -222,15 +217,13 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
act.setDisabled(True)
def updateModes(self, active=None, maxenabled=None):
ose, osc, pde, pdc, rse, rsc, pae, pac = [False]*8
ose, osc, pde, pdc, rse, rsc = [False]*6
if maxenabled=="OpticalScan":
ose = True
elif maxenabled=="ParticleDetection":
ose, pde = True, True
elif maxenabled=="RamanScan":
ose, pde, rse = True, True, True
elif maxenabled=="ParticleAnalysis":
ose, pde, rse, pae = True, True, True, True
if active=="OpticalScan" and ose:
osc = True
......@@ -238,17 +231,13 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
pdc = True
elif active=="RamanScan" and rse:
rsc = True
elif active=="ParticleAnalysis" and pae:
pac = True
self.opticalScanAct.setEnabled(ose)
self.opticalScanAct.setChecked(osc)
self.detectParticleAct.setEnabled(pde)
self.detectParticleAct.setChecked(pdc)
self.ramanScanAct.setEnabled(rse)
self.ramanScanAct.setChecked(rsc)
self.particelAnalysisAct.setEnabled(pae)
self.particelAnalysisAct.setChecked(pac)
def unblockUI(self, connected):
self.openAct.setEnabled(True)
......@@ -267,7 +256,6 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.opticalScanAct.setEnabled(False)
self.detectParticleAct.setEnabled(False)
self.ramanScanAct.setEnabled(False)
self.particelAnalysisAct.setEnabled(False)
def updateConnected(self, connected):
if connected:
......@@ -295,7 +283,6 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.modeMenu = QtWidgets.QMenu("&Mode", self)
self.modeMenu.addAction(self.opticalScanAct)
self.modeMenu.addAction(self.detectParticleAct)
self.modeMenu.addAction(self.particelAnalysisAct)
self.toolsMenu = QtWidgets.QMenu("&Tools")
self.toolsMenu.addAction(self.snapshotAct)
......@@ -336,7 +323,6 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.toolbar.addAction(self.opticalScanAct)
self.toolbar.addAction(self.detectParticleAct)
self.toolbar.addAction(self.ramanScanAct)
self.toolbar.addAction(self.particelAnalysisAct)
self.toolbar.addSeparator()
self.toolbar.addAction(self.exitAct)
self.toolbar.setOrientation(QtCore.Qt.Vertical)
......
......@@ -506,5 +506,5 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
if window is not None:
window.close()
self.viewparent.imparent.particelAnalysisAct.setChecked(False)
# self.viewparent.imparent.particelAnalysisAct.setChecked(False)
event.accept()
\ No newline at end of file
......@@ -21,17 +21,15 @@ If not, see <https://www.gnu.org/licenses/>.
from PyQt5 import QtCore, QtGui, QtWidgets
import numpy as np
import os
import cv2
import time
from .dataset import DataSet, loadData
from .ramancom.ramancontrol import RamanControl, simulatedRaman
from .opticalscan import OpticalScan
from .ramanscanui import RamanScanUI
from .detectionview import ParticleDetectionView
from .analysis.analysisview import ParticleAnalysis
from .zeissimporter import ZeissImporter
from .viewitems import FitPosIndicator, Node, Edge, ScanIndicator, RamanScanIndicator, SegmentationContour, ParticleInfo, SeedPoint
from .helperfunctions import polygoncovering, cv2imread_fix
from .helperfunctions import polygoncovering
from .analysis.colorlegend import getColorFromNameWithSeed
from .analysis.particleEditor import ParticleEditor
from .ramancom.configRaman import RamanConfigWin
......@@ -98,7 +96,6 @@ class SampleView(QtWidgets.QGraphicsView):
self.oscanwidget = OpticalScan(self.ramanctrl, None, self.logpath, self)
self.oscanwidget.imageUpdate.connect(self.loadPixmap)
self.oscanwidget.boundaryUpdate.connect(self.resetBoundary)
self.analysiswidget = None
self.setMinimumSize(600, 600)
self.darkenPixmap = False
self.microscopeMode = None
......@@ -143,8 +140,6 @@ class SampleView(QtWidgets.QGraphicsView):
self.oscanwidget.close()
if self.detectionwidget is not None:
self.detectionwidget.close()
if self.analysiswidget is not None:
self.analysiswidget.close()
self.ramanwidget.close()
else:
event.ignore()
......@@ -198,12 +193,9 @@ class SampleView(QtWidgets.QGraphicsView):
"""
if mode is None:
return
assert mode in ["OpticalScan", "ParticleDetection", "RamanScan", "ParticleAnalysis"]
assert mode in ["OpticalScan", "ParticleDetection", "RamanScan"]
print("switching to mode:", mode, flush=True)
self.oscanwidget.setVisible(False)
# if self.detectionwidget is not None:
# self.detectionwidget.close()
# self.detectionwidget = None
self.ramanwidget.setVisible(False)
self.mode = mode
self.loadPixmap(self.microscopeMode)
......@@ -220,7 +212,6 @@ class SampleView(QtWidgets.QGraphicsView):
self.dataset,
self
)
#self.detectionwidget = ParticleDetectionView(self.imgdata, self.dataset, self)
self.detectionwidget.imageUpdate.connect(self.detectionUpdate)
self.detectionwidget.detectionFinished.connect(self.activateMaxMode)
self.updateSeedPointMarkers()
......@@ -231,22 +222,6 @@ class SampleView(QtWidgets.QGraphicsView):
self.ramanwidget.resetDataset(self.dataset)
self.ramanwidget.setVisible(True)
elif mode == "ParticleAnalysis":
self.removeSeedPointMarkers()
if self.ramanwidget.isVisible():
self.ramanwidget.setVisible(False)
if self.analysiswidget is None:
print('creating new analysiswidget')
self.analysiswidget = ParticleAnalysis(self.dataset, self)
self.analysiswidget.showMaximized()
self.setupParticleEditor()
else:
print('show maximized already exisiting analysiswidget')
self.analysiswidget.showMaximized()
if self.detectionwidget is not None:
self.detectionwidget.setVisible(False)
#show legend:
self.imparent.legend.show()
......@@ -258,7 +233,7 @@ class SampleView(QtWidgets.QGraphicsView):
self.saveDataSet()
#close all widgets
for widget in [self.detectionwidget, self.ramanwidget, self.oscanwidget, self.analysiswidget]:
for widget in [self.detectionwidget, self.ramanwidget, self.oscanwidget]:
if widget is not None:
widget.close()
widget.destroy()
......@@ -312,9 +287,6 @@ class SampleView(QtWidgets.QGraphicsView):
self.particleEditor = ParticleEditor(self, self.dataset.particleContainer)
tryDisconnectingSignal(self.particleEditor.particleAssignmentChanged)
if self.analysiswidget is not None:
self.particleEditor.particleAssignmentChanged.connect(self.analysiswidget.updatePlotsAndContours)
self.particleEditor.particleAssignmentChanged.connect(self.analysiswidget.updateWidgetContents)
def setMicroscopeMode(self):
"""
......@@ -331,7 +303,7 @@ class SampleView(QtWidgets.QGraphicsView):
def activateMaxMode(self, loadnew=False):
"""
Activates the "highest" available mode of gepard. The modes follow gepard's operation workflow:
OpticalScan, ParticleDetection, RamanScan, ParticleAnalysis
OpticalScan, ParticleDetection, RamanScan
:return:
"""
mode = self.getMaxMode()
......@@ -341,7 +313,7 @@ class SampleView(QtWidgets.QGraphicsView):
def getMaxMode(self):
"""
Determines the "highest" available mode of gepard. The modes follow gepard's operation workflow:
OpticalScan, ParticleDetection, RamanScan, ParticleAnalysis
OpticalScan, ParticleDetection, RamanScan
:return:
"""
if self.dataset is None:
......@@ -355,8 +327,7 @@ class SampleView(QtWidgets.QGraphicsView):
maxmode = "ParticleDetection"
if self.dataset.particleDetectionDone:
maxmode = "RamanScan"
if self.dataset.ramanscandone:
maxmode = "ParticleAnalysis"
return maxmode
def blockUI(self):
......@@ -374,16 +345,14 @@ class SampleView(QtWidgets.QGraphicsView):
if self.particlePainter is None:
if event.button()==QtCore.Qt.LeftButton:
if self.analysiswidget is not None:
self.checkForContourSelection(event)
if self.mode in ["OpticalScan", "RamanScan"] and event.modifiers()==QtCore.Qt.ControlModifier:
p0 = self.mapToScene(event.pos())
self.moveStageToPosition(p0)
elif self.mode=="ParticleDetection":
p0 = self.mapToScene(event.pos())
self.detectionwidget.setImageCenter([p0.x(), p0.y()])
# elif self.mode=="ParticleDetection":
# p0 = self.mapToScene(event.pos())
# self.detectionwidget.setImageCenter([p0.x(), p0.y()])
else:
p0 = self.mapToScene(event.pos())
......@@ -561,7 +530,7 @@ class SampleView(QtWidgets.QGraphicsView):
else:
#data = self.imgdata
#fname = self.dataset.getImageName()
if self.mode == "ParticleDetection" or self.mode == "ParticleAnalysis":
if self.mode == "ParticleDetection":
self.resetParticleContours()
#if data is None and os.path.exists(fname):
# data = cv2imread_fix(fname)
......@@ -595,7 +564,7 @@ class SampleView(QtWidgets.QGraphicsView):
self.pyramid.initScene()
if self.mode == "ParticleDetection" or self.mode == "ParticleAnalysis":
if self.mode == "ParticleDetection":
self.prepareAnalysis()
else:
self.fitToWindow()
......
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