Loading analysis/particleeditor.py +8 −4 Original line number Diff line number Diff line Loading @@ -143,7 +143,8 @@ class ParticleEditor(QtCore.QObject): print(f'Combining particles {contourIndices} into {newAssignment}') contours = self.particleContainer.getParticleContoursByIndex(contourIndices) newContour = self.mergeContours(contours.copy()) stats = self.characterizeParticle(newContour) pixelscale = self.viewparent.dataset.getPixelScale() stats = self.characterizeParticle(newContour, pixelscale) self.particleContainer.mergeParticles(contourIndices, newContour, stats, newAssignment=newAssignment) for ind in contourIndices: Loading Loading @@ -178,7 +179,8 @@ class ParticleEditor(QtCore.QObject): def acceptPaintedResult(self): newContour = self.mergeContours(self.particlePainter.contours.copy()) stats = self.characterizeParticle(newContour) pixelscale = self.viewparent.dataset.getPixelScale() stats = self.characterizeParticle(newContour, pixelscale) self.particleContainer.mergeParticles(self.storedIndices, newContour, stats, newAssignment=self.storedAssignmend) for ind in self.storedIndices: Loading Loading @@ -237,7 +239,7 @@ class ParticleEditor(QtCore.QObject): return newContour def characterizeParticle(self, contours): def characterizeParticle(self, contours, pixelscale): ##characterize particle longellipse, shortellipse = np.nan, np.nan Loading @@ -252,7 +254,9 @@ class ParticleEditor(QtCore.QObject): if short>long: long, short = short, long return long, short, longellipse, shortellipse, cv2.contourArea(cnt) area = cv2.contourArea(cnt) return long*pixelscale, short*pixelscale, longellipse*pixelscale, shortellipse*pixelscale, area*pixelscale**2 @QtCore.pyqtSlot(list) def deleteParticles(self, contourIndices): Loading Loading
analysis/particleeditor.py +8 −4 Original line number Diff line number Diff line Loading @@ -143,7 +143,8 @@ class ParticleEditor(QtCore.QObject): print(f'Combining particles {contourIndices} into {newAssignment}') contours = self.particleContainer.getParticleContoursByIndex(contourIndices) newContour = self.mergeContours(contours.copy()) stats = self.characterizeParticle(newContour) pixelscale = self.viewparent.dataset.getPixelScale() stats = self.characterizeParticle(newContour, pixelscale) self.particleContainer.mergeParticles(contourIndices, newContour, stats, newAssignment=newAssignment) for ind in contourIndices: Loading Loading @@ -178,7 +179,8 @@ class ParticleEditor(QtCore.QObject): def acceptPaintedResult(self): newContour = self.mergeContours(self.particlePainter.contours.copy()) stats = self.characterizeParticle(newContour) pixelscale = self.viewparent.dataset.getPixelScale() stats = self.characterizeParticle(newContour, pixelscale) self.particleContainer.mergeParticles(self.storedIndices, newContour, stats, newAssignment=self.storedAssignmend) for ind in self.storedIndices: Loading Loading @@ -237,7 +239,7 @@ class ParticleEditor(QtCore.QObject): return newContour def characterizeParticle(self, contours): def characterizeParticle(self, contours, pixelscale): ##characterize particle longellipse, shortellipse = np.nan, np.nan Loading @@ -252,7 +254,9 @@ class ParticleEditor(QtCore.QObject): if short>long: long, short = short, long return long, short, longellipse, shortellipse, cv2.contourArea(cnt) area = cv2.contourArea(cnt) return long*pixelscale, short*pixelscale, longellipse*pixelscale, shortellipse*pixelscale, area*pixelscale**2 @QtCore.pyqtSlot(list) def deleteParticles(self, contourIndices): Loading