Commit a6fa4f0e authored by JosefBrandt's avatar JosefBrandt

No further ContourApproximation + Code Cleanup

Contour approximation can lead to wrong ellipse fits...
parent c90f7b26
...@@ -45,7 +45,6 @@ except: ...@@ -45,7 +45,6 @@ except:
class ParticleAnalysis(QtWidgets.QMainWindow): class ParticleAnalysis(QtWidgets.QMainWindow):
def __init__(self, dataset, viewparent=None): def __init__(self, dataset, viewparent=None):
super(ParticleAnalysis, self).__init__(viewparent) super(ParticleAnalysis, self).__init__(viewparent)
# self.resize(1680, 1050)
self.setWindowTitle('Results of polymer analysis') self.setWindowTitle('Results of polymer analysis')
self.layout = QtWidgets.QHBoxLayout() self.layout = QtWidgets.QHBoxLayout()
self.widget = QtWidgets.QWidget() self.widget = QtWidgets.QWidget()
...@@ -599,15 +598,4 @@ class ParticleAnalysis(QtWidgets.QMainWindow): ...@@ -599,15 +598,4 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
window.close() window.close()
self.viewparent.imparent.particelAnalysisAct.setChecked(False) self.viewparent.imparent.particelAnalysisAct.setChecked(False)
event.accept() event.accept()
\ No newline at end of file
if __name__ == '__main__':
from ..dataset import DataSet
def run():
app = QtWidgets.QApplication(sys.argv)
meas = ParticleAnalysis(DataSet("dummydata"))
meas.showMaximized()
return app.exec_()
run()
\ No newline at end of file
...@@ -27,8 +27,7 @@ with permission from github user CJ Carey (perimosocordiae) ...@@ -27,8 +27,7 @@ with permission from github user CJ Carey (perimosocordiae)
from PyQt5 import QtWidgets, QtCore from PyQt5 import QtWidgets, QtCore
import numpy as np import numpy as np
import sys import dill #TODO: Make it run with pickle... Having two different methods is not so sensefull...
import dill
import os import os
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
...@@ -317,16 +316,14 @@ class DataBaseWindow(QtWidgets.QMainWindow): ...@@ -317,16 +316,14 @@ class DataBaseWindow(QtWidgets.QMainWindow):
self.removeSpecBtn.setText('Remove {}'.format(self.activeSpectrumName)) self.removeSpecBtn.setText('Remove {}'.format(self.activeSpectrumName))
self.removeSpecBtn.setDisabled(False) self.removeSpecBtn.setDisabled(False)
def save(self): def save(self, showMessage=True):
for index, db in enumerate(self.databases): for index, db in enumerate(self.databases):
# pickling_on = open(db.title+'.dbpkl', 'wb')
# pickle.dump(db, pickling_on)
# pickling_on.close()
savename = os.path.join(self.path, db.title+'.db') savename = os.path.join(self.path, db.title+'.db')
with open(savename, 'wb') as f: with open(savename, 'wb') as f:
dill.dump(db, f) dill.dump(db, f)
QtWidgets.QMessageBox.about(self, 'Done.', 'Saved {} database(s)'.format(len(self.databases))) if showMessage:
QtWidgets.QMessageBox.about(self, 'Done.', 'Saved {} database(s)'.format(len(self.databases)))
def updateDBSelectorList(self): def updateDBSelectorList(self):
self.db_selector.clear() self.db_selector.clear()
...@@ -339,7 +336,6 @@ class DataBaseWindow(QtWidgets.QMainWindow): ...@@ -339,7 +336,6 @@ class DataBaseWindow(QtWidgets.QMainWindow):
self.db_selector.setCurrentText(self.activeDatabase.title) self.db_selector.setCurrentText(self.activeDatabase.title)
def selectDataBase(self, refreshParent=False): def selectDataBase(self, refreshParent=False):
# if not self.noDBFound:
if len(self.databases) > 0: if len(self.databases) > 0:
self.activeDatabaseIndex = self.db_selector.currentIndex() self.activeDatabaseIndex = self.db_selector.currentIndex()
self.activeDatabase = self.databases[self.activeDatabaseIndex] self.activeDatabase = self.databases[self.activeDatabaseIndex]
...@@ -352,13 +348,7 @@ class DataBaseWindow(QtWidgets.QMainWindow): ...@@ -352,13 +348,7 @@ class DataBaseWindow(QtWidgets.QMainWindow):
self.parent.populateRefSelector() self.parent.populateRefSelector()
def closeEvent(self, event): def closeEvent(self, event):
# response = QtWidgets.QMessageBox.question(self, 'Warning', 'Exit without saving?', QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No) self.save(showMessage=False)
# if response == QtWidgets.QMessageBox.Yes:
# if self.parent is not None:
# self.parent.setDisabled(False)
# event.accept()
# else:
# event.ignore()
if self.parent is not None: if self.parent is not None:
self.parent.setDisabled(False) self.parent.setDisabled(False)
...@@ -426,8 +416,6 @@ class BaseLineCorrect(QtWidgets.QDialog): ...@@ -426,8 +416,6 @@ class BaseLineCorrect(QtWidgets.QDialog):
for i in range(len(spectra)): for i in range(len(spectra)):
spectra[i][:, 1] = self.origspectra[i][:, 1].copy() - self.als_baseline(self.origspectra[i][:, 1].copy(), asymmetry_param=self.asymSpinBox.value(), spectra[i][:, 1] = self.origspectra[i][:, 1].copy() - self.als_baseline(self.origspectra[i][:, 1].copy(), asymmetry_param=self.asymSpinBox.value(),
smoothness_param=self.smoothSpinBox.value(), max_iters = self.iterSpinBox.value()) smoothness_param=self.smoothSpinBox.value(), max_iters = self.iterSpinBox.value())
# self.newSpectra = spectra.copy()
# self.parent.drawSpectrum(spectra[self.parent.activeSpectrumIndex], self.parent.activeSpectrumName)
self.saveBtn.setDisabled(False) self.saveBtn.setDisabled(False)
def als_baseline(self, intensities, asymmetry_param=0.05, smoothness_param=1e4, def als_baseline(self, intensities, asymmetry_param=0.05, smoothness_param=1e4,
...@@ -453,27 +441,17 @@ class BaseLineCorrect(QtWidgets.QDialog): ...@@ -453,27 +441,17 @@ class BaseLineCorrect(QtWidgets.QDialog):
if conv < conv_thresh: if conv < conv_thresh:
break break
w = new_w w = new_w
# else: else:
# print( 'ALS did not converge in %d iterations' % max_iters) print( 'ALS did not converge in %d iterations' % max_iters)
return z return z
def save(self):
# self.parent.databases[self.parent.activeDatabaseIndex].spectra = self.spectra
# self.parent.activeDatabase = self.parent.databases[self.parent.activeDatabaseIndex]
# self.parent.activeSpectrum = self.parent.activeDatabase.spectra[self.parent.activeSpectrumIndex]
# self.parent.drawSpectrum(self.parent.activeSpectrum, self.parent.activeSpectrumName)
self.close()
def cancel(self): def cancel(self):
self.close() self.close()
def closeEvent(self, event): def closeEvent(self, event):
if self.parent is not None: if self.parent is not None:
self.parent.setDisabled(False) self.parent.setDisabled(False)
# self.parent.drawSpectrum(self.parent.activeSpectrum, self.parent.activeSpectrumName)
class WhittakerSmoother(object): class WhittakerSmoother(object):
def __init__(self, signal, smoothness_param, deriv_order=1): def __init__(self, signal, smoothness_param, deriv_order=1):
...@@ -549,18 +527,4 @@ class CropSpectra(QtWidgets.QDialog): ...@@ -549,18 +527,4 @@ class CropSpectra(QtWidgets.QDialog):
def closeEvent(self, event): def closeEvent(self, event):
if self.parent is not None: if self.parent is not None:
self.parent.setDisabled(False) self.parent.setDisabled(False)
event.accept() event.accept()
\ No newline at end of file
def main():
global dbWin
#start Application
app = QtWidgets.QApplication(sys.argv)
dbWin = DataBaseWindow(None)
app.exec_()
if __name__ == '__main__':
main()
\ No newline at end of file
...@@ -30,14 +30,12 @@ class ExpExcelDialog(QtWidgets.QDialog): ...@@ -30,14 +30,12 @@ class ExpExcelDialog(QtWidgets.QDialog):
super(ExpExcelDialog, self).__init__() super(ExpExcelDialog, self).__init__()
self.setWindowTitle('Export Options') self.setWindowTitle('Export Options')
self.setGeometry(200, 200, 300, 300) self.setGeometry(200, 200, 300, 300)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
self.dataset = dataset self.dataset = dataset
self.particleContainer = dataset.particleContainer self.particleContainer = dataset.particleContainer
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
excelvbox = QtWidgets.QVBoxLayout() excelvbox = QtWidgets.QVBoxLayout()
excelvbox.addWidget(QtWidgets.QLabel('Select Parameters for Export')) excelvbox.addWidget(QtWidgets.QLabel('Select Parameters for Export'))
excelgroup = QtWidgets.QGroupBox("Export to Excel", self) excelgroup = QtWidgets.QGroupBox("Export to Excel", self)
......
...@@ -45,8 +45,8 @@ def particleIsValid(particle): ...@@ -45,8 +45,8 @@ def particleIsValid(particle):
return False return False
return True return True
def getParticleStatsWithPixelScale(contour, fullimage, dataset):
def getParticleStatsWithPixelScale(cnt, fullimage, dataset): cnt = deepcopy(contour)
pixelscale = dataset.getPixelScale() pixelscale = dataset.getPixelScale()
newStats = ParticleStats() newStats = ParticleStats()
...@@ -64,7 +64,7 @@ def getParticleStatsWithPixelScale(cnt, fullimage, dataset): ...@@ -64,7 +64,7 @@ def getParticleStatsWithPixelScale(cnt, fullimage, dataset):
newStats.longSize, newStats.shortSize = getFibreDimension(cnt) newStats.longSize, newStats.shortSize = getFibreDimension(cnt)
newStats.longSize *= pixelscale newStats.longSize *= pixelscale
newStats.shortSize *= pixelscale newStats.shortSize *= pixelscale
partImg = getParticleImageFromFullimage(cnt, fullimage) partImg = getParticleImageFromFullimage(cnt, fullimage)
newStats.color = getParticleColor(partImg) newStats.color = getParticleColor(partImg)
return newStats return newStats
...@@ -76,8 +76,6 @@ def getFibreDimension(contour): ...@@ -76,8 +76,6 @@ def getFibreDimension(contour):
maxThickness = np.max(dist)*2 maxThickness = np.max(dist)*2
return longSize, maxThickness return longSize, maxThickness
def getParticleColor(imgRGB, colorClassifier=None): def getParticleColor(imgRGB, colorClassifier=None):
img = cv2.cvtColor(imgRGB, cv2.COLOR_RGB2HSV_FULL) img = cv2.cvtColor(imgRGB, cv2.COLOR_RGB2HSV_FULL)
meanHSV = cv2.mean(img) meanHSV = cv2.mean(img)
...@@ -130,6 +128,7 @@ def getParticleImageFromFullimage(contour, fullimage): ...@@ -130,6 +128,7 @@ def getParticleImageFromFullimage(contour, fullimage):
xmin, xmax, ymin, ymax = getContourExtrema(contourCopy) xmin, xmax, ymin, ymax = getContourExtrema(contourCopy)
img = fullimage[ymin:ymax, xmin:xmax] img = fullimage[ymin:ymax, xmin:xmax]
img = img.copy()
mask = np.zeros(img.shape[:2]) mask = np.zeros(img.shape[:2])
for i in range(len(contourCopy)): for i in range(len(contourCopy)):
...@@ -164,11 +163,11 @@ def contoursToImg(contours, padding=0): ...@@ -164,11 +163,11 @@ def contoursToImg(contours, padding=0):
return img, xmin, ymin, padding return img, xmin, ymin, padding
def imgToCnt(img, xmin, ymin, padding=0): def imgToCnt(img, xmin, ymin, padding=0):
def getContour(img, flag): def getContour(img, contourMode):
if cv2.__version__ > '3.5': if cv2.__version__ > '3.5':
contours, hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, flag) contours, hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, contourMode)
else: else:
temp, contours, hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, flag) temp, contours, hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, contourMode)
if len(contours) == 0: #i.e., no contour found if len(contours) == 0: #i.e., no contour found
raise InvalidParticleError raise InvalidParticleError
...@@ -188,10 +187,7 @@ def imgToCnt(img, xmin, ymin, padding=0): ...@@ -188,10 +187,7 @@ def imgToCnt(img, xmin, ymin, padding=0):
return contours[maxIndex] return contours[maxIndex]
img = closeHolesOfSubImage(img) img = closeHolesOfSubImage(img)
contour = getContour(img, flag=cv2.CHAIN_APPROX_SIMPLE) contour = getContour(img, contourMode=cv2.CHAIN_APPROX_NONE)
if len(contour) < 5:
contour = getContour(img, flag=cv2.CHAIN_APPROX_NONE)
for i in range(len(contour)): for i in range(len(contour)):
contour [i][0][0] += xmin-padding contour [i][0][0] += xmin-padding
......
...@@ -20,6 +20,26 @@ along with this program, see COPYING. ...@@ -20,6 +20,26 @@ along with this program, see COPYING.
If not, see <https://www.gnu.org/licenses/>. If not, see <https://www.gnu.org/licenses/>.
""" """
class ColorClassifier(object):
def __init__(self):
hue_tolerance = 50
self.colors = [ColorRangeHSV('yellow', 30, hue_tolerance, 40, 255),
ColorRangeHSV('blue', 120, hue_tolerance, 40, 255),
ColorRangeHSV('red', 180, hue_tolerance, 40, 255),
ColorRangeHSV('red', 0, hue_tolerance, 40, 255),
ColorRangeHSV('green', 70, hue_tolerance, 40, 255),
ColorRangeHSV('white', 128, 256, 0, 40)]
def classifyColor(self, meanHSV):
result = 'non-determinable'
for color in self.colors:
if color.containsHSV(meanHSV):
result = color.name
break
return result
class ColorRangeHSV(object): class ColorRangeHSV(object):
def __init__(self, name, hue, hue_tolerance, min_sat, max_sat): def __init__(self, name, hue, hue_tolerance, min_sat, max_sat):
self.name = name self.name = name
...@@ -40,22 +60,4 @@ class ColorRangeHSV(object): ...@@ -40,22 +60,4 @@ class ColorRangeHSV(object):
else: else:
if sat < 128 and hsv[2] > 70: if sat < 128 and hsv[2] > 70:
return True return True
class ColorClassifier(object): \ No newline at end of file
def __init__(self):
hue_tolerance = 50
self.colors = [ColorRangeHSV('yellow', 30, hue_tolerance, 40, 255),
ColorRangeHSV('blue', 120, hue_tolerance, 40, 255),
ColorRangeHSV('red', 180, hue_tolerance, 40, 255),
ColorRangeHSV('red', 0, hue_tolerance, 40, 255),
ColorRangeHSV('green', 70, hue_tolerance, 40, 255),
ColorRangeHSV('white', 128, 256, 0, 40)]
def classifyColor(self, meanHSV):
result = 'non-determinable'
for color in self.colors:
if color.containsHSV(meanHSV):
result = color.name
break
return result
\ No newline at end of file
...@@ -22,6 +22,28 @@ If not, see <https://www.gnu.org/licenses/>. ...@@ -22,6 +22,28 @@ If not, see <https://www.gnu.org/licenses/>.
import cv2 import cv2
from errors import InvalidParticleError from errors import InvalidParticleError
class ShapeClassifier(object):
def __init__(self):
self.shapeClasses = [Spherule(), Fibre(), Irregular()]
def classifyShape(self, contour, particleHeight):
newShape = BaseShape()
newShape.contour = contour
newShape.height = particleHeight
newShape.getParticleCharacteristics()
mostFittingCriteria = 0
bestFittingShape = 'unknown'
for testShape in self.shapeClasses:
numFits = newShape.fitsOtherShapeCriteria(testShape)
if numFits > mostFittingCriteria:
mostFittingCriteria = numFits
bestFittingShape = testShape.name
return bestFittingShape
class BaseShape(object): class BaseShape(object):
def __init__(self): def __init__(self):
self.name = None self.name = None
...@@ -124,26 +146,4 @@ class Fibre(BaseShape): ...@@ -124,26 +146,4 @@ class Fibre(BaseShape):
self.name = 'fibre' self.name = 'fibre'
self.aspectRatioRange = [3, 1000] self.aspectRatioRange = [3, 1000]
self.solidityRange = [0.0, 0.4] self.solidityRange = [0.0, 0.4]
self.height2AverageLengthRange = [0, 1000] self.height2AverageLengthRange = [0, 1000]
\ No newline at end of file
class ShapeClassifier(object):
def __init__(self):
self.shapeClasses = [Spherule(), Fibre(), Irregular()]
def classifyShape(self, contour, particleHeight):
newShape = BaseShape()
newShape.contour = contour
newShape.height = particleHeight
newShape.getParticleCharacteristics()
mostFittingCriteria = 0
bestFittingShape = 'unknown'
for testShape in self.shapeClasses:
numFits = newShape.fitsOtherShapeCriteria(testShape)
if numFits > mostFittingCriteria:
mostFittingCriteria = numFits
bestFittingShape = testShape.name
return bestFittingShape
\ No newline at end of file
...@@ -101,7 +101,7 @@ class ParticleContainer(object): ...@@ -101,7 +101,7 @@ class ParticleContainer(object):
for index, particle in enumerate(self.particles): for index, particle in enumerate(self.particles):
particle.__dict__.update(particlestats[index].__dict__) particle.__dict__.update(particlestats[index].__dict__)
def testForInconsistentParticles(self): #i.e., particles that have multiple measurements with different assignments def testForInconsistentParticleAssignments(self): #i.e., particles that have multiple measurements with different assignments
self.inconsistentParticles = [] self.inconsistentParticles = []
for particle in self.particles: for particle in self.particles:
if not particle.measurementsHaveSameOrigAssignment(): if not particle.measurementsHaveSameOrigAssignment():
......
...@@ -100,7 +100,7 @@ class ParticleContextMenu(QtWidgets.QMenu): ...@@ -100,7 +100,7 @@ class ParticleContextMenu(QtWidgets.QMenu):
self.colorMenu = QtWidgets.QMenu("Set Particle Color To") self.colorMenu = QtWidgets.QMenu("Set Particle Color To")
self.colorActs = [] self.colorActs = []
for color in ['white', 'black', 'blue', 'brown', 'green', 'grey', 'non-determinable', 'red', 'transparent', 'yellow']: for color in ['white', 'black', 'blue', 'brown', 'green', 'grey', 'non-determinable', 'red', 'transparent', 'yellow', 'violet']:
self.colorActs.append(self.colorMenu.addAction(color)) self.colorActs.append(self.colorMenu.addAction(color))
self.shapeMenu = QtWidgets.QMenu("Set Particle Shape To") self.shapeMenu = QtWidgets.QMenu("Set Particle Shape To")
......
...@@ -99,9 +99,22 @@ class ParticlePainter(QtWidgets.QGraphicsItem): ...@@ -99,9 +99,22 @@ class ParticlePainter(QtWidgets.QGraphicsItem):
self.editorParent.acceptPaintedResult() self.editorParent.acceptPaintedResult()
def drawParticle(self, pixelPos): def drawParticle(self, pixelPos):
self.adjustMarginsAndPlaceImage(pixelPos)
center = (int(pixelPos.x()), int(pixelPos.y()))
if self.painting:
cv2.circle(self.img, center, self.radius, 255, -1)
elif self.erasing:
cv2.circle(self.img, center, self.radius, 0, -1)
self.setPixmap()
self.update()
def adjustMarginsAndPlaceImage(self, pixelPos):
x_min, x_max = round(pixelPos.x()-self.radius), round(pixelPos.x()+self.radius) 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) 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) x_shift = y_shift = int(0)
if x_min < 0: if x_min < 0:
...@@ -146,17 +159,7 @@ class ParticlePainter(QtWidgets.QGraphicsItem): ...@@ -146,17 +159,7 @@ class ParticlePainter(QtWidgets.QGraphicsItem):
self.img = np.uint8(newImg) self.img = np.uint8(newImg)
self.setBrect() self.setBrect()
center = (int(pixelPos.x()), int(pixelPos.y()))
if self.painting:
cv2.circle(self.img, center, self.radius, 255, -1)
elif self.erasing:
cv2.circle(self.img, center, self.radius, 0, -1)
self.setPixmap()
self.update()
def paint(self, painter, option, widget): def paint(self, painter, option, widget):
painter.setPen(QtCore.Qt.white) painter.setPen(QtCore.Qt.white)
painter.drawRect(self.brect) painter.drawRect(self.brect)
......
...@@ -437,6 +437,7 @@ class SQLExport(QtWidgets.QDialog): ...@@ -437,6 +437,7 @@ class SQLExport(QtWidgets.QDialog):
self.dbAssignments.updateAssignment(polymerType, result, categ_result, paint_remark) self.dbAssignments.updateAssignment(polymerType, result, categ_result, paint_remark)
self.dbAssignments.save() self.dbAssignments.save()
class LinkedLineEdit(QtWidgets.QLineEdit): class LinkedLineEdit(QtWidgets.QLineEdit):
def __init__(self, combobox): def __init__(self, combobox):
......
...@@ -133,7 +133,6 @@ class DataSet(object): ...@@ -133,7 +133,6 @@ class DataSet(object):
'blurRadius': 9, 'blurRadius': 9,
'threshold': 0.2, 'threshold': 0.2,
'maxholebrightness': 0.5, 'maxholebrightness': 0.5,
'erodeconvexdefects': 0,
'minparticlearea': 20, 'minparticlearea': 20,
'minparticledistance': 20, 'minparticledistance': 20,
'measurefrac': 1, 'measurefrac': 1,
......
...@@ -20,7 +20,7 @@ If not, see <https://www.gnu.org/licenses/>. ...@@ -20,7 +20,7 @@ If not, see <https://www.gnu.org/licenses/>.
""" """
import numpy as np import numpy as np
from PyQt5 import QtCore, QtWidgets, QtGui from PyQt5 import QtCore, QtWidgets, QtGui
from segmentation import Segmentation, MeasurementPoint from segmentation import Segmentation
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from threading import Thread from threading import Thread
...@@ -164,7 +164,7 @@ class ImageView(QtWidgets.QLabel): ...@@ -164,7 +164,7 @@ class ImageView(QtWidgets.QLabel):
self.seeddeletepoints = arr[ind,:].tolist() self.seeddeletepoints = arr[ind,:].tolist()
def mousePressEvent(self, event): def mousePressEvent(self, event):
if event.button()==QtCore.Qt.LeftButton and event.modifiers() & QtCore.Qt.ControlModifier: if event.button()==QtCore.Qt.LeftButton:
if event.modifiers()&QtCore.Qt.ShiftModifier: if event.modifiers()&QtCore.Qt.ShiftModifier:
self.drag = "delete" self.drag = "delete"
elif event.modifiers()&QtCore.Qt.AltModifier: elif event.modifiers()&QtCore.Qt.AltModifier:
...@@ -234,7 +234,6 @@ class ImageView(QtWidgets.QLabel): ...@@ -234,7 +234,6 @@ class ImageView(QtWidgets.QLabel):
self.overlay = pix self.overlay = pix
def paintEvent(self, event): def paintEvent(self, event):
painter = QtGui.QPainter(self) painter = QtGui.QPainter(self)
painter.drawPixmap(0, 0, self.pixmap()) painter.drawPixmap(0, 0, self.pixmap())
painter.setOpacity(self.alpha) painter.setOpacity(self.alpha)
...@@ -249,7 +248,6 @@ class ImageView(QtWidgets.QLabel): ...@@ -249,7 +248,6 @@ class ImageView(QtWidgets.QLabel):
painter.setBrush(QtCore.Qt.red) painter.setBrush(QtCore.Qt.red)
for p in self.measpoints: for p in self.measpoints:
for point in self.measpoints[p]: for point in self.measpoints[p]:
# painter.drawEllipse(p[0]-2, p[1]-2, 5, 5)
painter.drawEllipse(point.x-2, point.y-2, 5, 5) painter.drawEllipse(point.x-2, point.y-2, 5, 5)
if self.showseedpoints: if self.showseedpoints:
...@@ -666,12 +664,10 @@ class ParticleDetectionView(QtWidgets.QWidget): ...@@ -666,12 +664,10 @@ class ParticleDetectionView(QtWidgets.QWidget):
self.dataset.ramanscandone = False self.dataset.ramanscandone = False
particleContainer = self.dataset.particleContainer particleContainer = self.dataset.particleContainer