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
5c46290c
Commit
5c46290c
authored
Aug 20, 2019
by
JosefBrandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix in loading TrueMatch results
parent
1d7c4a61
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
49 deletions
+31
-49
analysis/particleCharacterization.py
analysis/particleCharacterization.py
+1
-4
analysis/particleClassification/shapeClassification.py
analysis/particleClassification/shapeClassification.py
+2
-8
analysis/particleContainer.py
analysis/particleContainer.py
+8
-14
sampleview.py
sampleview.py
+20
-23
No files found.
analysis/particleCharacterization.py
View file @
5c46290c
...
...
@@ -74,10 +74,7 @@ def getParticleColor(imgRGB, colorClassifier=None):
def
getParticleShape
(
contour
,
particleHeight
,
shapeClassifier
=
None
):
if
shapeClassifier
is
None
:
shapeClassifier
=
ShapeClassifier
()
try
:
shape
=
shapeClassifier
.
classifyShape
(
contour
,
particleHeight
)
except
InvalidParticleError
:
raise
shape
=
shapeClassifier
.
classifyShape
(
contour
,
particleHeight
)
return
shape
def
getParticleHeight
(
contour
,
dataset
):
...
...
analysis/particleClassification/shapeClassification.py
View file @
5c46290c
...
...
@@ -50,10 +50,7 @@ class BaseShape(object):
self
.
solidity
=
area
/
hull_area
try
:
long
,
short
=
self
.
getEllipseOrBoxLongAndShortSize
()
except
InvalidParticleError
:
raise
InvalidParticleError
long
,
short
=
self
.
getEllipseOrBoxLongAndShortSize
()
self
.
aspectRatio
=
long
/
short
avgLength
=
(
long
+
short
)
/
2
...
...
@@ -138,10 +135,7 @@ class ShapeClassifier(object):
newShape
=
BaseShape
()
newShape
.
contour
=
contour
newShape
.
height
=
particleHeight
try
:
newShape
.
getParticleCharacteristics
()
except
InvalidParticleError
:
raise
InvalidParticleError
newShape
.
getParticleCharacteristics
()
mostFittingCriteria
=
0
bestFittingShape
=
'unknown'
...
...
analysis/particleContainer.py
View file @
5c46290c
...
...
@@ -134,23 +134,17 @@ class ParticleContainer(object):
def
applyAssignmentListToParticleMeasurements
(
self
,
assignmentList
):
'''AssignmentList is list of spectra assignments in order of spectra indices'''
indicesOfTransferredAssignments
=
[
None
]
*
len
(
assignmentList
)
for
particle
in
self
.
particles
:
for
meas
in
particle
.
getMeasurements
():
scanIndex
=
meas
.
getScanIndex
()
meas
.
setAssignment
(
assignmentList
[
scanIndex
])
indicesOfTransferredAssignments
[
scanIndex
]
=
scanIndex
assert
not
None
in
indicesOfTransferredAssignments
assert
len
(
assignmentList
)
==
len
(
self
.
measurements
),
f
'assertion error in assignment of results:
{
len
(
assignmentList
)
}
results for
{
len
(
self
.
measurements
)
}
spectra...'
for
meas
in
self
.
measurements
:
scanIndex
=
meas
.
getScanIndex
()
meas
.
setAssignment
(
assignmentList
[
scanIndex
])
def
applyHQIListToParticleMeasurements
(
self
,
hqiList
):
'''HQI-List is list of spectra hqis in order of spectra indices'''
indicesOfTransferredHQIs
=
[
None
]
*
len
(
hqiList
)
for
particle
in
self
.
particles
:
for
meas
in
particle
.
getMeasurements
():
scanIndex
=
meas
.
getScanIndex
()
meas
.
setHQI
(
hqiList
[
scanIndex
])
indicesOfTransferredHQIs
[
scanIndex
]
=
scanIndex
assert
not
None
in
indicesOfTransferredHQIs
assert
len
(
hqiList
)
==
len
(
self
.
measurements
),
f
'assertion error in assignment of hqis:
{
len
(
hqiList
)
}
results for
{
len
(
self
.
measurements
)
}
spectra...'
for
meas
in
self
.
measurements
:
scanIndex
=
meas
.
getScanIndex
()
meas
.
setHQI
(
hqiList
[
scanIndex
])
def
reassignParticleToAssignment
(
self
,
particleIndex
,
newAssignment
):
particle
=
self
.
getParticleOfIndex
(
particleIndex
)
...
...
sampleview.py
View file @
5c46290c
...
...
@@ -81,7 +81,7 @@ class SampleView(QtWidgets.QGraphicsView):
self
.
boundaryitems
=
[[],[]]
self
.
scanitems
=
[]
self
.
ramanscanitems
=
[]
self
.
particleInfoBox
es
=
[]
self
.
particleInfoBox
=
None
self
.
imgdata
=
None
self
.
isblocked
=
False
self
.
contourItems
=
[]
...
...
@@ -387,26 +387,19 @@ class SampleView(QtWidgets.QGraphicsView):
cnt
.
update
()
if
cnt
.
particleIndex
not
in
self
.
selectedParticleIndices
:
self
.
selectedParticleIndices
.
append
(
cnt
.
particleIndex
)
addParticleInfoBox
(
cnt
.
particleIndex
)
#
addParticleInfoBox(cnt.particleIndex)
def
removeContourFromSelection
(
cnt
):
cnt
.
isSelected
=
False
cnt
.
update
()
self
.
selectedParticleIndices
.
remove
(
cnt
.
particleIndex
)
removeParticleInfoBox
(
cnt
.
particleIndex
)
#
removeParticleInfoBox(cnt.particleIndex)
def
addParticleInfoBox
(
index
):
newInfoBox
=
ParticleInfo
(
self
.
dataset
.
particleContainer
.
getParticleOfIndex
(
cnt
.
particleIndex
))
self
.
particleInfoBoxes
.
append
(
newInfoBox
)
self
.
scene
().
addItem
(
newInfoBox
)
self
.
update
()
def
removeParticleInfoBox
(
index
):
for
infoBox
in
self
.
particleInfoBoxes
:
if
infoBox
.
particle
.
index
==
index
:
self
.
scene
().
removeItem
(
infoBox
)
self
.
particleInfoBoxes
.
remove
(
infoBox
)
self
.
update
()
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
())
...
...
@@ -428,8 +421,13 @@ class SampleView(QtWidgets.QGraphicsView):
cnt
.
update
()
if
cnt
.
particleIndex
in
self
.
selectedParticleIndices
:
self
.
selectedParticleIndices
.
remove
(
cnt
.
particleIndex
)
removeParticleInfoBox
(
cnt
.
particleIndex
)
if
len
(
self
.
selectedParticleIndices
)
>
0
:
updateParticleInfoBox
(
self
.
selectedParticleIndices
[
-
1
])
else
:
self
.
scene
().
removeItem
(
self
.
particleInfoBox
)
self
.
particleInfoBox
=
None
self
.
update
()
def
scaleImage
(
self
,
factor
):
...
...
@@ -499,7 +497,7 @@ class SampleView(QtWidgets.QGraphicsView):
self
.
item
.
setOpacity
(
1
)
else
:
self
.
item
.
setPiparticleInfoBox
es
xmap
(
QtGui
.
QPixmap
())
self
.
item
.
setPiparticleInfoBoxxmap
(
QtGui
.
QPixmap
())
if
self
.
mode
==
"OpticalScan"
:
for
i
,
p
in
zip
(
self
.
dataset
.
fitindices
,
self
.
dataset
.
fitpoints
):
p
=
self
.
dataset
.
mapToPixel
(
p
,
mode
=
microscope_mode
,
force
=
True
)
...
...
@@ -616,12 +614,11 @@ class SampleView(QtWidgets.QGraphicsView):
self
.
contourItems
[
index
].
isSelected
=
True
self
.
selectedParticleIndices
=
[
index
]
f
or
infoBox
in
self
.
particleInfoBoxe
s
:
self
.
scene
().
removeItem
(
i
nfoBox
)
i
f
self
.
particleInfoBox
is
not
Non
e
:
self
.
scene
().
removeItem
(
self
.
particleI
nfoBox
)
newInfoBox
=
ParticleInfo
(
self
.
dataset
.
particleContainer
.
getParticleOfIndex
(
index
))
self
.
particleInfoBoxes
=
[
newInfoBox
]
self
.
scene
().
addItem
(
newInfoBox
)
self
.
particleInfoBox
=
ParticleInfo
(
self
.
dataset
.
particleContainer
.
getParticleOfIndex
(
index
))
self
.
scene
().
addItem
(
self
.
particleInfoBox
)
self
.
update
()
def
centerOnRamanIndex
(
self
,
index
,
centerOn
=
True
,
highlightIndex
=
True
):
...
...
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