Commit f3c17ebf authored by Josef Brandt's avatar Josef Brandt

Renaming into SpecScans, several bugfixes

parent 9120c7ba
......@@ -15,9 +15,9 @@ external/build/
*.pyd
ramancom/renishawcom.py
instrumentcom/renishawcom.py
ramancom/renishawtesting.py
instrumentcom/renishawtesting.py
*.exp
......
......@@ -21,7 +21,7 @@ Requirements:
for 64bit as many use cases require a lot of memory (16 GB better 32 GB
recommended)
* the tsp module in external can be built with
* the cython modules can be built with
python setuptsp.py
please note: for this step a valid compiler needs to be installed in the
system; Otherwise use the precompiled tsp-module
......
......@@ -27,12 +27,13 @@ from typing import List
from PyQt5 import QtCore, QtWidgets, QtGui
from .sampleview import SampleView
from .gui.scalebar import ScaleBar
from .ramancom.ramancontrol import defaultPath
from .ramancom.lightModeSwitch import LightModeSwitch
from .instrumentcom.instrumentConfig import defaultPath
from .instrumentcom.lightModeSwitch import LightModeSwitch
from .gui.colorlegend import ColorLegend
from .gepardlogging import setDefaultLoggingConfig
from .workmodes import ModeHandler
from .unittests.test_gepard import testGepard
from .helperfunctions import getAppFolder
class GEPARDMainWindow(QtWidgets.QMainWindow):
......@@ -120,7 +121,7 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
@QtCore.pyqtSlot()
def testFilename(self, fileName):
if self.view.ramanctrl.name == 'RenishawCOM': # the renishawCom does not allow Spaces within filePath
if self.view.instrctrl.name == 'RenishawCOM': # the renishawCom does not allow Spaces within filePath
if fileName.find(' ') == 0:
return False, "File path must not contain spaces."
else:
......@@ -164,8 +165,8 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.opticalScanAct.setChecked(osc)
self.detectParticleAct.setEnabled(pde)
self.detectParticleAct.setChecked(pdc)
self.ramanScanAct.setEnabled(rse)
self.ramanScanAct.setChecked(rsc)
self.specScanAct.setEnabled(rse)
self.specScanAct.setChecked(rsc)
def activateMaxMode(self, loadnew=False) -> None:
self.modeHandler.activateMaxMode(loadnew)
......@@ -192,7 +193,7 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.exitAct.setEnabled(False)
self.opticalScanAct.setEnabled(False)
self.detectParticleAct.setEnabled(False)
self.ramanScanAct.setEnabled(False)
self.specScanAct.setEnabled(False)
def updateConnected(self, connected):
if connected:
......@@ -265,17 +266,17 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.detectParticleAct.triggered.connect(
QtCore.pyqtSlot()(lambda: self.modeHandler.switchMode("ParticleDetection")))
self.ramanScanAct = QtWidgets.QAction("Raman Scan", self)
self.ramanScanAct.setEnabled(False)
self.ramanScanAct.setCheckable(True)
self.ramanScanAct.triggered.connect(QtCore.pyqtSlot()(lambda: self.modeHandler.switchMode("SpectrumScan")))
self.specScanAct = QtWidgets.QAction("Spectrum Scan", self)
self.specScanAct.setEnabled(False)
self.specScanAct.setCheckable(True)
self.specScanAct.triggered.connect(QtCore.pyqtSlot()(lambda: self.modeHandler.switchMode("SpectrumScan")))
self.snapshotAct = QtWidgets.QAction("&Save Screenshot", self)
self.snapshotAct.triggered.connect(self.view.takeScreenshot)
self.snapshotAct.setDisabled(True)
self.configRamanCtrlAct = QtWidgets.QAction("&Configure Raman Control", self)
self.configRamanCtrlAct.triggered.connect(self.view.configureRamanControl)
self.configRamanCtrlAct.triggered.connect(self.view.configureInstrumentControl)
if self.view.simulatedRaman:
self.configRamanCtrlAct.setDisabled(True)
......@@ -365,7 +366,7 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.toolbar.addSeparator()
self.toolbar.addAction(self.opticalScanAct)
self.toolbar.addAction(self.detectParticleAct)
self.toolbar.addAction(self.ramanScanAct)
self.toolbar.addAction(self.specScanAct)
self.toolbar.addSeparator()
self.toolbar.addAction(self.exitAct)
self.toolbar.setOrientation(QtCore.Qt.Vertical)
......@@ -380,7 +381,7 @@ if __name__ == '__main__':
"""
Closes the app and, with that, all windows.
Josef: I implemented this, as with the simulated microscope stage it was difficult to find a proper way to
ONLY close it at the end of running the program. Closing it on disconnect of the ramanctrl is not suitable,
ONLY close it at the end of running the program. Closing it on disconnect of the instrctrl is not suitable,
as it should be opened also in disconnected stage (e.g., when another instance is running in optical or raman
scan, but the UI (disconnected) should still update what's going on.
"""
......@@ -409,11 +410,7 @@ if __name__ == '__main__':
logger = logging.getLogger(__name__)
app = QtWidgets.QApplication(sys.argv)
app.setApplicationName("GEPARD") # appname needed for logpath
logpath = QtCore.QStandardPaths.writableLocation(
QtCore.QStandardPaths.AppLocalDataLocation)
fp = None
logpath = getAppFolder()
if logpath != "":
if not os.path.exists(logpath):
os.mkdir(logpath)
......
This diff is collapsed.
......@@ -66,13 +66,13 @@ class Particle(object):
def getHQIOfMeasurementIndex(self, index) -> float:
for meas in self.measurements:
if meas.ramanScanIndex == index:
if meas.specScanIndex == index:
return meas.getHQI()
def getMeasurementIndices(self) -> List[int]:
indices: List[int] = []
for meas in self.measurements:
indices.append(meas.ramanScanIndex)
indices.append(meas.specScanIndex)
return indices
def getMeasurements(self) -> List['Measurement']:
......@@ -126,7 +126,7 @@ class Particle(object):
class Measurement(object):
def __init__(self):
super(Measurement, self).__init__()
self.ramanScanIndex: int = np.nan
self.specScanIndex: int = np.nan
self.pixelcoord_x: int = np.nan
self.pixelcoord_y: int = np.nan
......@@ -165,4 +165,4 @@ class Measurement(object):
return self.assignment_orig
def getScanIndex(self) -> int:
return self.ramanScanIndex
return self.specScanIndex
......@@ -52,7 +52,7 @@ class ParticleContainer(object):
particle.measurements = []
def setMeasurementScanIndex(self, indexOfMeasurment, scanIndex):
self.measurements[indexOfMeasurment].ramanScanIndex = scanIndex
self.measurements[indexOfMeasurment].specScanIndex = scanIndex
def setMeasurementPixelCoords(self, indexOfMeasurment, x, y):
self.measurements[indexOfMeasurment].pixelcoord_x = x
......
......@@ -114,7 +114,6 @@ class ParticlePainter(QtWidgets.QGraphicsItem):
def adjustMarginsAndPlaceImage(self, pixelPos):
x_min, x_max = round(pixelPos.x()-self.radius), round(pixelPos.x()+self.radius)
y_min, y_max = round(pixelPos.y()-self.radius), round(pixelPos.y()+self.radius)
#TODO: Using cv2.warpAffine would probably be more elegant....
x_shift = y_shift = int(0)
if x_min < 0:
......
......@@ -47,7 +47,7 @@ def loadData(fname):
retds.__dict__.update(ds.__dict__)
if retds.version < currentVersion:
legacyConversion(retds)
elif retds.zvalimg=="saved":
elif retds.zvalimg == "saved":
retds.loadZvalImg()
retds.particleContainer.datasetParent = retds #TODO: This is mainly a workaround to update the ref in particleContainer. It probably should be handled differently anyways...
return retds
......@@ -114,6 +114,7 @@ def recursiveDictCompare(d1, d2):
return False
return True
class DataSet(object):
def __init__(self, fname, newProject=False):
self.fname = fname
......@@ -141,7 +142,7 @@ class DataSet(object):
self.pyramidParams = None
# parameters specifically for raman scan
self.pshift = None # shift of raman scan position relative to image center
self.pshift = None # shift of spectrometer scan position relative to image center
self.seedpoints = np.array([])
self.seeddeletepoints = np.array([])
self.detectParams = {'points': np.array([[50,0],[100,200],[200,255]]),
......@@ -157,7 +158,7 @@ class DataSet(object):
self.particleContainer = ParticleContainer(self)
self.particleDetectionDone = False
self.ramanscandone = False
self.specscandone = False
self.resultParams = {'minHQI': 5}
self.colorSeed = 'default'
......@@ -232,16 +233,6 @@ class DataSet(object):
p0[0] -= self.signx*self.imagedim_df[0]/2
p0[1] -= self.signy*self.imagedim_df[1]/2
x, y = self.signx*(p[0] - p0[0])/pixelscale, self.signy*(p[1] - p0[1])/pixelscale
# TODO: SANITY CHECK AT REAL INSTRUMENT IF THE BELOW CODE CAN BE REMOVED (WAS SUBSTITUTED BY THE 4 LINES ABOVE)
# if mode == 'df':
# p0[0] -= self.signx*self.imagedim_df[0]/2
# p0[1] -= self.signy*self.imagedim_df[1]/2
# x, y = self.signx*(p[0] - p0[0])/self.pixelscale_df, self.signy*(p[1] - p0[1])/self.pixelscale_df
#
# elif mode == 'bf':
# p0[0] -= self.signx*self.imagedim_bf[0]/2
# p0[1] -= self.signy*self.imagedim_bf[1]/2
# x, y = self.signx*(p[0] - p0[0])/self.pixelscale_bf, self.signy*(p[1] - p0[1])/self.pixelscale_bf
return x, y
def mapToLength(self, pixelpos, mode='df', force=False, returnz=False):
......@@ -272,7 +263,7 @@ class DataSet(object):
return x, y, z
return x, y
def mapToLengthRaman(self, pixelpos, microscopeMode='df', noz=False):
def mapToLengthSpectrometer(self, pixelpos, microscopeMode='df', noz=False):
p0x, p0y, z = self.mapToLength(pixelpos, mode=microscopeMode, returnz=True)
x, y = p0x + self.pshift[0], p0y + self.pshift[1]
return x, y, z
......
......@@ -16,7 +16,7 @@ magnification = 20
#information specific for renishaw control
#image mikrometer sizes for bright and dark field camera, format: width*height
#please insert, as it would represent an image at 1x magnification
#if unavailable, export an image from the Renishaw Camera viewer. Export as jpeg (without axes) and, within Gepard, go to Tools->ConfigureRamanControl.
#if unavailable, export an image from the Renishaw Camera viewer. Export as jpeg (without axes) and, within Gepard, go to Tools->ConfigureInstrumentControl.
img_size_BF = 9016.0*5748.0
img_size_DF = 4524.0*2874.0
#Path to measuring templates (*.wxm)
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 21 12:23:20 2018
@author: brandt
GEPARD - Gepard-Enabled PARticle Detection
Copyright (C) 2018 Lars Bittrich and Josef Brandt, Leibniz-Institut für
Polymerforschung Dresden e. V. <bittrich-lars@ipfdd.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program, see COPYING.
If not, see <https://www.gnu.org/licenses/>.
"""
from PyQt5 import QtWidgets
class RamanConfigWin(QtWidgets.QWidget):
class InstrumentConfigWin(QtWidgets.QWidget):
def __init__(self, parent=None):
super(RamanConfigWin, self).__init__()
super(InstrumentConfigWin, self).__init__()
self.parent = parent
if parent is not None:
self.ramancontrol = self.parent.ramanctrl
self.instrcontrol = self.parent.instrctrl
self.setGeometry(200, 200, 400, 300)
self.setWindowTitle('Configure Raman Control')
......@@ -28,7 +39,7 @@ class RamanConfigWin(QtWidgets.QWidget):
generalLayout = QtWidgets.QFormLayout()
self.magnSpinBox = QtWidgets.QSpinBox()
if parent is not None:
self.magnSpinBox.setValue(self.ramancontrol.magn)
self.magnSpinBox.setValue(self.instrcontrol.magn)
else:
self.magnSpinBox.setValue(20)
generalLayout.addRow(QtWidgets.QLabel('Magnification (x)'), self.magnSpinBox)
......@@ -48,10 +59,10 @@ class RamanConfigWin(QtWidgets.QWidget):
spinbox.setMaximum(1e7)
if self.parent is not None:
self.ren_BFwidth.setValue(self.ramancontrol.cam_bf_dims[0])
self.ren_BFheight.setValue(self.ramancontrol.cam_bf_dims[1])
self.ren_DFwidth.setValue(self.ramancontrol.cam_df_dims[0])
self.ren_DFheight.setValue(self.ramancontrol.cam_df_dims[1])
self.ren_BFwidth.setValue(self.instrcontrol.cam_bf_dims[0])
self.ren_BFheight.setValue(self.instrcontrol.cam_bf_dims[1])
self.ren_DFwidth.setValue(self.instrcontrol.cam_df_dims[0])
self.ren_DFheight.setValue(self.instrcontrol.cam_df_dims[1])
self.getBFImgDimBtn = QtWidgets.QPushButton('Read dimensions from File')
self.getBFImgDimBtn.released.connect(self.makeReadImgDimsLambda(self.ren_BFwidth, self.ren_BFheight))
......@@ -126,51 +137,13 @@ class RamanConfigWin(QtWidgets.QWidget):
QtWidgets.QMessageBox.critical(self, 'Error', 'Reading dimensions from jpeg failed')
def closeEvent(self, event):
ret = QtWidgets.QMessageBox.question(self, '', 'Save Data to RamanControl?', QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.Yes)
ret = QtWidgets.QMessageBox.question(self, '', 'Save Data to InstrumentControl?', QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.Yes)
if ret == QtWidgets.QMessageBox.Yes:
if self.parent is not None:
if self.ramancontrol.hostname == 'AN-Raman-Renishaw':
self.ramancontrol.cam_bf_dims = [self.ren_BFwidth.value(), self.ren_BFheight.value()]
self.ramancontrol.cam_df_dims = [self.ren_DFwidth.value(), self.ren_DFheight.value()]
self.ramancontrol.magn = self.magnSpinBox.value()
if self.instrcontrol.hostname == 'AN-Raman-Renishaw':
self.instrcontrol.cam_bf_dims = [self.ren_BFwidth.value(), self.ren_BFheight.value()]
self.instrcontrol.cam_df_dims = [self.ren_DFwidth.value(), self.ren_DFheight.value()]
self.instrcontrol.magn = self.magnSpinBox.value()
else:
print('fake saved')
class RamanSettingParam(object):
def __init__(self, name, dtype, default=None, minVal=None, maxVal=None, valList=None, openFileType=None):
self.name = name
self.dtype = dtype
self.value = default
self.minVal = minVal
self.maxVal = maxVal
self.valList = valList
self.openFileType = openFileType
if not self.hasValidType():
print('erroreneous type in setting parameter:', self.dtype)
def hasValidType(self):
if self.dtype in ['int', 'double', 'checkBox', 'combobox', 'selectBtn']:
return True
else:
return False
def value_of(self, obj):
if self.dtype in ['int', 'double']:
return obj.value()
elif self.dtype == 'checkBox':
return obj.isChecked()
elif self.dtype == 'combobox':
return obj.currentText()
elif self.dtype == 'selectBtn':
return obj.text()
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
setWin = RamanConfigWin()
setWin.show()
ret = app.exec_()
\ No newline at end of file
......@@ -3,7 +3,7 @@ import numpy as np
from typing import List
from copy import deepcopy
from ..coordinatetransform import ImageMarker, TrayMarker, getTransform
from ..ramancom.ramanbase import RamanBase
from ..instrumentcom.instrumentComBase import InstrumentComBase
class CoordTransformUI(QtWidgets.QWidget):
......@@ -12,7 +12,7 @@ class CoordTransformUI(QtWidgets.QWidget):
self.setWindowTitle('Recalculate Coordinate System')
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.viewParent = viewParent
self.ramanctrl: RamanBase = self.viewParent.ramanctrl
self.instrctrl: InstrumentComBase = self.viewParent.instrctrl
self.imageMarkers: List[ImageMarker] = [] # in the new coord system
self.newImageMarkers: List[ImageMarker] = []
......@@ -185,7 +185,7 @@ class CoordTransformUI(QtWidgets.QWidget):
def _addNewImageMarker(self, pos: tuple) -> None:
newImageMarker: ImageMarker = ImageMarker()
newImageMarker.index = len(self.imageMarkers)
x, y, z = self.ramanctrl.getPosition()
x, y, z = self.instrctrl.getPosition()
newImageMarker.worldCoordX = x
newImageMarker.worldCoordY = y
newImageMarker.worldCoordZ = z
......@@ -205,7 +205,7 @@ class CoordTransformUI(QtWidgets.QWidget):
def _readNewImageMarker(self, index: int) -> None:
"""Reads current instrument coordinates and assignes them to the respective "new image marker" """
x, y, z = self.ramanctrl.getPosition()
x, y, z = self.instrctrl.getPosition()
self.newImageMarkers[index].worldCoordX = x
self.newImageMarkers[index].worldCoordY = y
self.newImageMarkers[index].worldCoordZ = z
......
......@@ -705,7 +705,7 @@ class ParticleDetectionView(QtWidgets.QWidget):
self.dataset.particleContainer.clearParticles()
self.dataset.particleContainer.clearMeasurements()
self.dataset.particleDetectionDone = False
self.dataset.ramanscandone = False
self.dataset.specscandone = False
self.dataset.mode = "opticalscan"
self.dataset.save()
self.imageUpdate.emit(self.view.microscopeMode)
......@@ -829,7 +829,7 @@ class ParticleDetectionView(QtWidgets.QWidget):
self.detectThreadRunning = False
def applyResultsToDataset(self, measurementPoints, contours):
self.dataset.ramanscandone = False
self.dataset.specscandone = False
particlestats, invalidParticleIndices = self.getParticleStats(contours)
contours = removeInvalidContours(contours, invalidParticleIndices)
......
......@@ -30,7 +30,7 @@ import cv2
from time import localtime, strftime
from typing import List, TYPE_CHECKING
from ..imagestitch import imageStacking
from ..helperfunctions import cv2imread_fix, cv2imwrite_fix, getRamanControl, positionWidgetOnScreen
from ..helperfunctions import cv2imread_fix, cv2imwrite_fix, getInstrumentControl, positionWidgetOnScreen
from ..opticalbackground import BackGroundManager
from .uielements import TimeEstimateProgressbar
from .zlevelsetter import ZLevelSetter
......@@ -55,9 +55,9 @@ def scan(path, sol, zpositions, grid, controlclass, dataqueue,
logger.info('starting new optical scan')
try:
ramanctrl = controlclass(logger)
ramanctrl.updateImageConfig(os.path.dirname(logpath))
ramanctrl.connect()
instrctrl = controlclass(logger)
instrctrl.updateImageConfig(os.path.dirname(logpath))
instrctrl.connect()
zlist = list(enumerate(zpositions))
for i, p in enumerate(grid):
x, y = p
......@@ -68,15 +68,15 @@ def scan(path, sol, zpositions, grid, controlclass, dataqueue,
zik = z+zk
assert not np.isnan(zik)
logger.info(f"moving to: {x}, {y}, {zik}, time: " + strftime("%d %b %Y %H:%M:%S", localtime()))
ramanctrl.moveToAbsolutePosition(x, y, zik)
instrctrl.moveToAbsolutePosition(x, y, zik)
if ishdr:
img_list = []
fname = os.path.join(path, f"tmp.bmp")
values = [5., 25., 100.]
for j, val in enumerate(values if (i%2+k%2)%2==0 else reversed(values)):
ramanctrl.setBrightness(val)
instrctrl.setBrightness(val)
logger.info(f'writing hdr image to {fname}')
ramanctrl.saveImage(fname)
instrctrl.saveImage(fname)
img_list.append(cv2imread_fix(fname))
res_mertens = merge_mertens.process(img_list)
res_mertens_8bit = np.clip(res_mertens*255, 0, 255).astype('uint8')
......@@ -84,15 +84,15 @@ def scan(path, sol, zpositions, grid, controlclass, dataqueue,
else:
img_path = os.path.join(path, name)
logger.info(f'writing non hdr image to {img_path}')
ramanctrl.saveImage(img_path)
instrctrl.saveImage(img_path)
if stopevent.is_set():
ramanctrl.disconnect()
instrctrl.disconnect()
return
dataqueue.put(i)
ramanctrl.disconnect()
instrctrl.disconnect()
except:
logger.exception('Fatal error in optical scan')
from .errors import showErrorMessageAsWidget
from ..errors import showErrorMessageAsWidget
showErrorMessageAsWidget('See opticalScanLog in project directory for information')
......@@ -197,12 +197,12 @@ def loadAndPasteImage(srcnames: List[str], pyramid, fullzval: np.ndarray, width:
class PointCoordinates(QtWidgets.QGridLayout):
readPoint = QtCore.pyqtSignal(float, float, float, name='readPoint')
def __init__(self, N, ramanctrl, parent=None, names=None):
def __init__(self, N, instrctrl, parent=None, names=None):
super().__init__(parent)
self.validpoints = [False]*N
self.dswidgets = []
self.N = 0
self.ramanctrl = ramanctrl
self.instrctrl = instrctrl
self.names = names
self.pimageOnly = QtWidgets.QPushButton("Image")
self.addWidget(self.pimageOnly, 0, 6, QtCore.Qt.AlignRight)
......@@ -278,8 +278,8 @@ class PointCoordinates(QtWidgets.QGridLayout):
self.update()
def read(self, index):
x, y, z = self.ramanctrl.getPosition()
z = self.ramanctrl.getUserZ()
x, y, z = self.instrctrl.getPosition()
z = self.instrctrl.getUserZ()
if index >= 0:
wx, wy, wz = self.dswidgets[index]
wx.setValue(x)
......@@ -314,12 +314,12 @@ class OpticalScanUI(QtWidgets.QWidget):
mainLayout = QtWidgets.QVBoxLayout()
pointgroup = QtWidgets.QGroupBox("Point coordinates [µm]", self)
self.ramanctrl = sampleview.ramanctrl
self.instrctrl = sampleview.instrctrl
self.dataset = sampleview.dataset
self.pyramid: ScenePyramid = None
self.positions = []
self.process = None
self.points = PointCoordinates(5, self.ramanctrl, self)
self.points = PointCoordinates(5, self.instrctrl, self)
pointgroup.setLayout(self.points)
self.points.readPoint.connect(self.takePoint)
......@@ -474,7 +474,7 @@ class OpticalScanUI(QtWidgets.QWidget):
@QtCore.pyqtSlot()
def areaSelect(self):
magn = self.ramanctrl.magn
magn = self.instrctrl.magn
if self.circlerad.isChecked() == True:
xym, r = cv2.minEnclosingCircle(np.array([p[:2] for p in self.dataset.fitpoints],
......@@ -506,8 +506,8 @@ class OpticalScanUI(QtWidgets.QWidget):
self.points.createWidgets(5, list(zip(ds.fitindices,ds.fitpoints)))
if len(self.dataset.fitindices)>1:
self.areaOptionsGroup.setEnabled(True)
softwarez = self.ramanctrl.getSoftwareZ()
if abs(softwarez) > 0.1 and self.ramanctrl.name == 'WITecCOM':
softwarez = self.instrctrl.getSoftwareZ()
if abs(softwarez) > 0.1 and self.instrctrl.name == 'WITecCOM':
reply = QtWidgets.QMessageBox.critical(self, 'Software z position nonzero',
"The software z position needs to be set to zero."\
" Moving z for %4.0f µm relative to current position. Counteract manually before proceeding!"%(-softwarez),
......@@ -515,7 +515,7 @@ class OpticalScanUI(QtWidgets.QWidget):
QtWidgets.QMessageBox.Abort, QtWidgets.QMessageBox.Abort)
if reply == QtWidgets.QMessageBox.Yes:
self.ramanctrl.moveZto(0.0)
self.instrctrl.moveZto(0.0)
else:
QtWidgets.QMessageBox.information(self, "Information", 'Scan may stop if the software z position gets to high!',
QtWidgets.QMessageBox.Ok)
......@@ -529,15 +529,15 @@ class OpticalScanUI(QtWidgets.QWidget):
if reply != QtWidgets.QMessageBox.Yes:
return
self.ramanctrl.saveImage(self.dataset.getTmpImageName())
width, height, rotationvalue = self.ramanctrl.getImageDimensions(self.view.microscopeMode)
pshift = self.ramanctrl.getRamanPositionShift()
self.instrctrl.saveImage(self.dataset.getTmpImageName())
width, height, rotationvalue = self.instrctrl.getImageDimensions(self.view.microscopeMode)
pshift = self.instrctrl.getRamanPositionShift()
self.dataset.pshift = pshift
img = cv2imread_fix(self.dataset.getTmpImageName())
self.dataset.imagedim_bf = self.ramanctrl.getImageDimensions('bf')
self.dataset.imagedim_bf = self.instrctrl.getImageDimensions('bf')
self.dataset.pixelscale_bf = self.dataset.imagedim_bf[0]/img.shape[1] #=imagedim_width/shape[1]
self.dataset.imagedim_df = self.ramanctrl.getImageDimensions('df')
self.dataset.imagedim_df = self.instrctrl.getImageDimensions('df')
self.dataset.pixelscale_df = self.dataset.imagedim_df[0]/img.shape[1] #=imagedim_width/shape[1]
points = self.points.getPoints()
......@@ -594,7 +594,7 @@ class OpticalScanUI(QtWidgets.QWidget):
@QtCore.pyqtSlot(int)
def readBackground(self, indexOfCallingImage):
tmp_path = self.dataset.getTmpImageName()
self.ramanctrl.saveImage(tmp_path)
self.instrctrl.saveImage(tmp_path)
self.backGroundSavedToPath.emit(indexOfCallingImage, tmp_path)
def writeBackGroundImage(self, backgroundImg):
......@@ -644,8 +644,8 @@ class OpticalScanUI(QtWidgets.QWidget):
points = np.float32(self.dataset.fitpoints)
# convert z to software z, which is relative to current user z
softwarez = self.ramanctrl.getSoftwareZ() # get current software z
points[:,2] += softwarez-self.ramanctrl.getUserZ()
softwarez = self.instrctrl.getSoftwareZ() # get current software z
points[:,2] += softwarez-self.instrctrl.getUserZ()
try:
zrange = self.zLevelSetter.getZLevels()
......@@ -701,12 +701,12 @@ class OpticalScanUI(QtWidgets.QWidget):
if reply == QtWidgets.QMessageBox.Yes:
self.prun.setEnabled(False)
self.ramanctrl.disconnect()
self.instrctrl.disconnect()
self.processstopevent = Event()
self.dataqueue = Queue()
logpath = os.path.join(self.dataset.path, 'opticalScanLog.txt')
self.process = Process(target=scan, args=(path, sol, self.dataset.zpositions,
self.dataset.grid, self.ramanctrl.__class__,
self.dataset.grid, self.instrctrl.__class__,
self.dataqueue, self.processstopevent