ritk-python 0.12.79__cp39-abi3-win_amd64.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.
- ritk/__init__.py +100 -0
- ritk/__init__.pyi +18 -0
- ritk/_ritk/__init__.pyi +10 -0
- ritk/_ritk/connectome.pyi +90 -0
- ritk/_ritk/diffusion.pyi +72 -0
- ritk/_ritk/filter.pyi +1207 -0
- ritk/_ritk/image.pyi +36 -0
- ritk/_ritk/io.pyi +34 -0
- ritk/_ritk/registration.pyi +172 -0
- ritk/_ritk/segmentation.pyi +321 -0
- ritk/_ritk/statistics.pyi +169 -0
- ritk/_ritk.pyd +4 -0
- ritk/py.typed +1 -0
- ritk_python-0.12.79.dist-info/METADATA +168 -0
- ritk_python-0.12.79.dist-info/RECORD +17 -0
- ritk_python-0.12.79.dist-info/WHEEL +4 -0
- ritk_python-0.12.79.dist-info/sboms/ritk-python.cyclonedx.json +14012 -0
ritk/_ritk/image.pyi
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Type stub for the ``_ritk.image`` submodule (PyO3/maturin)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from numpy.typing import NDArray
|
|
7
|
+
|
|
8
|
+
class Image:
|
|
9
|
+
"""Medical image with physical-space metadata (Z×Y×X, f32)."""
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
array: NDArray[np.float32],
|
|
14
|
+
spacing: tuple[float, float, float] | None = None,
|
|
15
|
+
origin: tuple[float, float, float] | None = None,
|
|
16
|
+
) -> None: ...
|
|
17
|
+
def to_numpy(self) -> NDArray[np.float32]: ...
|
|
18
|
+
@property
|
|
19
|
+
def shape(self) -> tuple[int, int, int]: ...
|
|
20
|
+
@property
|
|
21
|
+
def spacing(self) -> tuple[float, float, float]: ...
|
|
22
|
+
@property
|
|
23
|
+
def origin(self) -> tuple[float, float, float]: ...
|
|
24
|
+
|
|
25
|
+
class ColorImage:
|
|
26
|
+
"""RGB/vector multi-component image, channel-interleaved as [Z, Y, X, 3]."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
array: NDArray[np.float32],
|
|
31
|
+
spacing: tuple[float, float, float] | None = None,
|
|
32
|
+
origin: tuple[float, float, float] | None = None,
|
|
33
|
+
) -> None: ...
|
|
34
|
+
def to_numpy(self) -> NDArray[np.float32]: ...
|
|
35
|
+
@property
|
|
36
|
+
def shape(self) -> tuple[int, int, int, int]: ...
|
ritk/_ritk/io.pyi
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Type stubs for the ``_ritk.io`` submodule (image and transform I/O)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from ritk._ritk.image import Image
|
|
8
|
+
|
|
9
|
+
def read_image(path: str, series_instance_uid: str | None = None) -> Image: ...
|
|
10
|
+
def write_image(image: Image, path: str) -> None: ...
|
|
11
|
+
def read_transform(path: str) -> dict[str, Any]: ...
|
|
12
|
+
def write_transform(
|
|
13
|
+
path: str,
|
|
14
|
+
dimensionality: int,
|
|
15
|
+
transforms: list[dict[str, Any]],
|
|
16
|
+
description: str = "",
|
|
17
|
+
) -> None: ...
|
|
18
|
+
|
|
19
|
+
# -- DICOM anonymization ------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
def anonymize_dicom_dir(
|
|
22
|
+
input_dir: str,
|
|
23
|
+
output_dir: str,
|
|
24
|
+
profile: str = "basic",
|
|
25
|
+
patient_name: str = "ANONYMOUS",
|
|
26
|
+
patient_id: str = "ANON001",
|
|
27
|
+
uid_salt: str = "ritk-anon-salt",
|
|
28
|
+
cleaning: Any | None = None,
|
|
29
|
+
) -> int: ...
|
|
30
|
+
|
|
31
|
+
# -- Polygonal mesh I/O -------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
def read_mesh(path: str) -> Any: ...
|
|
34
|
+
def write_mesh(path: str, mesh: Any) -> None: ...
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""Type stubs for the ``_ritk.registration`` submodule (PyO3/maturin).
|
|
2
|
+
|
|
3
|
+
All signatures derived from ``ritk-python/src/registration/``.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from ritk._ritk.connectome import Parcellation
|
|
11
|
+
from ritk._ritk.image import Image
|
|
12
|
+
|
|
13
|
+
class GlobalMiOptions:
|
|
14
|
+
transform_type: str
|
|
15
|
+
num_mi_bins: int
|
|
16
|
+
maximum_iterations: int
|
|
17
|
+
tolerance: float
|
|
18
|
+
step_multiplier: float
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
transform_type: str = "rigid",
|
|
22
|
+
num_mi_bins: int = 32,
|
|
23
|
+
maximum_iterations: int = 100,
|
|
24
|
+
tolerance: float = 1e-6,
|
|
25
|
+
step_multiplier: float = 1.0,
|
|
26
|
+
) -> None: ...
|
|
27
|
+
|
|
28
|
+
def demons_register(
|
|
29
|
+
fixed: Image,
|
|
30
|
+
moving: Image,
|
|
31
|
+
max_iterations: int = 50,
|
|
32
|
+
sigma_diffusion: float = 1.0,
|
|
33
|
+
) -> tuple[Image, Image]: ...
|
|
34
|
+
def diffeomorphic_demons_register(
|
|
35
|
+
fixed: Image,
|
|
36
|
+
moving: Image,
|
|
37
|
+
max_iterations: int = 50,
|
|
38
|
+
sigma_diffusion: float = 1.5,
|
|
39
|
+
n_squarings: int = 6,
|
|
40
|
+
) -> tuple[Image, Image]: ...
|
|
41
|
+
def symmetric_demons_register(
|
|
42
|
+
fixed: Image,
|
|
43
|
+
moving: Image,
|
|
44
|
+
max_iterations: int = 50,
|
|
45
|
+
sigma_diffusion: float = 1.5,
|
|
46
|
+
) -> tuple[Image, Image]: ...
|
|
47
|
+
def inverse_consistent_demons_register(
|
|
48
|
+
fixed: Image,
|
|
49
|
+
moving: Image,
|
|
50
|
+
max_iterations: int = 50,
|
|
51
|
+
sigma_diffusion: float = 1.5,
|
|
52
|
+
inverse_consistency_weight: float = 0.5,
|
|
53
|
+
n_squarings: int = 6,
|
|
54
|
+
) -> tuple[Image, Image]: ...
|
|
55
|
+
def multires_demons_register(
|
|
56
|
+
fixed: Image,
|
|
57
|
+
moving: Image,
|
|
58
|
+
max_iterations: int = 50,
|
|
59
|
+
sigma_diffusion: float = 1.0,
|
|
60
|
+
levels: int = 3,
|
|
61
|
+
variant: str = "thirion",
|
|
62
|
+
n_squarings: int = 6,
|
|
63
|
+
) -> tuple[Image, Image]: ...
|
|
64
|
+
def level_set_motion_register(
|
|
65
|
+
fixed: Image,
|
|
66
|
+
moving: Image,
|
|
67
|
+
number_of_iterations: int = 20,
|
|
68
|
+
smoothing_sigma: float = 1.0,
|
|
69
|
+
intensity_difference_threshold: float = 0.001,
|
|
70
|
+
) -> tuple[Image, Image]:
|
|
71
|
+
"""Level-set motion registration (Thirion demons variant with fixed-image gradient).
|
|
72
|
+
ITK Parity: LevelSetMotionRegistrationFilter."""
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
def syn_register(
|
|
76
|
+
fixed: Image,
|
|
77
|
+
moving: Image,
|
|
78
|
+
max_iterations: int = 100,
|
|
79
|
+
sigma_smooth: float = 3.0,
|
|
80
|
+
cc_radius: int = 2,
|
|
81
|
+
gradient_step: float = 0.25,
|
|
82
|
+
convergence_threshold: float = 1e-8,
|
|
83
|
+
) -> tuple[Image, Image]: ...
|
|
84
|
+
def bspline_ffd_register(
|
|
85
|
+
fixed: Image,
|
|
86
|
+
moving: Image,
|
|
87
|
+
initial_control_spacing: int = 8,
|
|
88
|
+
num_levels: int = 3,
|
|
89
|
+
max_iterations: int = 100,
|
|
90
|
+
learning_rate: float = 0.01,
|
|
91
|
+
regularization_weight: float = 0.001,
|
|
92
|
+
) -> Image: ...
|
|
93
|
+
def multires_syn_register(
|
|
94
|
+
fixed: Image,
|
|
95
|
+
moving: Image,
|
|
96
|
+
num_levels: int = 3,
|
|
97
|
+
iterations: list[int] | None = None,
|
|
98
|
+
sigma_smooth: float = 3.0,
|
|
99
|
+
cc_radius: int = 2,
|
|
100
|
+
inverse_consistency: bool = True,
|
|
101
|
+
gradient_step: float = 0.25,
|
|
102
|
+
convergence_threshold: float = 1e-8,
|
|
103
|
+
) -> tuple[Image, Image]: ...
|
|
104
|
+
def bspline_syn_register(
|
|
105
|
+
fixed: Image,
|
|
106
|
+
moving: Image,
|
|
107
|
+
max_iterations: int = 100,
|
|
108
|
+
control_spacing_z: int = 8,
|
|
109
|
+
control_spacing_y: int = 8,
|
|
110
|
+
control_spacing_x: int = 8,
|
|
111
|
+
sigma_smooth: float = 1.0,
|
|
112
|
+
cc_radius: int = 2,
|
|
113
|
+
regularization_weight: float = 0.001,
|
|
114
|
+
gradient_step: float = 0.25,
|
|
115
|
+
) -> tuple[Image, Image]: ...
|
|
116
|
+
def lddmm_register(
|
|
117
|
+
fixed: Image,
|
|
118
|
+
moving: Image,
|
|
119
|
+
max_iterations: int = 50,
|
|
120
|
+
num_time_steps: int = 10,
|
|
121
|
+
kernel_sigma: float = 2.0,
|
|
122
|
+
learning_rate: float = 0.1,
|
|
123
|
+
regularization_weight: float = 1.0,
|
|
124
|
+
) -> tuple[Image, Image]: ...
|
|
125
|
+
def build_atlas(
|
|
126
|
+
subjects: list[Image],
|
|
127
|
+
max_iterations: int = 5,
|
|
128
|
+
convergence_threshold: float = 0.01,
|
|
129
|
+
syn_iterations: list[int] | None = None,
|
|
130
|
+
sigma_smooth: float = 3.0,
|
|
131
|
+
cc_radius: int = 2,
|
|
132
|
+
gradient_step: float = 0.25,
|
|
133
|
+
) -> tuple[Image, list[float]]: ...
|
|
134
|
+
def majority_vote_fusion(
|
|
135
|
+
atlas_labels: list[Image],
|
|
136
|
+
) -> tuple[Image, Image]: ...
|
|
137
|
+
def joint_label_fusion_py(
|
|
138
|
+
target: Image,
|
|
139
|
+
atlas_images: list[Image],
|
|
140
|
+
atlas_labels: list[Image],
|
|
141
|
+
patch_radius: int = 2,
|
|
142
|
+
beta: float = 0.1,
|
|
143
|
+
) -> tuple[Image, Image]: ...
|
|
144
|
+
|
|
145
|
+
# -- Atlas-driven subject parcellation -----------------------------------------
|
|
146
|
+
|
|
147
|
+
class AtlasParcellationResult:
|
|
148
|
+
@property
|
|
149
|
+
def parcellation(self) -> Parcellation: ...
|
|
150
|
+
@property
|
|
151
|
+
def agreement(self) -> Any: ...
|
|
152
|
+
@property
|
|
153
|
+
def registration_quality(self) -> list[float]: ...
|
|
154
|
+
|
|
155
|
+
def parcellate_with_atlases(
|
|
156
|
+
subject: Image,
|
|
157
|
+
atlas_intensities: list[Image],
|
|
158
|
+
atlas_labels: list[Image],
|
|
159
|
+
fusion: str = "majority",
|
|
160
|
+
iterations: list[int] | None = None,
|
|
161
|
+
patch_radius: int = 2,
|
|
162
|
+
beta: float = 0.1,
|
|
163
|
+
region_names: list[tuple[int, str]] | None = None,
|
|
164
|
+
) -> AtlasParcellationResult: ...
|
|
165
|
+
|
|
166
|
+
# -- Global affine/rigid Mutual Information registration -----------------------
|
|
167
|
+
|
|
168
|
+
def global_mi_register(
|
|
169
|
+
fixed: Image,
|
|
170
|
+
moving: Image,
|
|
171
|
+
opts: GlobalMiOptions | None = None,
|
|
172
|
+
) -> tuple[list[float], float, dict[str, Any]]: ...
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"""Type stubs for the ``_ritk.segmentation`` submodule (PyO3/maturin).
|
|
2
|
+
|
|
3
|
+
All signatures are derived from the authoritative Rust source at
|
|
4
|
+
``ritk-python/src/segmentation.rs``.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from ritk._ritk.image import Image
|
|
12
|
+
|
|
13
|
+
# ── Thresholding ────────────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
def otsu_threshold(image: Image) -> tuple[float, Image]: ...
|
|
16
|
+
def li_threshold(image: Image) -> tuple[float, Image]: ...
|
|
17
|
+
def yen_threshold(image: Image) -> tuple[float, Image]: ...
|
|
18
|
+
def kapur_threshold(image: Image) -> tuple[float, Image]: ...
|
|
19
|
+
def triangle_threshold(image: Image) -> tuple[float, Image]: ...
|
|
20
|
+
def huang_threshold(image: Image) -> tuple[float, Image]: ...
|
|
21
|
+
def intermodes_threshold(image: Image) -> tuple[float, Image]: ...
|
|
22
|
+
def isodata_threshold(image: Image) -> tuple[float, Image]: ...
|
|
23
|
+
def kittler_illingworth_threshold(image: Image) -> tuple[float, Image]: ...
|
|
24
|
+
def moments_threshold(image: Image) -> tuple[float, Image]: ...
|
|
25
|
+
def renyi_entropy_threshold(image: Image) -> tuple[float, Image]: ...
|
|
26
|
+
def shanbhag_threshold(image: Image) -> tuple[float, Image]: ...
|
|
27
|
+
def multi_otsu_threshold(
|
|
28
|
+
image: Image, num_classes: int = 3
|
|
29
|
+
) -> tuple[list[float], Image]: ...
|
|
30
|
+
def binary_threshold_segment(
|
|
31
|
+
image: Image,
|
|
32
|
+
lower: float | None = None,
|
|
33
|
+
upper: float | None = None,
|
|
34
|
+
inside_value: float = 1.0,
|
|
35
|
+
outside_value: float = 0.0,
|
|
36
|
+
) -> Image: ...
|
|
37
|
+
|
|
38
|
+
# ── Connected-component labeling ────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
def connected_components(mask: Image, connectivity: int = 6) -> tuple[Image, int]: ...
|
|
41
|
+
def scalar_connected_component(
|
|
42
|
+
image: Image, distance_threshold: float = 0.0, connectivity: int = 6
|
|
43
|
+
) -> Image:
|
|
44
|
+
"""Label scalar connected components (neighbours join if |delta value| <= threshold). ITK Parity: ScalarConnectedComponentImageFilter."""
|
|
45
|
+
...
|
|
46
|
+
|
|
47
|
+
def relabel_components(label_image: Image, minimum_object_size: int = 0) -> Image:
|
|
48
|
+
"""Relabel components by descending size. ITK Parity: RelabelComponentImageFilter."""
|
|
49
|
+
...
|
|
50
|
+
|
|
51
|
+
def relabel_label_map(label_image: Image) -> Image:
|
|
52
|
+
"""Relabel non-zero labels to consecutive 1..K in ascending original-label order. ITK Parity: RelabelLabelMapFilter (sitk.RelabelLabelMap)."""
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
def merge_label_map(label_images: list[Image], method: int = 0) -> Image:
|
|
56
|
+
"""Merge label images (0=Keep,1=Aggregate,2=Pack,3=Strict). ITK Parity: MergeLabelMapFilter (sitk.MergeLabelMap)."""
|
|
57
|
+
...
|
|
58
|
+
|
|
59
|
+
def label_set_dilate(
|
|
60
|
+
label_image: Image, radius: list[float] = ..., use_image_spacing: bool = True
|
|
61
|
+
) -> Image:
|
|
62
|
+
"""Label-preserving Euclidean dilation. ITK Parity: LabelSetDilateImageFilter (sitk.LabelSetDilate)."""
|
|
63
|
+
...
|
|
64
|
+
|
|
65
|
+
def label_set_erode(
|
|
66
|
+
label_image: Image, radius: list[float] = ..., use_image_spacing: bool = True
|
|
67
|
+
) -> Image:
|
|
68
|
+
"""Label-preserving Euclidean erosion. ITK Parity: LabelSetErodeImageFilter (sitk.LabelSetErode)."""
|
|
69
|
+
...
|
|
70
|
+
|
|
71
|
+
def change_label(label_image: Image, change_map: dict[int, int]) -> Image:
|
|
72
|
+
"""Remap label values per {old: new}; others unchanged. ITK Parity: ChangeLabelImageFilter."""
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
def threshold_maximum_connected_components(
|
|
76
|
+
image: Image, minimum_object_size: int = 0, upper_boundary: int | None = None
|
|
77
|
+
) -> Image:
|
|
78
|
+
"""Threshold an image at the lower value that maximizes the number of connected components. ITK Parity: ThresholdMaximumConnectedComponentsImageFilter."""
|
|
79
|
+
...
|
|
80
|
+
|
|
81
|
+
# ── Region growing ──────────────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
def connected_threshold_segment(
|
|
84
|
+
image: Image,
|
|
85
|
+
seed: tuple[int, int, int],
|
|
86
|
+
lower: float,
|
|
87
|
+
upper: float,
|
|
88
|
+
) -> Image: ...
|
|
89
|
+
|
|
90
|
+
# ── Clustering ──────────────────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
def kmeans_segment(
|
|
93
|
+
image: Image,
|
|
94
|
+
k: int = 3,
|
|
95
|
+
max_iterations: int | None = None,
|
|
96
|
+
tolerance: float | None = None,
|
|
97
|
+
seed: int | None = None,
|
|
98
|
+
) -> Image: ...
|
|
99
|
+
|
|
100
|
+
# ── Watershed ────────────────────────────────────────────────────
|
|
101
|
+
|
|
102
|
+
def watershed_segment(image: Image) -> Image: ...
|
|
103
|
+
def marker_watershed_segment(gradient: Image, markers: Image) -> Image: ...
|
|
104
|
+
def morphological_watershed(image: Image, level: float = 0.0) -> Image:
|
|
105
|
+
"""Marker-less morphological watershed. ITK Parity: MorphologicalWatershedImageFilter."""
|
|
106
|
+
...
|
|
107
|
+
|
|
108
|
+
def isolated_watershed_segment(
|
|
109
|
+
image: Image,
|
|
110
|
+
seed1: list[int],
|
|
111
|
+
seed2: list[int],
|
|
112
|
+
threshold: float = 0.0,
|
|
113
|
+
isolated_value_tolerance: float = 0.001,
|
|
114
|
+
upper_value_limit: float = 1.0,
|
|
115
|
+
) -> Image:
|
|
116
|
+
"""Isolated watershed: finds T* separating two seeds. Labels 1, 2, 3.
|
|
117
|
+
ITK Parity: IsolatedWatershedImageFilter."""
|
|
118
|
+
...
|
|
119
|
+
|
|
120
|
+
def toboggan(image: Image) -> Image:
|
|
121
|
+
"""Toboggan steepest-descent basin labeling (labels >= 2). ITK Parity: TobogganImageFilter (sitk.Toboggan)."""
|
|
122
|
+
...
|
|
123
|
+
|
|
124
|
+
def slic(
|
|
125
|
+
image: Image,
|
|
126
|
+
super_grid_size: int,
|
|
127
|
+
spatial_proximity_weight: float = 10.0,
|
|
128
|
+
maximum_number_of_iterations: int = 5,
|
|
129
|
+
enforce_connectivity: bool = True,
|
|
130
|
+
initialization_perturbation: bool = True,
|
|
131
|
+
) -> Image:
|
|
132
|
+
"""SLIC super-pixel segmentation. ITK Parity: SLICImageFilter (sitk.SLIC); label-exact at the default config (z==1 treated as 2-D)."""
|
|
133
|
+
...
|
|
134
|
+
|
|
135
|
+
def vector_connected_component(
|
|
136
|
+
channels: list[Image],
|
|
137
|
+
distance_threshold: float = 1.0,
|
|
138
|
+
fully_connected: bool = False,
|
|
139
|
+
) -> Image:
|
|
140
|
+
"""Connected components of a vector image (join if 1-|a.b|<=threshold). ITK Parity: VectorConnectedComponentImageFilter (sitk.VectorConnectedComponent); partition-exact."""
|
|
141
|
+
...
|
|
142
|
+
|
|
143
|
+
def vector_confidence_connected_segment(
|
|
144
|
+
channels: list[Image],
|
|
145
|
+
seeds: list[tuple[int, int, int]],
|
|
146
|
+
multiplier: float = 2.5,
|
|
147
|
+
number_of_iterations: int = 4,
|
|
148
|
+
initial_neighborhood_radius: int = 1,
|
|
149
|
+
replace_value: float = 1.0,
|
|
150
|
+
) -> Image:
|
|
151
|
+
"""Vector confidence-connected region growing (Mahalanobis). ITK Parity: VectorConfidenceConnectedImageFilter (sitk.VectorConfidenceConnected); region-exact for well-conditioned inputs."""
|
|
152
|
+
...
|
|
153
|
+
|
|
154
|
+
# ── Binary morphology ──────────────────────────────────────────────────────
|
|
155
|
+
|
|
156
|
+
def binary_erosion(image: Image, radius: int = 1) -> Image: ...
|
|
157
|
+
def binary_dilation(image: Image, radius: int = 1) -> Image: ...
|
|
158
|
+
def binary_opening(image: Image, radius: int = 1) -> Image: ...
|
|
159
|
+
def binary_closing(image: Image, radius: int = 1) -> Image: ...
|
|
160
|
+
def binary_fill_holes(image: Image) -> Image: ...
|
|
161
|
+
def morphological_gradient(image: Image, radius: int = 1) -> Image: ...
|
|
162
|
+
|
|
163
|
+
# ── Level-set segmentation ──────────────────────────────────────────────────
|
|
164
|
+
|
|
165
|
+
def chan_vese_segment(
|
|
166
|
+
image: Image,
|
|
167
|
+
mu: float = 0.25,
|
|
168
|
+
nu: float = 0.0,
|
|
169
|
+
lambda1: float = 1.0,
|
|
170
|
+
lambda2: float = 1.0,
|
|
171
|
+
max_iterations: int = 200,
|
|
172
|
+
dt: float = 0.1,
|
|
173
|
+
tolerance: float = 1e-3,
|
|
174
|
+
) -> Image: ...
|
|
175
|
+
def slic_superpixel(
|
|
176
|
+
image: Image,
|
|
177
|
+
n_superpixels: int = 100,
|
|
178
|
+
compactness: float = 10.0,
|
|
179
|
+
max_iterations: int = 10,
|
|
180
|
+
tolerance: float = 1e-3,
|
|
181
|
+
min_component_size: int = 5,
|
|
182
|
+
) -> Image: ...
|
|
183
|
+
def geodesic_active_contour_segment(
|
|
184
|
+
image: Image,
|
|
185
|
+
initial_phi: Image,
|
|
186
|
+
propagation_weight: float = 1.0,
|
|
187
|
+
curvature_weight: float = 1.0,
|
|
188
|
+
advection_weight: float = 1.0,
|
|
189
|
+
edge_k: float = 1.0,
|
|
190
|
+
sigma: float = 1.0,
|
|
191
|
+
dt: float = 0.05,
|
|
192
|
+
max_iterations: int = 200,
|
|
193
|
+
) -> Image: ...
|
|
194
|
+
def shape_detection_segment(
|
|
195
|
+
image: Image,
|
|
196
|
+
initial_phi: Image,
|
|
197
|
+
opts: ShapeDetectionOptions | None = None,
|
|
198
|
+
) -> Image: ...
|
|
199
|
+
def threshold_level_set_segment(
|
|
200
|
+
image: Image,
|
|
201
|
+
initial_phi: Image,
|
|
202
|
+
lower_threshold: float,
|
|
203
|
+
upper_threshold: float,
|
|
204
|
+
propagation_weight: float = 1.0,
|
|
205
|
+
curvature_weight: float = 0.2,
|
|
206
|
+
dt: float = 0.05,
|
|
207
|
+
max_iterations: int = 200,
|
|
208
|
+
tolerance: float = 1e-3,
|
|
209
|
+
) -> Image: ...
|
|
210
|
+
def laplacian_level_set_segment(
|
|
211
|
+
image: Image,
|
|
212
|
+
initial_phi: Image,
|
|
213
|
+
propagation_weight: float = 1.0,
|
|
214
|
+
curvature_weight: float = 0.2,
|
|
215
|
+
sigma: float = 1.0,
|
|
216
|
+
dt: float = 0.05,
|
|
217
|
+
max_iterations: int = 200,
|
|
218
|
+
tolerance: float = 1e-3,
|
|
219
|
+
) -> Image: ...
|
|
220
|
+
|
|
221
|
+
# -- Advanced region growing / topology -----------------------------------
|
|
222
|
+
|
|
223
|
+
def confidence_connected_segment(
|
|
224
|
+
image: Image,
|
|
225
|
+
seed: list[int],
|
|
226
|
+
initial_lower: float,
|
|
227
|
+
initial_upper: float,
|
|
228
|
+
multiplier: float = 2.5,
|
|
229
|
+
max_iterations: int = 15,
|
|
230
|
+
) -> Image: ...
|
|
231
|
+
def neighborhood_connected_segment(
|
|
232
|
+
image: Image,
|
|
233
|
+
seed: list[int],
|
|
234
|
+
lower: float,
|
|
235
|
+
upper: float,
|
|
236
|
+
radius: int = 1,
|
|
237
|
+
) -> Image: ...
|
|
238
|
+
def isolated_connected_segment(
|
|
239
|
+
image: Image,
|
|
240
|
+
seed1: list[int],
|
|
241
|
+
seed2: list[int],
|
|
242
|
+
lower: float = 0.0,
|
|
243
|
+
upper: float = 1.0,
|
|
244
|
+
replace_value: float = 1.0,
|
|
245
|
+
isolated_value_tolerance: float = 1.0,
|
|
246
|
+
find_upper_threshold: bool = True,
|
|
247
|
+
) -> Image:
|
|
248
|
+
"""Isolated-connected segmentation. ITK Parity: IsolatedConnectedImageFilter."""
|
|
249
|
+
...
|
|
250
|
+
|
|
251
|
+
def skeletonization(image: Image) -> Image: ...
|
|
252
|
+
def label_shape_statistics(
|
|
253
|
+
mask: Image,
|
|
254
|
+
connectivity: int = 6,
|
|
255
|
+
) -> list[dict[str, object]]:
|
|
256
|
+
"""Per-label shape statistics for each connected component in a binary mask.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
mask: Binary mask image (foreground > 0.5).
|
|
260
|
+
connectivity: Adjacency model (6 or 26; default 6).
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
list of dicts, one per component, sorted by label ascending. Each dict has:
|
|
264
|
+
label (int), voxel_count (int),
|
|
265
|
+
centroid (list[float]: [z, y, x] in index coordinates),
|
|
266
|
+
bounding_box_min (list[int]: [z, y, x]),
|
|
267
|
+
bounding_box_max (list[int]: [z, y, x]).
|
|
268
|
+
|
|
269
|
+
Raises:
|
|
270
|
+
ValueError: if connectivity is not 6 or 26.
|
|
271
|
+
"""
|
|
272
|
+
...
|
|
273
|
+
|
|
274
|
+
# -- GrowCut / STAPLE ---------------------------------------------------------
|
|
275
|
+
|
|
276
|
+
def growcut_segment(image: Image, seeds: Image, max_iter: int = 200) -> Image: ...
|
|
277
|
+
def staple_ensemble(
|
|
278
|
+
raters: list[Image], max_iter: int = 100, tol: float = 1e-06
|
|
279
|
+
) -> dict[str, Any]: ...
|
|
280
|
+
def multi_label_staple(
|
|
281
|
+
raters: list[Image],
|
|
282
|
+
max_iter: int = 0,
|
|
283
|
+
termination_threshold: float = 1e-5,
|
|
284
|
+
label_for_undecided: float | None = None,
|
|
285
|
+
) -> Image:
|
|
286
|
+
"""Multi-label STAPLE EM consensus of K integer label maps.
|
|
287
|
+
|
|
288
|
+
Args:
|
|
289
|
+
raters: list of Image, each a label map (f32). All must
|
|
290
|
+
have the same shape.
|
|
291
|
+
max_iter: Maximum EM iterations; 0 iterates to convergence.
|
|
292
|
+
termination_threshold: Stop when max confusion-matrix change < threshold.
|
|
293
|
+
label_for_undecided: Label for tie voxels; None uses L (max_label+1,
|
|
294
|
+
ITK default).
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
Hard consensus label image (f32), same shape/spacing/origin as raters[0].
|
|
298
|
+
|
|
299
|
+
ITK Parity: MultiLabelSTAPLEImageFilter.
|
|
300
|
+
"""
|
|
301
|
+
...
|
|
302
|
+
|
|
303
|
+
def label_set_dilate(
|
|
304
|
+
label_image: Image,
|
|
305
|
+
radius: list[float] = [1.0, 1.0, 1.0],
|
|
306
|
+
use_image_spacing: bool = True,
|
|
307
|
+
) -> Image:
|
|
308
|
+
"""Label-preserving Euclidean dilation, matching sitk.LabelSetDilate.
|
|
309
|
+
Expands every label region by a per-axis Euclidean structuring element.
|
|
310
|
+
ITK Parity: LabelSetDilateImageFilter."""
|
|
311
|
+
...
|
|
312
|
+
|
|
313
|
+
def label_set_erode(
|
|
314
|
+
label_image: Image,
|
|
315
|
+
radius: list[float] = [1.0, 1.0, 1.0],
|
|
316
|
+
use_image_spacing: bool = True,
|
|
317
|
+
) -> Image:
|
|
318
|
+
"""Label-preserving Euclidean erosion, matching sitk.LabelSetErode.
|
|
319
|
+
Shrinks every label region by a per-axis Euclidean structuring element.
|
|
320
|
+
ITK Parity: LabelSetErodeImageFilter."""
|
|
321
|
+
...
|