Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GEPARD
GEPARD
Commits
c90f7b26
Commit
c90f7b26
authored
Aug 22, 2019
by
JosefBrandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several Bugfixes
parent
2026524b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
20 deletions
+45
-20
analysis/analysisplots.py
analysis/analysisplots.py
+1
-1
analysis/particleCharacterization.py
analysis/particleCharacterization.py
+13
-1
analysis/particleEditor.py
analysis/particleEditor.py
+8
-2
gepard.py
gepard.py
+2
-2
legacyConvert.py
legacyConvert.py
+5
-0
sampleview.py
sampleview.py
+16
-14
No files found.
analysis/analysisplots.py
View file @
c90f7b26
...
...
@@ -113,7 +113,7 @@ class SpectraPlot(QtWidgets.QGroupBox):
layout
=
QtWidgets
.
QHBoxLayout
()
self
.
canvas
=
FigureCanvas
(
Figure
())
self
.
spec_axis
=
self
.
canvas
.
figure
.
subplots
()
self
.
reference_ax
=
self
.
spec_axis
.
twinx
()
self
.
reference_ax
is
=
self
.
spec_axis
.
twinx
()
self
.
canvas
.
figure
.
subplots_adjust
(
left
=
0.1
,
top
=
0.93
,
bottom
=
0.15
,
right
=
0.9
)
specNavigation
=
NavigationToolbar
(
self
.
canvas
,
self
)
specNavigation
.
setOrientation
(
QtCore
.
Qt
.
Vertical
)
...
...
analysis/particleCharacterization.py
View file @
c90f7b26
...
...
@@ -60,12 +60,24 @@ def getParticleStatsWithPixelScale(cnt, fullimage, dataset):
newStats
.
height
=
getParticleHeight
(
cnt
,
dataset
)
newStats
.
shape
=
getParticleShape
(
cnt
,
newStats
.
height
)
if
newStats
.
shape
==
'fibre'
:
newStats
.
longSize
,
newStats
.
shortSize
=
getFibreDimension
(
cnt
)
newStats
.
longSize
*=
pixelscale
newStats
.
shortSize
*=
pixelscale
partImg
=
getParticleImageFromFullimage
(
cnt
,
fullimage
)
newStats
.
color
=
getParticleColor
(
partImg
)
return
newStats
def
getFibreDimension
(
contour
):
longSize
=
cv2
.
arcLength
(
contour
,
True
)
/
2
img
=
contoursToImg
([
contour
])[
0
]
dist
=
cv2
.
distanceTransform
(
img
,
cv2
.
DIST_L2
,
3
)
maxThickness
=
np
.
max
(
dist
)
*
2
return
longSize
,
maxThickness
def
getParticleColor
(
imgRGB
,
colorClassifier
=
None
):
img
=
cv2
.
cvtColor
(
imgRGB
,
cv2
.
COLOR_RGB2HSV_FULL
)
meanHSV
=
cv2
.
mean
(
img
)
...
...
analysis/particleEditor.py
View file @
c90f7b26
...
...
@@ -171,7 +171,7 @@ class ParticleEditor(QtCore.QObject):
'Particle contours are not connected.
\n
That is currently not supported!'
)
return
self
.
mergeParticlesInParticleContainerAndSampleView
(
contourIndices
,
newContour
,
newAssignment
)
self
.
mergeParticlesInParticleContainerAndSampleView
(
contourIndices
,
newContour
,
newAssignment
)
@
QtCore
.
pyqtSlot
(
list
,
str
)
def
reassignParticles
(
self
,
contourindices
,
newAssignment
):
...
...
@@ -180,12 +180,14 @@ class ParticleEditor(QtCore.QObject):
for
partIndex
in
contourindices
:
self
.
particleContainer
.
reassignParticleToAssignment
(
partIndex
,
newAssignment
)
self
.
viewparent
.
updateParticleInfoBox
(
partIndex
)
self
.
particleAssignmentChanged
.
emit
()
@
QtCore
.
pyqtSlot
(
list
,
str
)
def
paintParticles
(
self
,
contourIndices
,
newAssignment
):
print
(
f
'painting indices
{
contourIndices
}
into
{
newAssignment
}
'
)
self
.
createSafetyBackup
()
self
.
viewparent
.
removeParticleInfoBox
()
self
.
storedIndices
=
contourIndices
self
.
storedAssignmend
=
newAssignment
...
...
@@ -208,6 +210,7 @@ class ParticleEditor(QtCore.QObject):
except
NotConnectedContoursError
:
QtWidgets
.
QMessageBox
.
critical
(
self
.
viewparent
,
'ERROR!'
,
'Particle contours are not connected.
\n
That is currently not supported!'
)
self
.
viewparent
.
updateParticleInfoBox
(
self
.
storedIndices
[
-
1
])
self
.
storedIndices
=
[]
self
.
storedAssignmend
=
None
self
.
destroyParticlePainter
()
...
...
@@ -238,6 +241,7 @@ class ParticleEditor(QtCore.QObject):
self
.
viewparent
.
resetContourIndices
()
self
.
particleContainer
.
resetParticleIndices
()
self
.
viewparent
.
updateParticleInfoBox
(
self
.
particleContainer
.
getNumberOfParticles
()
-
1
)
self
.
particleAssignmentChanged
.
emit
()
@
QtCore
.
pyqtSlot
(
list
,
str
)
...
...
@@ -245,12 +249,14 @@ class ParticleEditor(QtCore.QObject):
print
(
f
'changing color of particles
{
contourIndices
}
into
{
newColor
}
'
)
for
partIndex
in
contourIndices
:
self
.
particleContainer
.
changeParticleColor
(
partIndex
,
newColor
)
self
.
viewparent
.
updateParticleInfoBox
(
partIndex
)
@
QtCore
.
pyqtSlot
(
list
,
str
)
def
changeParticleShapes
(
self
,
contourIndices
,
newShape
):
print
(
f
'changing shape of particles
{
contourIndices
}
into
{
newShape
}
'
)
for
partIndex
in
contourIndices
:
self
.
particleContainer
.
changeParticleShape
(
partIndex
,
newShape
)
self
.
viewparent
.
updateParticleInfoBox
(
partIndex
)
@
QtCore
.
pyqtSlot
(
list
)
def
deleteParticles
(
self
,
contourIndices
):
...
...
gepard.py
View file @
c90f7b26
...
...
@@ -352,8 +352,8 @@ if __name__ == '__main__':
logname
=
os
.
path
.
join
(
logpath
,
'logfile.txt'
)
fp
=
open
(
logname
,
"a"
)
#
sys.stderr = fp
#
sys.stdout = fp
sys
.
stderr
=
fp
sys
.
stdout
=
fp
print
(
"starting GEPARD at: "
+
strftime
(
"%d %b %Y %H:%M:%S"
,
localtime
()),
flush
=
True
)
gepard
=
GEPARDMainWindow
(
logpath
)
...
...
legacyConvert.py
View file @
c90f7b26
...
...
@@ -191,6 +191,11 @@ def updateParticleStats(dset):
except
InvalidParticleError
:
markForDeletion
(
particle
)
if
particle
.
shape
==
'fibre'
:
particle
.
longSize
,
particle
.
shortSize
=
pc
.
getFibreDimension
(
particle
.
contour
)
particle
.
longSize
*=
dset
.
getPixelScale
()
particle
.
shortSize
*=
dset
.
getPixelScale
()
print
(
f
'deleting
{
len
(
deleteIndices
)
}
particles'
)
for
index
in
sorted
(
deleteIndices
,
reverse
=
True
):
dset
.
particleContainer
.
removeParticle
(
index
)
...
...
sampleview.py
View file @
c90f7b26
...
...
@@ -129,7 +129,7 @@ class SampleView(QtWidgets.QGraphicsView):
def
closeEvent
(
self
,
event
):
reply
=
QtWidgets
.
QMessageBox
.
question
(
self
,
'Message'
,
"
Are
you
su
re to quit?"
,
QtWidgets
.
QMessageBox
.
Yes
|
"
Do
you re
ally want
to quit?"
,
QtWidgets
.
QMessageBox
.
Yes
|
QtWidgets
.
QMessageBox
.
No
,
QtWidgets
.
QMessageBox
.
No
)
if
reply
==
QtWidgets
.
QMessageBox
.
Yes
:
...
...
@@ -394,12 +394,6 @@ class SampleView(QtWidgets.QGraphicsView):
cnt
.
update
()
self
.
selectedParticleIndices
.
remove
(
cnt
.
particleIndex
)
def
updateParticleInfoBox
(
index
):
if
self
.
particleInfoBox
is
not
None
:
self
.
scene
().
removeItem
(
self
.
particleInfoBox
)
self
.
particleInfoBox
=
ParticleInfo
(
self
.
dataset
.
particleContainer
.
getParticleOfIndex
(
index
))
self
.
scene
().
addItem
(
self
.
particleInfoBox
)
p
=
self
.
mapToScene
(
event
.
pos
())
p
=
QtCore
.
QPointF
(
p
.
x
(),
p
.
y
())
...
...
@@ -422,10 +416,9 @@ class SampleView(QtWidgets.QGraphicsView):
self
.
selectedParticleIndices
.
remove
(
cnt
.
particleIndex
)
if
len
(
self
.
selectedParticleIndices
)
>
0
:
updateParticleInfoBox
(
self
.
selectedParticleIndices
[
-
1
])
self
.
updateParticleInfoBox
(
self
.
selectedParticleIndices
[
-
1
])
else
:
self
.
scene
().
removeItem
(
self
.
particleInfoBox
)
self
.
particleInfoBox
=
None
self
.
removeParticleInfoBox
()
self
.
update
()
...
...
@@ -614,12 +607,21 @@ class SampleView(QtWidgets.QGraphicsView):
self
.
contourItems
[
index
].
isSelected
=
True
self
.
selectedParticleIndices
=
[
index
]
self
.
updateParticleInfoBox
(
index
)
self
.
update
()
def
updateParticleInfoBox
(
self
,
particleIndex
):
self
.
removeParticleInfoBox
()
self
.
addParticleInfoBox
(
particleIndex
)
def
removeParticleInfoBox
(
self
):
if
self
.
particleInfoBox
is
not
None
:
self
.
scene
().
removeItem
(
self
.
particleInfoBox
)
self
.
particleInfoBox
=
None
self
.
particleInfoBox
=
ParticleInfo
(
self
.
dataset
.
particleContainer
.
getParticleOfIndex
(
index
))
def
addParticleInfoBox
(
self
,
particleIndex
):
self
.
particleInfoBox
=
ParticleInfo
(
self
.
dataset
.
particleContainer
.
getParticleOfIndex
(
particleIndex
))
self
.
scene
().
addItem
(
self
.
particleInfoBox
)
self
.
update
()
def
centerOnRamanIndex
(
self
,
index
,
centerOn
=
True
,
highlightIndex
=
True
):
if
centerOn
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment