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
146ef891
Commit
146ef891
authored
Oct 07, 2020
by
Gustavo Pinzon
Browse files
fixing numberOfThreads typo
parent
5b7f90f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
tools/filters/morphologicalOperations.py
View file @
146ef891
...
...
@@ -308,7 +308,7 @@ def reconstructionFromOppositeFaces(im, dmax=None, verbose=False):
return
rec1
# send the reconstructed image
def
directionalErosion
(
bwIm
,
vect
,
a
,
c
,
N
umberOfThreads
=
1
,
verbose
=
False
):
def
directionalErosion
(
bwIm
,
vect
,
a
,
c
,
n
umberOfThreads
=
1
,
verbose
=
False
):
"""
This functions performs direction erosion over the binarized image using
an ellipsoidal structuring element over a range of directions. It is highly
...
...
@@ -329,7 +329,7 @@ def directionalErosion(bwIm, vect, a, c, NumberOfThreads=1, verbose = False):
c : int or float
Lenght of the principal semi-axis of the structuring element in px
N
umberOfThreads : integer, optional
n
umberOfThreads : integer, optional
Number of Threads for multiprocessing.
Default = 1
...
...
@@ -379,11 +379,11 @@ def directionalErosion(bwIm, vect, a, c, NumberOfThreads=1, verbose = False):
# qJobs.put( contactList[x,0] )
qJobs
.
put
(
x
)
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
qJobs
.
put
(
"STOP"
)
# print "Master: Launching workers"
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
p
=
multiprocessing
.
Process
(
target
=
worker
,
args
=
(
i
,
qJobs
,
qResults
,
))
p
.
start
()
...
...
@@ -392,7 +392,7 @@ def directionalErosion(bwIm, vect, a, c, NumberOfThreads=1, verbose = False):
finishedThreads
=
0
finishedJobs
=
0
# print "Master: Waiting for results"
while
finishedThreads
<
N
umberOfThreads
:
while
finishedThreads
<
n
umberOfThreads
:
result
=
qResults
.
get
()
if
result
==
"STOP"
:
...
...
tools/label/contacts.py
View file @
146ef891
...
...
@@ -859,7 +859,7 @@ def _markerCorrection(markers, numMarkers, distanceMap, volBin, peakDistance=5,
return
markers
def
localDetectionAssembly
(
volLab
,
volGrey
,
contactList
,
localThreshold
,
boundingBoxes
=
None
,
N
umberOfThreads
=
1
,
radiusThresh
=
4
):
def
localDetectionAssembly
(
volLab
,
volGrey
,
contactList
,
localThreshold
,
boundingBoxes
=
None
,
n
umberOfThreads
=
1
,
radiusThresh
=
4
):
"""
Local contact refinement of a set of contacts
checks whether two particles are in contact with a local threshold using ``localDetection()``
...
...
@@ -883,7 +883,7 @@ def localDetectionAssembly(volLab, volGrey, contactList, localThreshold, boundin
Bounding boxes in format returned by ``boundingBoxes``.
If not defined (Default = None), it is recomputed by running ``boundingBoxes``
N
umberOfThreads : integer, optional
n
umberOfThreads : integer, optional
Number of Threads for multiprocessing
Default = 1
...
...
@@ -948,12 +948,12 @@ def localDetectionAssembly(volLab, volGrey, contactList, localThreshold, boundin
for
x
in
range
(
numberOfJobs
):
qJobs
.
put
(
x
)
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
qJobs
.
put
(
"STOP"
)
#print ("Master: Launching workers")
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
p
=
multiprocessing
.
Process
(
target
=
worker
,
args
=
(
i
,
qJobs
,
qResults
,
)
)
p
.
start
()
...
...
@@ -961,7 +961,7 @@ def localDetectionAssembly(volLab, volGrey, contactList, localThreshold, boundin
finishedThreads
=
0
finishedJobs
=
0
#print ("Master: Waiting for results")
while
finishedThreads
<
N
umberOfThreads
:
while
finishedThreads
<
n
umberOfThreads
:
result
=
qResults
.
get
()
if
result
==
"STOP"
:
...
...
@@ -980,7 +980,7 @@ def localDetectionAssembly(volLab, volGrey, contactList, localThreshold, boundin
return
numpy
.
asarray
(
contactListRefined
)
def
contactOrientationsAssembly
(
volLab
,
volGrey
,
contactList
,
watershed
=
"ITK"
,
peakDistance
=
5
,
boundingBoxes
=
None
,
N
umberOfThreads
=
1
,
verbose
=
False
):
def
contactOrientationsAssembly
(
volLab
,
volGrey
,
contactList
,
watershed
=
"ITK"
,
peakDistance
=
5
,
boundingBoxes
=
None
,
n
umberOfThreads
=
1
,
verbose
=
False
):
"""
Determines contact normal orientation in an assembly of touching particles
uses either directly the labelled image or the random walker implementation from skimage
...
...
@@ -1012,7 +1012,7 @@ def contactOrientationsAssembly(volLab, volGrey, contactList, watershed="ITK", p
Bounding boxes in format returned by ``boundingBoxes``.
If not defined (Default = None), it is recomputed by running ``boundingBoxes``
N
umberOfThreads : integer, optional
n
umberOfThreads : integer, optional
Number of Threads for multiprocessing.
Default = 1
...
...
@@ -1078,11 +1078,11 @@ def contactOrientationsAssembly(volLab, volGrey, contactList, watershed="ITK", p
# qJobs.put( contactList[x,0] )
qJobs
.
put
(
x
)
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
qJobs
.
put
(
"STOP"
)
# print "Master: Launching workers"
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
p
=
multiprocessing
.
Process
(
target
=
worker
,
args
=
(
i
,
qJobs
,
qResults
,
))
p
.
start
()
...
...
@@ -1090,7 +1090,7 @@ def contactOrientationsAssembly(volLab, volGrey, contactList, watershed="ITK", p
finishedThreads
=
0
finishedJobs
=
0
# print "Master: Waiting for results"
while
finishedThreads
<
N
umberOfThreads
:
while
finishedThreads
<
n
umberOfThreads
:
result
=
qResults
.
get
()
if
result
==
"STOP"
:
...
...
tools/label/label.py
View file @
146ef891
...
...
@@ -1331,7 +1331,7 @@ class Spheroid:
x
=
numpy
.
mgrid
[
slices
]
return
self
.
criterion
(
x
)
<=
1.0
def
fixUndersegmentation
(
imLab
,
imGrey
,
listLabels
,
a
,
c
,
numVect
=
100
,
vect
=
None
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
N
umberOfThreads
=
1
,
verbose
=
False
):
def
fixUndersegmentation
(
imLab
,
imGrey
,
listLabels
,
a
,
c
,
numVect
=
100
,
vect
=
None
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
n
umberOfThreads
=
1
,
verbose
=
False
):
"""
This function fix undersegmented particles using directional erosion over the particle
to get the seed for a new localized watershed.
...
...
@@ -1361,7 +1361,7 @@ def fixUndersegmentation(imLab, imGrey, listLabels, a, c, numVect = 100, vect =
c : int or float
Lenght of the principal semi-axis of the structuring element
N
umberOfThreads : integer (optional, default = 1)
n
umberOfThreads : integer (optional, default = 1)
Number of Threads for multiprocessing of the directional erosion.
Default = 1
...
...
@@ -1435,7 +1435,7 @@ def fixUndersegmentation(imLab, imGrey, listLabels, a, c, numVect = 100, vect =
while
Continue
==
False
:
#Directional Erosion
imEroded
=
spam
.
filters
.
morphologicalOperations
.
directionalErosion
(
bwIm
,
vect
,
a
,
c
,
N
umberOfThreads
=
N
umberOfThreads
,
a
,
c
,
n
umberOfThreads
=
n
umberOfThreads
,
verbose
=
verbose
)
#Label the markers
markers
,
num_seeds
=
scipy
.
ndimage
.
label
(
imEroded
)
...
...
@@ -1536,7 +1536,7 @@ def fixUndersegmentation(imLab, imGrey, listLabels, a, c, numVect = 100, vect =
return
imLab
def
convexVolume
(
lab
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
volumes
=
None
,
N
umberOfThreads
=
1
,
verbose
=
True
):
def
convexVolume
(
lab
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
volumes
=
None
,
n
umberOfThreads
=
1
,
verbose
=
True
):
"""
This function compute the convex hull of each label of the labelled image and return a
list with the convex volume of each particle.
...
...
@@ -1558,7 +1558,7 @@ def convexVolume(lab, boundingBoxes = None, centresOfMass = None, volumes = None
Volumes in format returned by ``volumes``
If not defined (Default = None), it is recomputed by running ``volumes``
N
umberOfThreads : integer (optional, default = 1)
n
umberOfThreads : integer (optional, default = 1)
Number of Threads for multiprocessing
Default = 1
...
...
@@ -1622,11 +1622,11 @@ def convexVolume(lab, boundingBoxes = None, centresOfMass = None, volumes = None
# print "Master: Adding jobs to queues"
for
x
in
range
(
1
,
numberOfJobs
+
1
):
qJobs
.
put
(
x
)
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
qJobs
.
put
(
"STOP"
)
# print "Master: Launching workers"
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
p
=
multiprocessing
.
Process
(
target
=
worker
,
args
=
(
i
,
qJobs
,
qResults
,
))
p
.
start
()
...
...
@@ -1635,7 +1635,7 @@ def convexVolume(lab, boundingBoxes = None, centresOfMass = None, volumes = None
finishedThreads
=
0
finishedJobs
=
0
# print "Master: Waiting for results"
while
finishedThreads
<
N
umberOfThreads
:
while
finishedThreads
<
n
umberOfThreads
:
result
=
qResults
.
get
()
if
result
==
"STOP"
:
...
...
@@ -1653,7 +1653,7 @@ def convexVolume(lab, boundingBoxes = None, centresOfMass = None, volumes = None
return
convexVolume
def
moveLabels
(
lab
,
PhiField
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
margin
=
3
,
PhiCOM
=
True
,
threshold
=
0.5
,
labelDilate
=
0
,
N
umberOfThreads
=
1
):
def
moveLabels
(
lab
,
PhiField
,
boundingBoxes
=
None
,
centresOfMass
=
None
,
margin
=
3
,
PhiCOM
=
True
,
threshold
=
0.5
,
labelDilate
=
0
,
n
umberOfThreads
=
1
):
"""
This function applies a discrete Phi field (from DDIC?) over a labelled image.
...
...
@@ -1690,7 +1690,7 @@ def moveLabels(lab, PhiField, boundingBoxes = None, centresOfMass = None, margin
If ``labelDilate > 0`` a dilated label is returned, while ``labelDilate < 0`` returns an eroded label.
Default = 0
N
umberOfThreads : int, optional
n
umberOfThreads : int, optional
Number of Threads for multiprocessing
Default = 1
...
...
@@ -1799,9 +1799,9 @@ def moveLabels(lab, PhiField, boundingBoxes = None, centresOfMass = None, margin
for
label
in
range
(
1
,
numberOfLabels
):
q_jobs
.
put
(
label
)
for
i
in
range
(
N
umberOfThreads
):
q_jobs
.
put
(
"STOP"
)
for
i
in
range
(
n
umberOfThreads
):
q_jobs
.
put
(
"STOP"
)
#Launching workers
for
i
in
range
(
N
umberOfThreads
):
for
i
in
range
(
n
umberOfThreads
):
p
=
multiprocessing
.
Process
(
target
=
work_on_one_job
,
args
=
(
i
,
q_jobs
,
q_results
,))
p
.
start
()
...
...
@@ -1812,7 +1812,7 @@ def moveLabels(lab, PhiField, boundingBoxes = None, centresOfMass = None, margin
pbar
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
maxval
=
numberOfLabels
)
pbar
.
start
()
while
finished_threads
<
N
umberOfThreads
:
while
finished_threads
<
n
umberOfThreads
:
result
=
q_results
.
get
()
if
result
==
"STOP"
:
...
...
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