Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ttk
spam
Commits
57506705
Commit
57506705
authored
Aug 14, 2020
by
Edward Andò
Browse files
default value
parent
9de391fe
Pipeline
#47870
passed with stages
in 12 minutes and 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tools/label/contacts.py
View file @
57506705
...
...
@@ -820,7 +820,7 @@ def _markerCorrection(markers, numMarkers, distanceMap, volBin, peakDistance=5,
peakDistance
=
int
(
peakDistance
*
1.3
)
localMaxi
=
skimage
.
feature
.
peak_local_max
(
distanceMap
,
min_distance
=
peakDistance
,
indices
=
False
,
exclude_border
=
False
,
labels
=
volBin
,
num_peaks
=
2
)
markers
,
numMarkers
=
scipy
.
ndimage
.
measurements
.
label
(
localMaxi
,
structure
=
struc
)
# If there are no markers, decrease peakDistance
while
(
numpy
.
any
(
markers
)
==
False
or
numpy
.
amax
(
markers
)
<
2
):
if
(
counter
>
10
):
...
...
@@ -830,7 +830,7 @@ def _markerCorrection(markers, numMarkers, distanceMap, volBin, peakDistance=5,
localMaxi
=
skimage
.
feature
.
peak_local_max
(
distanceMap
,
min_distance
=
peakDistance
,
indices
=
False
,
exclude_border
=
False
,
labels
=
volBin
,
num_peaks
=
2
)
markers
,
numMarkers
=
scipy
.
ndimage
.
measurements
.
label
(
localMaxi
,
structure
=
struc
)
counter
=
counter
+
1
if
(
numpy
.
amax
(
markers
)
>
2
):
centerOfMass
=
scipy
.
ndimage
.
measurements
.
center_of_mass
(
markers
,
labels
=
markers
,
index
=
range
(
1
,
numMarkers
+
1
))
distances
=
numpy
.
zeros
((
numMarkers
,
numMarkers
))
...
...
tools/label/label.py
View file @
57506705
...
...
@@ -411,7 +411,7 @@ def _checkSlice(topOfSlice, botOfSlice, topLimit, botLimit):
return
returnSliceLimited
,
returnSliceOffset
def
getLabel
(
labelledVolume
,
label
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
margin
=
None
,
extractCube
=
False
,
extractCubeSize
=
None
,
maskOtherLabels
=
True
,
labelDilate
=
0
,
labelDilateMaskOtherLabels
=
Tru
e
):
def
getLabel
(
labelledVolume
,
label
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
margin
=
None
,
extractCube
=
False
,
extractCubeSize
=
None
,
maskOtherLabels
=
True
,
labelDilate
=
0
,
labelDilateMaskOtherLabels
=
Fals
e
):
"""
Helper function to extract labels from a labelled image/volume.
A dictionary is returned with the a subvolume around the particle.
...
...
@@ -588,7 +588,7 @@ def getLabel(labelledVolume, label, boundingBoxes=None, centresOfMass=None, marg
maskLab
[
numpy
.
logical_and
(
labSubVol
!=
label
,
labSubVol
!=
0
)]
=
0
if
labelDilate
<
0
:
strucuringElement
=
spam
.
mesh
.
structuringElement
(
radius
=-
1
*
labelDilate
,
order
=
2
,
dim
=
3
)
maskLab
=
scipy
.
ndimage
.
morphology
.
binary_erosion
(
maskLab
,
structure
=
strucuringElement
,
iterations
=
1
)
maskLab
=
scipy
.
ndimage
.
morphology
.
binary_erosion
(
maskLab
,
structure
=
strucuringElement
,
iterations
=
1
)
# Just overwrite "labSubVol"
labSubVol
=
maskLab
...
...
Write
Preview
Supports
Markdown
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