Commit cfa964ed authored by JosefBrandt's avatar JosefBrandt

temporary fixes, non working solution

parent f1fe95fd
......@@ -21,6 +21,8 @@ If not, see <https://www.gnu.org/licenses/>.
Simualted Raman interface module for testing without actual raman system connected
"""
import sys
stdout = sys.stdout
from time import sleep
import numpy as np
from shutil import copyfile
......@@ -35,9 +37,9 @@ class SimulatedRaman(RamanBase):
self.currentpos = None, 0., 0.
self.currentZ = 0.
# some plausible data to simulate consecutively changing positions
self.positionlist = np.array([[ 1526. , -1379.9, -131. ],
[ 3762.5, -1197.7, -138.1],
[ 2313.7, -2627.2, -138.1],
self.positionlist = np.array([[ -12012, 13716, -1290],
[ -11955, -9200, -1279],
[ 10978, -9254, -1297],
[ 2704.1, -1788.2, -138.1],
[ 3884. , -2650.8, -138.1]])
self.znum = 4
......@@ -77,6 +79,7 @@ class SimulatedRaman(RamanBase):
def moveToAbsolutePosition(self, x, y, z=None, epsxy=0.11, epsz=0.011, debugReturn=False, measurementRunning=False):
assert self.connected
print('moving to:', x, y, z, file=stdout)
if z is None:
self.currentpos = x, y, self.currentpos[2]
else:
......
......@@ -113,49 +113,51 @@ class SegmentationContours(QtWidgets.QGraphicsItem):
self.update()
def contextMenuEvent(self, event):
contextMenu = QtWidgets.QMenu("Particle options")
combineMenu = QtWidgets.QMenu("Combine Particles into")
combineActs = []
assignments = []
for index in self.selectedContours:
# partIndex = int(np.where(self.parent.dataset.ramanscansortindex == index)[0])
partIndex = index
assignments.append(self.parent.analysiswidget.datastats.particleResults[partIndex])
assignments.append("other")
for assignment in np.unique(np.array(assignments)):
combineActs.append(combineMenu.addAction(assignment))
reassignActs = []
reassignMenu = QtWidgets.QMenu("Reassign particle(s) into")
for polymer in self.parent.analysiswidget.datastats.getUniquePolymers():
reassignActs.append(reassignMenu.addAction(polymer))
reassignActs.append(reassignMenu.addAction("other"))
contextMenu.addMenu(combineMenu)
contextMenu.addMenu(reassignMenu)
deleteAct = contextMenu.addAction("Delete Particle(s)")
numParticles = len(self.selectedContours)
if numParticles == 0:
reassignMenu.setDisabled(True)
combineMenu.setDisabled(True)
deleteAct.setDisabled(True)
elif numParticles == 1:
combineMenu.setDisabled(True)
action = contextMenu.exec_(event.screenPos())
if action == deleteAct:
print('deleting')
elif action in combineActs:
newAssignment = action.text()
self.parent.analysiswidget.editor.combineParticles(self.selectedContours, newAssignment)
if self.parent.analysiswidget is not None:
contextMenu = QtWidgets.QMenu("Particle options")
combineMenu = QtWidgets.QMenu("Combine Particles into")
combineActs = []
assignments = []
for index in self.selectedContours:
# partIndex = int(np.where(self.parent.dataset.ramanscansortindex == index)[0])
partIndex = index
assignments.append(self.parent.analysiswidget.datastats.particleResults[partIndex])
assignments.append("other")
for assignment in np.unique(np.array(assignments)):
combineActs.append(combineMenu.addAction(assignment))
reassignActs = []
reassignMenu = QtWidgets.QMenu("Reassign particle(s) into")
for polymer in self.parent.analysiswidget.datastats.getUniquePolymers():
reassignActs.append(reassignMenu.addAction(polymer))
reassignActs.append(reassignMenu.addAction("other"))
elif action in reassignActs:
newAssignment = action.text()
self.parent.analysiswidget.editor.reassignParticles(self.selectedContours, newAssignment)
contextMenu.addMenu(combineMenu)
contextMenu.addMenu(reassignMenu)
deleteAct = contextMenu.addAction("Delete Particle(s)")
numParticles = len(self.selectedContours)
if numParticles == 0:
reassignMenu.setDisabled(True)
combineMenu.setDisabled(True)
deleteAct.setDisabled(True)
elif numParticles == 1:
combineMenu.setDisabled(True)
action = contextMenu.exec_(event.screenPos())
if action == deleteAct:
print('deleting')
elif action in combineActs:
newAssignment = action.text()
self.parent.analysiswidget.editor.combineParticles(self.selectedContours, newAssignment)
elif action in reassignActs:
newAssignment = action.text()
self.parent.analysiswidget.editor.reassignParticles(self.selectedContours, newAssignment)
class FitPosIndicator(QtWidgets.QGraphicsItem):
......
......@@ -186,10 +186,12 @@ class ZeissImporter(QtWidgets.QDialog):
dataset.coordinatetransform = T, pc
# set image center as reference point in data set (use Zeiss coordinates)
p0 = np.array([self.region.centerx, self.region.centery]) - zpc[:2]
p0center = np.array([self.region.centerx, self.region.centery]) - zpc[:2]
p0 = p0center-.5*np.array((self.region.width, self.region.height))
p1 = p0center+.5*np.array((self.region.width, self.region.height))
dataset.readin = False
dataset.lastpos = p0
dataset.maxdim = p0 + p0
dataset.maxdim = p0 + p1
zmin, zmax = dataset.zpositions.min(), dataset.zpositions.max()
blur = (blur)*(255.)
......
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