copick-utils 0.6.0__py3-none-any.whl → 1.0.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.
- copick_utils/__init__.py +1 -0
- copick_utils/cli/__init__.py +33 -0
- copick_utils/cli/clipmesh.py +161 -0
- copick_utils/cli/clippicks.py +154 -0
- copick_utils/cli/clipseg.py +163 -0
- copick_utils/cli/conversion_commands.py +32 -0
- copick_utils/cli/enclosed.py +191 -0
- copick_utils/cli/filter_components.py +166 -0
- copick_utils/cli/fit_spline.py +191 -0
- copick_utils/cli/hull.py +138 -0
- copick_utils/cli/input_output_selection.py +76 -0
- copick_utils/cli/logical_commands.py +29 -0
- copick_utils/cli/mesh2picks.py +170 -0
- copick_utils/cli/mesh2seg.py +167 -0
- copick_utils/cli/meshop.py +262 -0
- copick_utils/cli/picks2ellipsoid.py +171 -0
- copick_utils/cli/picks2mesh.py +181 -0
- copick_utils/cli/picks2plane.py +156 -0
- copick_utils/cli/picks2seg.py +134 -0
- copick_utils/cli/picks2sphere.py +170 -0
- copick_utils/cli/picks2surface.py +164 -0
- copick_utils/cli/picksin.py +146 -0
- copick_utils/cli/picksout.py +148 -0
- copick_utils/cli/processing_commands.py +18 -0
- copick_utils/cli/seg2mesh.py +135 -0
- copick_utils/cli/seg2picks.py +128 -0
- copick_utils/cli/segop.py +248 -0
- copick_utils/cli/separate_components.py +155 -0
- copick_utils/cli/skeletonize.py +164 -0
- copick_utils/cli/util.py +580 -0
- copick_utils/cli/validbox.py +155 -0
- copick_utils/converters/__init__.py +35 -0
- copick_utils/converters/converter_common.py +543 -0
- copick_utils/converters/ellipsoid_from_picks.py +335 -0
- copick_utils/converters/lazy_converter.py +576 -0
- copick_utils/converters/mesh_from_picks.py +209 -0
- copick_utils/converters/mesh_from_segmentation.py +119 -0
- copick_utils/converters/picks_from_mesh.py +542 -0
- copick_utils/converters/picks_from_segmentation.py +168 -0
- copick_utils/converters/plane_from_picks.py +251 -0
- copick_utils/converters/segmentation_from_mesh.py +291 -0
- copick_utils/{segmentation → converters}/segmentation_from_picks.py +151 -15
- copick_utils/converters/sphere_from_picks.py +306 -0
- copick_utils/converters/surface_from_picks.py +337 -0
- copick_utils/features/skimage.py +33 -13
- copick_utils/io/readers.py +62 -59
- copick_utils/io/writers.py +9 -14
- copick_utils/logical/__init__.py +43 -0
- copick_utils/logical/distance_operations.py +604 -0
- copick_utils/logical/enclosed_operations.py +222 -0
- copick_utils/logical/mesh_operations.py +443 -0
- copick_utils/logical/point_operations.py +303 -0
- copick_utils/logical/segmentation_operations.py +399 -0
- copick_utils/pickers/grid_picker.py +5 -4
- copick_utils/process/__init__.py +47 -0
- copick_utils/process/connected_components.py +360 -0
- copick_utils/process/filter_components.py +306 -0
- copick_utils/process/hull.py +106 -0
- copick_utils/process/skeletonize.py +326 -0
- copick_utils/process/spline_fitting.py +648 -0
- copick_utils/process/validbox.py +333 -0
- copick_utils/util/__init__.py +6 -0
- copick_utils/util/config_models.py +614 -0
- {copick_utils-0.6.0.dist-info → copick_utils-1.0.0.dist-info}/METADATA +38 -12
- copick_utils-1.0.0.dist-info/RECORD +71 -0
- {copick_utils-0.6.0.dist-info → copick_utils-1.0.0.dist-info}/WHEEL +1 -1
- copick_utils-1.0.0.dist-info/entry_points.txt +29 -0
- copick_utils/__about__.py +0 -4
- copick_utils/segmentation/picks_from_segmentation.py +0 -67
- copick_utils-0.6.0.dist-info/RECORD +0 -15
- /copick_utils/{segmentation → io}/__init__.py +0 -0
- /copick_utils-0.6.0.dist-info/LICENSE.txt → /copick_utils-1.0.0.dist-info/licenses/LICENSE +0 -0
copick_utils/io/writers.py
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
from typing import Any, Dict, List
|
|
2
1
|
import numpy as np
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
input_volume,
|
|
7
|
-
voxel_size=10,
|
|
8
|
-
algorithm="wbp"
|
|
9
|
-
):
|
|
3
|
+
|
|
4
|
+
def tomogram(run, input_volume, voxel_size=10, algorithm="wbp"):
|
|
10
5
|
"""
|
|
11
6
|
Writes a volumetric tomogram into an OME-Zarr format within a Copick directory.
|
|
12
7
|
|
|
@@ -26,17 +21,17 @@ def tomogram(
|
|
|
26
21
|
copick.Tomogram
|
|
27
22
|
The created or modified tomogram object.
|
|
28
23
|
"""
|
|
29
|
-
|
|
24
|
+
|
|
30
25
|
# Retrieve or create voxel spacing
|
|
31
26
|
voxel_spacing = run.get_voxel_spacing(voxel_size)
|
|
32
27
|
if voxel_spacing is None:
|
|
33
28
|
voxel_spacing = run.new_voxel_spacing(voxel_size=voxel_size)
|
|
34
|
-
|
|
29
|
+
|
|
35
30
|
# Check if We Need to Create a New Tomogram for Given Algorithm
|
|
36
31
|
tomogram = voxel_spacing.get_tomogram(algorithm)
|
|
37
32
|
if tomogram is None:
|
|
38
33
|
tomogram = voxel_spacing.new_tomogram(tomo_type=algorithm)
|
|
39
|
-
|
|
34
|
+
|
|
40
35
|
# Write the tomogram data
|
|
41
36
|
tomogram.from_numpy(input_volume)
|
|
42
37
|
|
|
@@ -48,7 +43,7 @@ def segmentation(
|
|
|
48
43
|
name="segmentation",
|
|
49
44
|
session_id="0",
|
|
50
45
|
voxel_size=10,
|
|
51
|
-
multilabel=True
|
|
46
|
+
multilabel=True,
|
|
52
47
|
):
|
|
53
48
|
"""
|
|
54
49
|
Writes a segmentation into an OME-Zarr format within a Copick directory.
|
|
@@ -75,7 +70,7 @@ def segmentation(
|
|
|
75
70
|
copick.Segmentation
|
|
76
71
|
The created or modified segmentation object.
|
|
77
72
|
"""
|
|
78
|
-
|
|
73
|
+
|
|
79
74
|
# Retrieve or create a segmentation
|
|
80
75
|
segmentations = run.get_segmentations(name=name, user_id=user_id, session_id=session_id)
|
|
81
76
|
|
|
@@ -86,11 +81,11 @@ def segmentation(
|
|
|
86
81
|
name=name,
|
|
87
82
|
session_id=session_id,
|
|
88
83
|
is_multilabel=multilabel,
|
|
89
|
-
user_id=user_id
|
|
84
|
+
user_id=user_id,
|
|
90
85
|
)
|
|
91
86
|
else:
|
|
92
87
|
# Overwrite the current segmentation at the specified voxel size if it exists
|
|
93
88
|
segmentation = next(seg for seg in segmentations if seg.voxel_size == voxel_size)
|
|
94
|
-
|
|
89
|
+
|
|
95
90
|
# Write the segmentation data
|
|
96
91
|
segmentation.from_numpy(segmentation_volume, dtype=np.uint8)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Logical operations for copick objects (meshes, segmentations, picks)."""
|
|
2
|
+
|
|
3
|
+
from copick_utils.logical.distance_operations import (
|
|
4
|
+
limit_mesh_by_distance,
|
|
5
|
+
limit_picks_by_distance,
|
|
6
|
+
limit_segmentation_by_distance,
|
|
7
|
+
)
|
|
8
|
+
from copick_utils.logical.mesh_operations import (
|
|
9
|
+
mesh_difference,
|
|
10
|
+
mesh_exclusion,
|
|
11
|
+
mesh_intersection,
|
|
12
|
+
mesh_union,
|
|
13
|
+
)
|
|
14
|
+
from copick_utils.logical.point_operations import (
|
|
15
|
+
picks_exclusion_by_mesh,
|
|
16
|
+
picks_inclusion_by_mesh,
|
|
17
|
+
)
|
|
18
|
+
from copick_utils.logical.segmentation_operations import (
|
|
19
|
+
segmentation_difference,
|
|
20
|
+
segmentation_exclusion,
|
|
21
|
+
segmentation_intersection,
|
|
22
|
+
segmentation_union,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
# Mesh boolean operations
|
|
27
|
+
"mesh_union",
|
|
28
|
+
"mesh_difference",
|
|
29
|
+
"mesh_exclusion",
|
|
30
|
+
"mesh_intersection",
|
|
31
|
+
# Segmentation boolean operations
|
|
32
|
+
"segmentation_union",
|
|
33
|
+
"segmentation_difference",
|
|
34
|
+
"segmentation_exclusion",
|
|
35
|
+
"segmentation_intersection",
|
|
36
|
+
# Distance-based limiting operations
|
|
37
|
+
"limit_mesh_by_distance",
|
|
38
|
+
"limit_segmentation_by_distance",
|
|
39
|
+
"limit_picks_by_distance",
|
|
40
|
+
# Point inclusion/exclusion operations
|
|
41
|
+
"picks_inclusion_by_mesh",
|
|
42
|
+
"picks_exclusion_by_mesh",
|
|
43
|
+
]
|