stouputils 1.14.2__py3-none-any.whl → 1.15.0__py3-none-any.whl
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.
- stouputils/continuous_delivery/pypi.py +1 -1
- stouputils/continuous_delivery/pypi.pyi +3 -2
- stouputils/data_science/config/get.py +51 -51
- stouputils/data_science/data_processing/image/__init__.py +66 -66
- stouputils/data_science/data_processing/image/auto_contrast.py +79 -79
- stouputils/data_science/data_processing/image/axis_flip.py +58 -58
- stouputils/data_science/data_processing/image/bias_field_correction.py +74 -74
- stouputils/data_science/data_processing/image/binary_threshold.py +73 -73
- stouputils/data_science/data_processing/image/blur.py +59 -59
- stouputils/data_science/data_processing/image/brightness.py +54 -54
- stouputils/data_science/data_processing/image/canny.py +110 -110
- stouputils/data_science/data_processing/image/clahe.py +92 -92
- stouputils/data_science/data_processing/image/common.py +30 -30
- stouputils/data_science/data_processing/image/contrast.py +53 -53
- stouputils/data_science/data_processing/image/curvature_flow_filter.py +74 -74
- stouputils/data_science/data_processing/image/denoise.py +378 -378
- stouputils/data_science/data_processing/image/histogram_equalization.py +123 -123
- stouputils/data_science/data_processing/image/invert.py +64 -64
- stouputils/data_science/data_processing/image/laplacian.py +60 -60
- stouputils/data_science/data_processing/image/median_blur.py +52 -52
- stouputils/data_science/data_processing/image/noise.py +59 -59
- stouputils/data_science/data_processing/image/normalize.py +65 -65
- stouputils/data_science/data_processing/image/random_erase.py +66 -66
- stouputils/data_science/data_processing/image/resize.py +69 -69
- stouputils/data_science/data_processing/image/rotation.py +80 -80
- stouputils/data_science/data_processing/image/salt_pepper.py +68 -68
- stouputils/data_science/data_processing/image/sharpening.py +55 -55
- stouputils/data_science/data_processing/image/shearing.py +64 -64
- stouputils/data_science/data_processing/image/threshold.py +64 -64
- stouputils/data_science/data_processing/image/translation.py +71 -71
- stouputils/data_science/data_processing/image/zoom.py +83 -83
- stouputils/data_science/data_processing/image_augmentation.py +118 -118
- stouputils/data_science/data_processing/image_preprocess.py +183 -183
- stouputils/data_science/data_processing/prosthesis_detection.py +359 -359
- stouputils/data_science/data_processing/technique.py +481 -481
- stouputils/data_science/dataset/__init__.py +45 -45
- stouputils/data_science/dataset/dataset.py +292 -292
- stouputils/data_science/dataset/dataset_loader.py +135 -135
- stouputils/data_science/dataset/grouping_strategy.py +296 -296
- stouputils/data_science/dataset/image_loader.py +100 -100
- stouputils/data_science/dataset/xy_tuple.py +696 -696
- stouputils/data_science/metric_dictionnary.py +106 -106
- stouputils/data_science/mlflow_utils.py +206 -206
- stouputils/data_science/models/abstract_model.py +149 -149
- stouputils/data_science/models/all.py +85 -85
- stouputils/data_science/models/keras/all.py +38 -38
- stouputils/data_science/models/keras/convnext.py +62 -62
- stouputils/data_science/models/keras/densenet.py +50 -50
- stouputils/data_science/models/keras/efficientnet.py +60 -60
- stouputils/data_science/models/keras/mobilenet.py +56 -56
- stouputils/data_science/models/keras/resnet.py +52 -52
- stouputils/data_science/models/keras/squeezenet.py +233 -233
- stouputils/data_science/models/keras/vgg.py +42 -42
- stouputils/data_science/models/keras/xception.py +38 -38
- stouputils/data_science/models/keras_utils/callbacks/__init__.py +20 -20
- stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py +219 -219
- stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py +148 -148
- stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +31 -31
- stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py +249 -249
- stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py +66 -66
- stouputils/data_science/models/keras_utils/losses/__init__.py +12 -12
- stouputils/data_science/models/keras_utils/losses/next_generation_loss.py +56 -56
- stouputils/data_science/models/keras_utils/visualizations.py +416 -416
- stouputils/data_science/models/sandbox.py +116 -116
- stouputils/data_science/range_tuple.py +234 -234
- stouputils/data_science/utils.py +285 -285
- stouputils/decorators.py +53 -39
- stouputils/decorators.pyi +12 -2
- stouputils/installer/__init__.py +18 -18
- stouputils/installer/linux.py +144 -144
- stouputils/installer/main.py +223 -223
- stouputils/installer/windows.py +136 -136
- stouputils/io.py +16 -9
- stouputils/parallel.pyi +12 -7
- stouputils/print.py +229 -2
- stouputils/print.pyi +92 -3
- stouputils/py.typed +1 -1
- {stouputils-1.14.2.dist-info → stouputils-1.15.0.dist-info}/METADATA +1 -1
- stouputils-1.15.0.dist-info/RECORD +140 -0
- {stouputils-1.14.2.dist-info → stouputils-1.15.0.dist-info}/WHEEL +1 -1
- stouputils/stouputils/__init__.pyi +0 -15
- stouputils/stouputils/_deprecated.pyi +0 -12
- stouputils/stouputils/all_doctests.pyi +0 -46
- stouputils/stouputils/applications/__init__.pyi +0 -2
- stouputils/stouputils/applications/automatic_docs.pyi +0 -106
- stouputils/stouputils/applications/upscaler/__init__.pyi +0 -3
- stouputils/stouputils/applications/upscaler/config.pyi +0 -18
- stouputils/stouputils/applications/upscaler/image.pyi +0 -109
- stouputils/stouputils/applications/upscaler/video.pyi +0 -60
- stouputils/stouputils/archive.pyi +0 -67
- stouputils/stouputils/backup.pyi +0 -109
- stouputils/stouputils/collections.pyi +0 -86
- stouputils/stouputils/continuous_delivery/__init__.pyi +0 -5
- stouputils/stouputils/continuous_delivery/cd_utils.pyi +0 -129
- stouputils/stouputils/continuous_delivery/github.pyi +0 -162
- stouputils/stouputils/continuous_delivery/pypi.pyi +0 -53
- stouputils/stouputils/continuous_delivery/pyproject.pyi +0 -67
- stouputils/stouputils/continuous_delivery/stubs.pyi +0 -39
- stouputils/stouputils/ctx.pyi +0 -211
- stouputils/stouputils/decorators.pyi +0 -252
- stouputils/stouputils/image.pyi +0 -172
- stouputils/stouputils/installer/__init__.pyi +0 -5
- stouputils/stouputils/installer/common.pyi +0 -39
- stouputils/stouputils/installer/downloader.pyi +0 -24
- stouputils/stouputils/installer/linux.pyi +0 -39
- stouputils/stouputils/installer/main.pyi +0 -57
- stouputils/stouputils/installer/windows.pyi +0 -31
- stouputils/stouputils/io.pyi +0 -213
- stouputils/stouputils/parallel.pyi +0 -216
- stouputils/stouputils/print.pyi +0 -136
- stouputils/stouputils/version_pkg.pyi +0 -15
- stouputils-1.14.2.dist-info/RECORD +0 -171
- {stouputils-1.14.2.dist-info → stouputils-1.15.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
# pyright: reportUnknownMemberType=false
|
|
3
|
-
# pyright: reportUnknownArgumentType=false
|
|
4
|
-
# pyright: reportUnknownVariableType=false
|
|
5
|
-
# pyright: reportUnusedImport=false
|
|
6
|
-
# ruff: noqa: F401
|
|
7
|
-
|
|
8
|
-
# Imports
|
|
9
|
-
import SimpleITK as Sitk
|
|
10
|
-
|
|
11
|
-
from .common import Any, NDArray, check_image, np
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# Functions
|
|
15
|
-
def curvature_flow_filter_image(
|
|
16
|
-
image: NDArray[Any],
|
|
17
|
-
time_step: float = 0.05,
|
|
18
|
-
number_of_iterations: int = 5,
|
|
19
|
-
ignore_dtype: bool = False,
|
|
20
|
-
) -> NDArray[Any]:
|
|
21
|
-
""" Apply a curvature flow filter to an image.
|
|
22
|
-
|
|
23
|
-
Args:
|
|
24
|
-
image (NDArray[Any]): Image to apply the curvature flow filter
|
|
25
|
-
time_step (float): Time step for the curvature flow filter
|
|
26
|
-
number_of_iterations (int): Number of iterations for the curvature flow filter
|
|
27
|
-
ignore_dtype (bool): Ignore the dtype check
|
|
28
|
-
Returns:
|
|
29
|
-
NDArray[Any]: Image with the curvature flow filter applied
|
|
30
|
-
|
|
31
|
-
>>> ## Basic tests
|
|
32
|
-
>>> image = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.uint8)
|
|
33
|
-
>>> filtered = curvature_flow_filter_image(image, 0.05, 5)
|
|
34
|
-
>>> filtered.tolist()[0][0]
|
|
35
|
-
1.2910538407309702
|
|
36
|
-
>>> filtered.shape == image.shape
|
|
37
|
-
True
|
|
38
|
-
>>> filtered.dtype == image.dtype
|
|
39
|
-
False
|
|
40
|
-
|
|
41
|
-
>>> rgb = np.full((3,3,3), 128, dtype=np.uint8)
|
|
42
|
-
>>> rgb[1,1] = [50, 100, 150]
|
|
43
|
-
>>> filtered_rgb = curvature_flow_filter_image(rgb, 0.05, 5)
|
|
44
|
-
>>> filtered_rgb.shape == (3,3,3)
|
|
45
|
-
True
|
|
46
|
-
|
|
47
|
-
>>> ## Test invalid inputs
|
|
48
|
-
>>> curvature_flow_filter_image("not an image")
|
|
49
|
-
Traceback (most recent call last):
|
|
50
|
-
...
|
|
51
|
-
AssertionError: Image must be a numpy array
|
|
52
|
-
|
|
53
|
-
>>> curvature_flow_filter_image(image, time_step="not a float")
|
|
54
|
-
Traceback (most recent call last):
|
|
55
|
-
...
|
|
56
|
-
AssertionError: time_step must be a float
|
|
57
|
-
|
|
58
|
-
>>> curvature_flow_filter_image(image, number_of_iterations="not an integer")
|
|
59
|
-
Traceback (most recent call last):
|
|
60
|
-
...
|
|
61
|
-
AssertionError: number_of_iterations must be an integer
|
|
62
|
-
"""
|
|
63
|
-
# Check input data
|
|
64
|
-
check_image(image, ignore_dtype=ignore_dtype)
|
|
65
|
-
assert isinstance(time_step, float), "time_step must be a float"
|
|
66
|
-
assert isinstance(number_of_iterations, int), "number_of_iterations must be an integer"
|
|
67
|
-
assert time_step > 0, "time_step must be greater than 0"
|
|
68
|
-
assert number_of_iterations > 0, "number_of_iterations must be greater than 0"
|
|
69
|
-
|
|
70
|
-
# Apply the curvature flow filter
|
|
71
|
-
image_Sitk: Sitk.Image = Sitk.GetImageFromArray(image)
|
|
72
|
-
image_Sitk = Sitk.CurvatureFlow(image_Sitk, timeStep=time_step, numberOfIterations=number_of_iterations)
|
|
73
|
-
return Sitk.GetArrayFromImage(image_Sitk)
|
|
74
|
-
|
|
1
|
+
|
|
2
|
+
# pyright: reportUnknownMemberType=false
|
|
3
|
+
# pyright: reportUnknownArgumentType=false
|
|
4
|
+
# pyright: reportUnknownVariableType=false
|
|
5
|
+
# pyright: reportUnusedImport=false
|
|
6
|
+
# ruff: noqa: F401
|
|
7
|
+
|
|
8
|
+
# Imports
|
|
9
|
+
import SimpleITK as Sitk
|
|
10
|
+
|
|
11
|
+
from .common import Any, NDArray, check_image, np
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Functions
|
|
15
|
+
def curvature_flow_filter_image(
|
|
16
|
+
image: NDArray[Any],
|
|
17
|
+
time_step: float = 0.05,
|
|
18
|
+
number_of_iterations: int = 5,
|
|
19
|
+
ignore_dtype: bool = False,
|
|
20
|
+
) -> NDArray[Any]:
|
|
21
|
+
""" Apply a curvature flow filter to an image.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
image (NDArray[Any]): Image to apply the curvature flow filter
|
|
25
|
+
time_step (float): Time step for the curvature flow filter
|
|
26
|
+
number_of_iterations (int): Number of iterations for the curvature flow filter
|
|
27
|
+
ignore_dtype (bool): Ignore the dtype check
|
|
28
|
+
Returns:
|
|
29
|
+
NDArray[Any]: Image with the curvature flow filter applied
|
|
30
|
+
|
|
31
|
+
>>> ## Basic tests
|
|
32
|
+
>>> image = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.uint8)
|
|
33
|
+
>>> filtered = curvature_flow_filter_image(image, 0.05, 5)
|
|
34
|
+
>>> filtered.tolist()[0][0]
|
|
35
|
+
1.2910538407309702
|
|
36
|
+
>>> filtered.shape == image.shape
|
|
37
|
+
True
|
|
38
|
+
>>> filtered.dtype == image.dtype
|
|
39
|
+
False
|
|
40
|
+
|
|
41
|
+
>>> rgb = np.full((3,3,3), 128, dtype=np.uint8)
|
|
42
|
+
>>> rgb[1,1] = [50, 100, 150]
|
|
43
|
+
>>> filtered_rgb = curvature_flow_filter_image(rgb, 0.05, 5)
|
|
44
|
+
>>> filtered_rgb.shape == (3,3,3)
|
|
45
|
+
True
|
|
46
|
+
|
|
47
|
+
>>> ## Test invalid inputs
|
|
48
|
+
>>> curvature_flow_filter_image("not an image")
|
|
49
|
+
Traceback (most recent call last):
|
|
50
|
+
...
|
|
51
|
+
AssertionError: Image must be a numpy array
|
|
52
|
+
|
|
53
|
+
>>> curvature_flow_filter_image(image, time_step="not a float")
|
|
54
|
+
Traceback (most recent call last):
|
|
55
|
+
...
|
|
56
|
+
AssertionError: time_step must be a float
|
|
57
|
+
|
|
58
|
+
>>> curvature_flow_filter_image(image, number_of_iterations="not an integer")
|
|
59
|
+
Traceback (most recent call last):
|
|
60
|
+
...
|
|
61
|
+
AssertionError: number_of_iterations must be an integer
|
|
62
|
+
"""
|
|
63
|
+
# Check input data
|
|
64
|
+
check_image(image, ignore_dtype=ignore_dtype)
|
|
65
|
+
assert isinstance(time_step, float), "time_step must be a float"
|
|
66
|
+
assert isinstance(number_of_iterations, int), "number_of_iterations must be an integer"
|
|
67
|
+
assert time_step > 0, "time_step must be greater than 0"
|
|
68
|
+
assert number_of_iterations > 0, "number_of_iterations must be greater than 0"
|
|
69
|
+
|
|
70
|
+
# Apply the curvature flow filter
|
|
71
|
+
image_Sitk: Sitk.Image = Sitk.GetImageFromArray(image)
|
|
72
|
+
image_Sitk = Sitk.CurvatureFlow(image_Sitk, timeStep=time_step, numberOfIterations=number_of_iterations)
|
|
73
|
+
return Sitk.GetArrayFromImage(image_Sitk)
|
|
74
|
+
|