mlx-segment-ct 0.3.1__tar.gz → 0.3.2__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.
Potentially problematic release.
This version of mlx-segment-ct might be problematic. Click here for more details.
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/PKG-INFO +5 -2
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/README.md +4 -1
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/pyproject.toml +1 -1
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/__init__.py +1 -1
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/_types.py +3 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/bundle_transforms.py +13 -3
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/medmlx.py +3 -2
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/.gitignore +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/LICENSE +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/THIRD_PARTY_NOTICES.md +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/activations.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/correction.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/correction_inferer.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/instance_norm.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/interactive.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/labels.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/mlx_network.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/mlx_point.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/mlx_point_window.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/mlx_upsample.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/mlx_worker.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/projections.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/py.typed +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/restoration.py +0 -0
- {mlx_segment_ct-0.3.1 → mlx_segment_ct-0.3.2}/src/mlx_segment_ct/streaming.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: mlx-segment-ct
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Native MLX implementation of NV-Segment-CT (VISTA-3D)
|
|
5
5
|
Project-URL: Homepage, https://huggingface.co/MedMLX/vista3d-ct-mlx
|
|
6
6
|
Author: Joseph Sandoval, Alfredo Sandoval Jr.
|
|
@@ -40,9 +40,12 @@ Segment CT anatomy automatically or with anatomy names and clicks, using NVIDIA
|
|
|
40
40
|
## Quick start
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
uv pip install "mlx-segment-ct>=0.3.
|
|
43
|
+
uv pip install "mlx-segment-ct>=0.3.2"
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
NIfTI files explicitly marked in meters or microns are rejected. Inputs with
|
|
47
|
+
unknown spatial units are assumed to use millimeters.
|
|
48
|
+
|
|
46
49
|
The click coordinates below are examples: replace them with voxels inside your
|
|
47
50
|
image and its preprocessed foreground crop. `1` includes a point; `0` excludes it.
|
|
48
51
|
|
|
@@ -13,9 +13,12 @@ Segment CT anatomy automatically or with anatomy names and clicks, using NVIDIA
|
|
|
13
13
|
## Quick start
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
uv pip install "mlx-segment-ct>=0.3.
|
|
16
|
+
uv pip install "mlx-segment-ct>=0.3.2"
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
NIfTI files explicitly marked in meters or microns are rejected. Inputs with
|
|
20
|
+
unknown spatial units are assumed to use millimeters.
|
|
21
|
+
|
|
19
22
|
The click coordinates below are examples: replace them with voxels inside your
|
|
20
23
|
image and its preprocessed foreground crop. `1` includes a point; `0` excludes it.
|
|
21
24
|
|
|
@@ -25,7 +25,7 @@ if TYPE_CHECKING:
|
|
|
25
25
|
from mlx_segment_ct.mlx_worker import automatic_logits
|
|
26
26
|
from mlx_segment_ct.streaming import LabelReducer, bounded_labels, rolling_logits
|
|
27
27
|
|
|
28
|
-
__version__ = "0.3.
|
|
28
|
+
__version__ = "0.3.2"
|
|
29
29
|
|
|
30
30
|
_EXPORTS = {
|
|
31
31
|
"AutomaticModel": "mlx_segment_ct.mlx_network",
|
|
@@ -305,6 +305,9 @@ class NiftiHeader(Protocol):
|
|
|
305
305
|
def set_zooms(self, zooms: Sequence[float] | HostArray) -> None:
|
|
306
306
|
"""Set voxel spacing in the image header."""
|
|
307
307
|
...
|
|
308
|
+
def get_xyzt_units(self) -> tuple[str, str]:
|
|
309
|
+
"""Return the declared spatial and temporal units."""
|
|
310
|
+
...
|
|
308
311
|
def as_byteswapped(self, endianness: str | None = None) -> NiftiHeader:
|
|
309
312
|
"""Return a header with the requested byte order."""
|
|
310
313
|
...
|
|
@@ -197,9 +197,10 @@ def load_volume(path: Path) -> tuple[HostArray, DoubleArray]:
|
|
|
197
197
|
|
|
198
198
|
Accepts a 3D NIfTI-1/2 image or a 4D image with one trailing channel.
|
|
199
199
|
Returns the float32 (1, X, Y, Z) array and the float64 affine. Header
|
|
200
|
-
spatial units
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
spatial units must be millimeters or unknown, with unknown assumed to mean
|
|
201
|
+
millimeters. Explicit meter or micron units are rejected rather than rescaled.
|
|
202
|
+
The affine is checked for finiteness and invertibility, but image voxel values
|
|
203
|
+
are not checked for finiteness here.
|
|
203
204
|
"""
|
|
204
205
|
try:
|
|
205
206
|
image = nifti_api.load(str(path))
|
|
@@ -208,6 +209,15 @@ def load_volume(path: Path) -> tuple[HostArray, DoubleArray]:
|
|
|
208
209
|
if not isinstance(image, nib.Nifti1Image | nib.Nifti2Image):
|
|
209
210
|
raise InvalidInputError(f"NV-Segment-CT requires a NIfTI image: {path}")
|
|
210
211
|
image = _correct_nifti_header_if_necessary(cast("NiftiImage", image))
|
|
212
|
+
try:
|
|
213
|
+
spatial_units, _ = image.header.get_xyzt_units()
|
|
214
|
+
except KeyError as exc:
|
|
215
|
+
raise InvalidInputError(f"NV-Segment-CT has an invalid NIfTI unit code: {path}") from exc
|
|
216
|
+
if spatial_units not in ("mm", "unknown"):
|
|
217
|
+
raise InvalidInputError(
|
|
218
|
+
f"NV-Segment-CT spatial units are {spatial_units!r}; convert the affine "
|
|
219
|
+
"and header to millimeters before inference"
|
|
220
|
+
)
|
|
211
221
|
affine = np.array(image.affine, copy=True)
|
|
212
222
|
header = image.header.as_byteswapped("<") if _swappable(image.header) else image.header
|
|
213
223
|
dim = header["dim"]
|
|
@@ -125,8 +125,9 @@ def run(
|
|
|
125
125
|
interpolates the scores trilinearly at each source voxel and decides its label
|
|
126
126
|
there, so boundaries follow the source resolution. ``"bundle"`` decides on the
|
|
127
127
|
1.5 mm grid and restores labels with nearest interpolation, as the NVIDIA bundle does.
|
|
128
|
-
Input
|
|
129
|
-
|
|
128
|
+
Input spatial units must be millimeters or unknown (assumed millimeters);
|
|
129
|
+
other declared units require conversion before inference. Output NIfTI headers
|
|
130
|
+
are newly constructed and do not retain the source unit code.
|
|
130
131
|
|
|
131
132
|
The published ``MedMLX/vista3d-ct-mlx`` bundle supplies ``automatic.safetensors``
|
|
132
133
|
and ``correction.safetensors`` for ``checkpoint="NV-Segment-CT"``. The
|
|
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
|