Commit 7edbee8a authored by Elisa Kanaki's avatar Elisa Kanaki

Read values from spinbox and allow procceeding without transformation in Zeiss-Import

parent 0d90c458
......@@ -210,6 +210,10 @@ class PointCoordinates(QtWidgets.QGridLayout):
self.addWidget(self.pimageOnly, 0, 6, QtCore.Qt.AlignRight)
self.pimageOnly.released.connect(QtCore.pyqtSlot()(lambda : self.read(-1)))
self.createWidgets(N)
@QtCore.pyqtSlot()
def validatePosition(self, index):
self.validpoints[index] = True
@QtCore.pyqtSlot()
def createWidgets(self, N, pointsgiven=[]):
......@@ -217,7 +221,10 @@ class PointCoordinates(QtWidgets.QGridLayout):
def connect(button, index):
button.released.connect(QtCore.pyqtSlot()(lambda: self.read(index)))
def connectValidation(spinbox, index):
spinbox.valueChanged.connect(QtCore.pyqtSlot()(lambda : self.validatePosition(index)))
for i in range(self.N, min(N, len(self.dswidgets))):
self.itemAtPosition(i+1, 0).setVisible(True)
self.itemAtPosition(i+1, 1).setVisible(True)
......@@ -242,6 +249,12 @@ class PointCoordinates(QtWidgets.QGridLayout):
spinbox.setRange(-500_000, 500_000)
spinbox.setValue(points[i, index])
spinbox.setMaximumWidth(75)
if self.instrctrl.name == 'SimulatedRaman':
for spinbox in [wx, wy, wz]:
connectValidation(spinbox, i)
# connectValidation(wx, i)
# connectValidation(wy, i)
# connectValidation(wz, i)
self.addWidget(lx, i+1, 0, QtCore.Qt.AlignLeft)
self.addWidget(wx, i+1, 1, QtCore.Qt.AlignRight)
......
......@@ -57,7 +57,6 @@ class ZeissImporter(QtWidgets.QDialog):
self.pexit = QtWidgets.QPushButton('Cancel', self)
self.pconvert.released.connect(self.convert)
self.pexit.released.connect(self.reject)
self.pconvert.setEnabled(False)
self.xinvert = QtWidgets.QCheckBox('Invert x-axis')
self.yinvert = QtWidgets.QCheckBox('Invert y-axis')
......@@ -212,15 +211,30 @@ class ZeissImporter(QtWidgets.QDialog):
def getTransform(self):
points = self.points.getPoints()
zpoints = np.array([m.getPos() for m in self.markers], dtype=np.double)
zpc = zpoints.mean(axis=0)
if np.any(np.isnan(points)):
ret = QtWidgets.QMessageBox.warning(self, 'Warning!',
f'At least some marker values have not been changed!\n ' +
'Do you want to continue without transformation?',
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
QtWidgets.QMessageBox.No)
T = np.identity(3)
if ret == QtWidgets.QMessageBox.No:
accept = False
else:
accept = True
return T, np.zeros(3), np.zeros(3), accept
pshift = self.instrctrl.getRamanPositionShift()
points[:,0] -= pshift[0]
points[:,1] -= pshift[1]
Parity = np.mat(np.diag([-1. if self.xinvert.isChecked() else 1.,
-1. if self.yinvert.isChecked() else 1.,
-1. if self.zinvert.isChecked() else 1.]))
zpoints = np.array([m.getPos() for m in self.markers], dtype=np.double)
pc = points.mean(axis=0)
zpc = zpoints.mean(axis=0)
points -= pc[np.newaxis, :]
zpoints -= zpc[np.newaxis, :]
......
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