Skip to content

Commit 489803a

Browse files
authored
Merge pull request #240 from DiamondLightSource/datachecker
Data checker function for GPU only
2 parents af3d4c3 + 232384d commit 489803a

File tree

17 files changed

+260
-468
lines changed

17 files changed

+260
-468
lines changed

httomolibgpu/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from httomolibgpu.misc.utils import data_checker
2+
13
from httomolibgpu.misc.corr import median_filter, remove_outlier
24
from httomolibgpu.misc.denoise import total_variation_ROF, total_variation_PD
35
from httomolibgpu.misc.morph import sino_360_to_180, data_resampler

httomolibgpu/misc/corr.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
else:
3737
load_cuda_module = Mock()
3838

39-
from httomolibgpu.misc.supp_func import data_checker
40-
4139
__all__ = [
4240
"median_filter",
4341
"remove_outlier",
@@ -82,10 +80,6 @@ def median_filter(
8280
else:
8381
raise ValueError("The input array must be a 3D array")
8482

85-
data = data_checker(
86-
data, verbosity=True, method_name="median_filter_or_remove_outlier"
87-
)
88-
8983
if kernel_size not in [3, 5, 7, 9, 11, 13]:
9084
raise ValueError("Please select a correct kernel size: 3, 5, 7, 9, 11, 13")
9185

httomolibgpu/misc/denoise.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
from unittest.mock import Mock
3131

32-
from httomolibgpu.misc.supp_func import data_checker
33-
3432
if cupy_run:
3533
from tomobar.regularisersCuPy import ROF_TV_cupy, PD_TV_cupy
3634
else:
@@ -84,8 +82,6 @@ def total_variation_ROF(
8482
If the input array is not float32 data type.
8583
"""
8684

87-
data = data_checker(data, verbosity=True, method_name="total_variation_ROF")
88-
8985
return ROF_TV_cupy(
9086
data,
9187
regularisation_parameter,
@@ -139,8 +135,6 @@ def total_variation_PD(
139135
If the input array is not float32 data type.
140136
"""
141137

142-
data_checker(data, verbosity=True, method_name="total_variation_PD")
143-
144138
methodTV = 0
145139
if not isotropic:
146140
methodTV = 1

httomolibgpu/misc/morph.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535

3636
from typing import Literal
3737

38-
from httomolibgpu.misc.supp_func import data_checker
39-
4038
__all__ = [
4139
"sino_360_to_180",
4240
"data_resampler",
@@ -68,8 +66,6 @@ def sino_360_to_180(
6866
if data.ndim != 3:
6967
raise ValueError("only 3D data is supported")
7068

71-
data = data_checker(data, verbosity=True, method_name="sino_360_to_180")
72-
7369
dx, dy, dz = data.shape
7470

7571
overlap = int(np.round(overlap))
@@ -142,8 +138,6 @@ def data_resampler(
142138
data = cp.expand_dims(data, 1)
143139
axis = 1
144140

145-
data = data_checker(data, verbosity=True, method_name="data_resampler")
146-
147141
N, M, Z = cp.shape(data)
148142

149143
if axis == 0:

httomolibgpu/misc/rescale.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
from typing import Literal, Optional, Tuple, Union
2929

30-
from httomolibgpu.misc.supp_func import data_checker
31-
3230

3331
__all__ = [
3432
"rescale_to_int",
@@ -80,8 +78,6 @@ def rescale_to_int(
8078
else:
8179
output_dtype = np.uint32
8280

83-
data = data_checker(data, verbosity=True, method_name="rescale_to_int")
84-
8581
# get the min and max integer values of the output type
8682
output_min = cp.iinfo(output_dtype).min
8783
output_max = cp.iinfo(output_dtype).max

httomolibgpu/misc/supp_func.py

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)