httomolibgpu 2.3.1__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {httomolibgpu-2.3.1/httomolibgpu.egg-info → httomolibgpu-2.4.0}/PKG-INFO +1 -2
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/recon/algorithm.py +41 -11
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/recon/rotation.py +4 -4
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0/httomolibgpu.egg-info}/PKG-INFO +1 -2
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu.egg-info/requires.txt +0 -1
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/pyproject.toml +0 -3
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/LICENSE +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/MANIFEST.in +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/README.rst +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/__init__.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cuda_kernels/__init__.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cuda_kernels/calc_metrics.cu +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cuda_kernels/center_360_shifts.cu +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cuda_kernels/generate_mask.cu +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cuda_kernels/median_kernel.cu +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cuda_kernels/paganin_filter_gen.cu +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cuda_kernels/raven_filter.cu +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/cupywrapper.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/misc/__init__.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/misc/corr.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/misc/denoise.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/misc/morph.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/misc/rescale.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/prep/__init__.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/prep/alignment.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/prep/normalize.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/prep/phase.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/prep/stripe.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu/recon/__init__.py +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu.egg-info/SOURCES.txt +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu.egg-info/dependency_links.txt +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/httomolibgpu.egg-info/top_level.txt +0 -0
- {httomolibgpu-2.3.1 → httomolibgpu-2.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: httomolibgpu
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Commonly used tomography data processing methods at DLS.
|
|
5
5
|
Author-email: Daniil Kazantsev <daniil.kazantsev@diamond.ac.uk>, Yousef Moazzam <yousef.moazzam@diamond.ac.uk>, Naman Gera <naman.gera@diamond.ac.uk>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -19,7 +19,6 @@ Requires-Dist: scipy
|
|
|
19
19
|
Requires-Dist: pillow
|
|
20
20
|
Requires-Dist: scikit-image
|
|
21
21
|
Requires-Dist: tomobar
|
|
22
|
-
Requires-Dist: ccpi-regularisation-cupy
|
|
23
22
|
Provides-Extra: dev
|
|
24
23
|
Requires-Dist: pytest; extra == "dev"
|
|
25
24
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -54,9 +54,10 @@ def FBP(
|
|
|
54
54
|
data: cp.ndarray,
|
|
55
55
|
angles: np.ndarray,
|
|
56
56
|
center: Optional[float] = None,
|
|
57
|
-
filter_freq_cutoff:
|
|
57
|
+
filter_freq_cutoff: float = 0.35,
|
|
58
58
|
recon_size: Optional[int] = None,
|
|
59
|
-
recon_mask_radius:
|
|
59
|
+
recon_mask_radius: float = 0.95,
|
|
60
|
+
neglog: bool = False,
|
|
60
61
|
gpu_id: int = 0,
|
|
61
62
|
) -> cp.ndarray:
|
|
62
63
|
"""
|
|
@@ -81,6 +82,9 @@ def FBP(
|
|
|
81
82
|
The radius of the circular mask that applies to the reconstructed slice in order to crop
|
|
82
83
|
out some undesirable artifacts. The values outside the given diameter will be set to zero.
|
|
83
84
|
It is recommended to keep the value in the range [0.7-1.0].
|
|
85
|
+
neglog: bool
|
|
86
|
+
Take negative logarithm on input data to convert to attenuation coefficient or a density of the scanned object. Defaults to False,
|
|
87
|
+
assuming that the negative log is taken either in normalisation procedure on with Paganin filter application.
|
|
84
88
|
gpu_id : int
|
|
85
89
|
A GPU device index to perform operation on.
|
|
86
90
|
|
|
@@ -94,7 +98,7 @@ def FBP(
|
|
|
94
98
|
)
|
|
95
99
|
|
|
96
100
|
reconstruction = RecToolsCP.FBP(
|
|
97
|
-
data,
|
|
101
|
+
_take_neg_log(data) if neglog else data,
|
|
98
102
|
cutoff_freq=filter_freq_cutoff,
|
|
99
103
|
recon_mask_radius=recon_mask_radius,
|
|
100
104
|
data_axes_labels_order=input_data_axis_labels,
|
|
@@ -110,6 +114,7 @@ def LPRec(
|
|
|
110
114
|
center: Optional[float] = None,
|
|
111
115
|
recon_size: Optional[int] = None,
|
|
112
116
|
recon_mask_radius: Optional[float] = 0.95,
|
|
117
|
+
neglog: bool = False,
|
|
113
118
|
) -> cp.ndarray:
|
|
114
119
|
"""
|
|
115
120
|
Fourier direct inversion in 3D on unequally spaced (also called as Log-Polar) grids using
|
|
@@ -131,6 +136,9 @@ def LPRec(
|
|
|
131
136
|
The radius of the circular mask that applies to the reconstructed slice in order to crop
|
|
132
137
|
out some undesirable artifacts. The values outside the given diameter will be set to zero.
|
|
133
138
|
It is recommended to keep the value in the range [0.7-1.0].
|
|
139
|
+
neglog: bool
|
|
140
|
+
Take negative logarithm on input data to convert to attenuation coefficient or a density of the scanned object. Defaults to False,
|
|
141
|
+
assuming that the negative log is taken either in normalisation procedure on with Paganin filter application.
|
|
134
142
|
|
|
135
143
|
Returns
|
|
136
144
|
-------
|
|
@@ -140,7 +148,7 @@ def LPRec(
|
|
|
140
148
|
RecToolsCP = _instantiate_direct_recon_class(data, angles, center, recon_size, 0)
|
|
141
149
|
|
|
142
150
|
reconstruction = RecToolsCP.FOURIER_INV(
|
|
143
|
-
data,
|
|
151
|
+
_take_neg_log(data) if neglog else data,
|
|
144
152
|
recon_mask_radius=recon_mask_radius,
|
|
145
153
|
data_axes_labels_order=input_data_axis_labels,
|
|
146
154
|
)
|
|
@@ -156,12 +164,14 @@ def SIRT(
|
|
|
156
164
|
recon_size: Optional[int] = None,
|
|
157
165
|
iterations: Optional[int] = 300,
|
|
158
166
|
nonnegativity: Optional[bool] = True,
|
|
167
|
+
neglog: bool = False,
|
|
159
168
|
gpu_id: int = 0,
|
|
160
169
|
) -> cp.ndarray:
|
|
161
170
|
"""
|
|
162
171
|
Perform Simultaneous Iterative Recostruction Technique (SIRT) using ASTRA toolbox :cite:`van2016fast` and
|
|
163
172
|
ToMoBAR :cite:`kazantsev2020tomographic` wrappers.
|
|
164
|
-
This is 3D recon directly from a CuPy array while using ASTRA GPUlink capability
|
|
173
|
+
This is 3D recon directly from a CuPy array while using ASTRA GPUlink capability to avoid host-device
|
|
174
|
+
transactions for projection and backprojection.
|
|
165
175
|
|
|
166
176
|
Parameters
|
|
167
177
|
----------
|
|
@@ -178,6 +188,9 @@ def SIRT(
|
|
|
178
188
|
The number of SIRT iterations.
|
|
179
189
|
nonnegativity : bool, optional
|
|
180
190
|
Impose nonnegativity constraint on reconstructed image.
|
|
191
|
+
neglog: bool
|
|
192
|
+
Take negative logarithm on input data to convert to attenuation coefficient or a density of the scanned object. Defaults to False,
|
|
193
|
+
assuming that the negative log is taken either in normalisation procedure on with Paganin filter application.
|
|
181
194
|
gpu_id : int, optional
|
|
182
195
|
A GPU device index to perform operation on.
|
|
183
196
|
|
|
@@ -187,11 +200,16 @@ def SIRT(
|
|
|
187
200
|
The SIRT reconstructed volume as a CuPy array.
|
|
188
201
|
"""
|
|
189
202
|
RecToolsCP = _instantiate_iterative_recon_class(
|
|
190
|
-
data,
|
|
203
|
+
data,
|
|
204
|
+
angles,
|
|
205
|
+
center,
|
|
206
|
+
recon_size,
|
|
207
|
+
gpu_id,
|
|
208
|
+
datafidelity="LS",
|
|
191
209
|
)
|
|
192
210
|
|
|
193
211
|
_data_ = {
|
|
194
|
-
"projection_norm_data": data,
|
|
212
|
+
"projection_norm_data": _take_neg_log(data) if neglog else data,
|
|
195
213
|
"data_axes_labels_order": input_data_axis_labels,
|
|
196
214
|
} # data dictionary
|
|
197
215
|
_algorithm_ = {
|
|
@@ -211,12 +229,14 @@ def CGLS(
|
|
|
211
229
|
recon_size: Optional[int] = None,
|
|
212
230
|
iterations: Optional[int] = 20,
|
|
213
231
|
nonnegativity: Optional[bool] = True,
|
|
232
|
+
neglog: bool = False,
|
|
214
233
|
gpu_id: int = 0,
|
|
215
234
|
) -> cp.ndarray:
|
|
216
235
|
"""
|
|
217
|
-
Perform
|
|
236
|
+
Perform Conjugate Gradient Least Squares (CGLS) using ASTRA toolbox :cite:`van2016fast` and
|
|
218
237
|
ToMoBAR :cite:`kazantsev2020tomographic` wrappers.
|
|
219
|
-
This is 3D recon directly from a CuPy array while using ASTRA GPUlink capability
|
|
238
|
+
This is 3D recon directly from a CuPy array while using ASTRA GPUlink capability to avoid host-device
|
|
239
|
+
transactions for projection and backprojection.
|
|
220
240
|
|
|
221
241
|
Parameters
|
|
222
242
|
----------
|
|
@@ -233,6 +253,9 @@ def CGLS(
|
|
|
233
253
|
The number of CGLS iterations.
|
|
234
254
|
nonnegativity : bool, optional
|
|
235
255
|
Impose nonnegativity constraint on reconstructed image.
|
|
256
|
+
neglog: bool
|
|
257
|
+
Take negative logarithm on input data to convert to attenuation coefficient or a density of the scanned object. Defaults to False,
|
|
258
|
+
assuming that the negative log is taken either in normalisation procedure on with Paganin filter application.
|
|
236
259
|
gpu_id : int, optional
|
|
237
260
|
A GPU device index to perform operation on.
|
|
238
261
|
|
|
@@ -246,7 +269,7 @@ def CGLS(
|
|
|
246
269
|
)
|
|
247
270
|
|
|
248
271
|
_data_ = {
|
|
249
|
-
"projection_norm_data": data,
|
|
272
|
+
"projection_norm_data": _take_neg_log(data) if neglog else data,
|
|
250
273
|
"data_axes_labels_order": input_data_axis_labels,
|
|
251
274
|
} # data dictionary
|
|
252
275
|
_algorithm_ = {"iterations": iterations, "nonnegativity": nonnegativity}
|
|
@@ -254,7 +277,6 @@ def CGLS(
|
|
|
254
277
|
cp._default_memory_pool.free_all_blocks()
|
|
255
278
|
return cp.require(cp.swapaxes(reconstruction, 0, 1), requirements="C")
|
|
256
279
|
|
|
257
|
-
|
|
258
280
|
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ##
|
|
259
281
|
def _instantiate_direct_recon_class(
|
|
260
282
|
data: cp.ndarray,
|
|
@@ -329,3 +351,11 @@ def _instantiate_iterative_recon_class(
|
|
|
329
351
|
device_projector=gpu_id,
|
|
330
352
|
)
|
|
331
353
|
return RecToolsCP
|
|
354
|
+
|
|
355
|
+
def _take_neg_log(data: cp.ndarray) -> cp.ndarray:
|
|
356
|
+
"""Taking negative log"""
|
|
357
|
+
data[data<=0] = 1
|
|
358
|
+
data = -cp.log(data)
|
|
359
|
+
data[cp.isnan(data)] = 6.0
|
|
360
|
+
data[cp.isinf(data)] = 0
|
|
361
|
+
return data
|
|
@@ -60,10 +60,10 @@ def find_center_vo(
|
|
|
60
60
|
ind: Optional[int] = None,
|
|
61
61
|
average_radius: int = 0,
|
|
62
62
|
cor_initialisation_value: Optional[float] = None,
|
|
63
|
-
smin: int = -
|
|
64
|
-
smax: int =
|
|
63
|
+
smin: int = -50,
|
|
64
|
+
smax: int = 50,
|
|
65
65
|
srad: float = 6.0,
|
|
66
|
-
step: float = 0.
|
|
66
|
+
step: float = 0.5,
|
|
67
67
|
ratio: float = 0.5,
|
|
68
68
|
drop: int = 20,
|
|
69
69
|
) -> np.float32:
|
|
@@ -117,7 +117,7 @@ def find_center_vo(
|
|
|
117
117
|
average_radius = ind
|
|
118
118
|
if ind > 0:
|
|
119
119
|
_sino = cp.mean(
|
|
120
|
-
data[:, ind - average_radius : ind + average_radius, :], axis=1
|
|
120
|
+
data[:, ind - average_radius : ind + average_radius + 1, :], axis=1
|
|
121
121
|
)
|
|
122
122
|
else:
|
|
123
123
|
_sino = data[:, ind, :]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: httomolibgpu
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Commonly used tomography data processing methods at DLS.
|
|
5
5
|
Author-email: Daniil Kazantsev <daniil.kazantsev@diamond.ac.uk>, Yousef Moazzam <yousef.moazzam@diamond.ac.uk>, Naman Gera <naman.gera@diamond.ac.uk>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -19,7 +19,6 @@ Requires-Dist: scipy
|
|
|
19
19
|
Requires-Dist: pillow
|
|
20
20
|
Requires-Dist: scikit-image
|
|
21
21
|
Requires-Dist: tomobar
|
|
22
|
-
Requires-Dist: ccpi-regularisation-cupy
|
|
23
22
|
Provides-Extra: dev
|
|
24
23
|
Requires-Dist: pytest; extra == "dev"
|
|
25
24
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -44,7 +44,6 @@ dependencies = [
|
|
|
44
44
|
"pillow",
|
|
45
45
|
"scikit-image",
|
|
46
46
|
"tomobar",
|
|
47
|
-
"ccpi-regularisation-cupy"
|
|
48
47
|
]
|
|
49
48
|
|
|
50
49
|
[project.optional-dependencies]
|
|
@@ -73,8 +72,6 @@ addopts = [
|
|
|
73
72
|
"-vv",
|
|
74
73
|
"-ra",
|
|
75
74
|
"-q",
|
|
76
|
-
"--benchmark-sort=mean",
|
|
77
|
-
"--benchmark-columns=mean",
|
|
78
75
|
"--tb=native",
|
|
79
76
|
"--cov-report=term",
|
|
80
77
|
"--cov-report=xml:cov.xml",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|