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
radioSphere
Commits
9578d3d8
Commit
9578d3d8
authored
Nov 19, 2021
by
Olga Stamati
Browse files
fourier convolution of fx series with psi series SE in divergent beam
parent
af16e5db
Pipeline
#80318
passed with stage
in 3 minutes and 34 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tools/detectSpheres.py
View file @
9578d3d8
'''
Implementation of tomopack by Stéphane Roux
Tool for sphere detection in parallel and divergent beam
'''
import
os
import
numpy
import
radioSphere.projectSphere
import
scipy.ndimage
import
scipy.signal
from
scipy.spatial
import
distance
import
matplotlib.pyplot
as
plt
...
...
@@ -437,7 +438,6 @@ def tomopackDivergentScanTo3DPositions(radioMM, radiusMM,
scanFixedNumber
=
None
,
scanPersistenceThreshold
=
7
,
maxIterations
=
50
,
sourceDetectorDistMM
=
100
,
pixelSizeMM
=
0.1
,
l
=
0.2
,
kTrustRatio
=
0.7
,
useCache
=
True
,
numCores
=
1
,
blur
=
0.0
,
cacheFile
=
'fXseries.tif'
,
verbose
=
False
):
...
...
@@ -511,8 +511,8 @@ def tomopackDivergentScanTo3DPositions(radioMM, radiusMM,
sourceDetectorDistMM
=
sourceDetectorDistMM
,
blur
=
blur
)
fXseries
[
posN
]
=
radioSphere
.
detectSpheres
.
tomopack
(
radioMM
,
psiMM
,
GRAPH
=
0
,
maxIterations
=
maxIterations
,
l
=
l
,
kTrustRatio
=
kTrustRatio
)
psiXseries
[
posN
]
=
radioSphere
.
detectSpheres
.
tomopack
(
psiRefMM
,
psiMM
,
GRAPH
=
0
,
maxIterations
=
maxIterations
,
l
=
l
,
kTrustRatio
=
kTrustRatio
)
fXseries
[
posN
]
=
radioSphere
.
detectSpheres
.
tomopack
(
radioMM
,
psiMM
,
maxIterations
=
maxIterations
,
l
=
l
,
kTrustRatio
=
kTrustRatio
)
psiXseries
[
posN
]
=
radioSphere
.
detectSpheres
.
tomopack
(
psiRefMM
,
psiMM
,
maxIterations
=
maxIterations
,
l
=
l
,
kTrustRatio
=
kTrustRatio
)
psiMMseries
[
posN
]
=
psiMM
if
useCache
and
not
loadedCache
:
...
...
@@ -540,14 +540,14 @@ def tomopackDivergentScanTo3DPositions(radioMM, radiusMM,
(
psiXseries
.
shape
[
1
])
//
2
-
L_yz
:(
psiXseries
.
shape
[
1
])
//
2
+
L_yz
+
1
,
(
psiXseries
.
shape
[
2
])
//
2
-
L_yz
:(
psiXseries
.
shape
[
2
])
//
2
+
L_yz
+
1
]
fXconvolvedSeries
=
scipy
.
ndimage
.
convolve
(
fXseries
,
struct
/
struct
.
sum
())
#fXconvolvedSeries = scipy.ndimage.convolve(fXseries,struct/struct.sum())
# OS 2021-11-19: Let's do a fourier convolution which should be way faster
fXconvolvedSeries
=
scipy
.
signal
.
convolve
(
fXseries
,
struct
/
struct
.
sum
(),
mode
=
"same"
)
if
useCache
and
not
loadedCache
:
tifffile
.
imsave
(
f
'
{
cacheFile
[:
-
4
]
}
_struct.tif'
,
struct
.
astype
(
'<f4'
))
tifffile
.
imsave
(
f
'
{
cacheFile
[:
-
4
]
}
_fXconvolvedSeries.tif'
,
fXconvolvedSeries
.
astype
(
'<f4'
))
binaryPeaks
=
fXconvolvedSeries
>
massThreshold
get_peaks_from_persistence
=
False
if
get_peaks_from_persistence
:
...
...
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