cellprofiler-library-nightly 5.0.0.dev324__py3-none-any.whl → 5.0.0.dev328__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.
- cellprofiler_library/_version.py +2 -2
- cellprofiler_library/functions/image_processing.py +34 -0
- cellprofiler_library/modules/_dilateimage.py +37 -0
- cellprofiler_library/opts/dilateimage.py +15 -0
- {cellprofiler_library_nightly-5.0.0.dev324.dist-info → cellprofiler_library_nightly-5.0.0.dev328.dist-info}/METADATA +1 -1
- {cellprofiler_library_nightly-5.0.0.dev324.dist-info → cellprofiler_library_nightly-5.0.0.dev328.dist-info}/RECORD +9 -7
- {cellprofiler_library_nightly-5.0.0.dev324.dist-info → cellprofiler_library_nightly-5.0.0.dev328.dist-info}/WHEEL +0 -0
- {cellprofiler_library_nightly-5.0.0.dev324.dist-info → cellprofiler_library_nightly-5.0.0.dev328.dist-info}/licenses/LICENSE +0 -0
- {cellprofiler_library_nightly-5.0.0.dev324.dist-info → cellprofiler_library_nightly-5.0.0.dev328.dist-info}/top_level.txt +0 -0
cellprofiler_library/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '5.0.0.
|
|
32
|
-
__version_tuple__ = version_tuple = (5, 0, 0, '
|
|
31
|
+
__version__ = version = '5.0.0.dev328'
|
|
32
|
+
__version_tuple__ = version_tuple = (5, 0, 0, 'dev328')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -161,6 +161,40 @@ def morphology_erosion(image: ImageAny, structuring_element: StructuringElement)
|
|
|
161
161
|
return y_data
|
|
162
162
|
|
|
163
163
|
|
|
164
|
+
################################################################################
|
|
165
|
+
# DilateImage
|
|
166
|
+
################################################################################
|
|
167
|
+
|
|
168
|
+
def morphology_dilation(image: ImageAny, structuring_element: StructuringElement) -> ImageAny:
|
|
169
|
+
"""Apply morphological dilation to an image.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
image: Input image (2D or 3D)
|
|
173
|
+
structuring_element: Structuring element for dilation
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
Dilated image with same dimensions as input
|
|
177
|
+
"""
|
|
178
|
+
is_strel_2d = structuring_element.ndim == 2
|
|
179
|
+
is_img_2d = image.ndim == 2
|
|
180
|
+
|
|
181
|
+
if is_strel_2d and not is_img_2d:
|
|
182
|
+
# Apply 2D structuring element to 3D image planewise
|
|
183
|
+
y_data = numpy.zeros_like(image)
|
|
184
|
+
for index, plane in enumerate(image):
|
|
185
|
+
y_data[index] = skimage.morphology.dilation(plane, structuring_element)
|
|
186
|
+
return y_data
|
|
187
|
+
|
|
188
|
+
if not is_strel_2d and is_img_2d:
|
|
189
|
+
raise NotImplementedError(
|
|
190
|
+
"A 3D structuring element cannot be applied to a 2D image."
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
# Apply dilation directly for matching dimensions
|
|
194
|
+
y_data = skimage.morphology.dilation(image, structuring_element)
|
|
195
|
+
return y_data
|
|
196
|
+
|
|
197
|
+
|
|
164
198
|
def median_filter(image, window_size, mode):
|
|
165
199
|
return scipy.ndimage.median_filter(image, size=window_size, mode=mode)
|
|
166
200
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
DilateImage module for the CellProfiler library.
|
|
5
|
+
|
|
6
|
+
This module contains the core algorithms for morphological dilation operations.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from pydantic import validate_call, ConfigDict, Field
|
|
10
|
+
from typing import Union, Tuple, Annotated
|
|
11
|
+
from cellprofiler_library.types import ImageAny, StructuringElement
|
|
12
|
+
from cellprofiler_library.functions.image_processing import morphology_dilation, get_structuring_element
|
|
13
|
+
from cellprofiler_library.opts.structuring_elements import StructuringElementShape2D, StructuringElementShape3D
|
|
14
|
+
|
|
15
|
+
StructuringElementSize = Annotated[int, Field(description="Size of structuring element", gt=0)]
|
|
16
|
+
StructuringElementParameters = Tuple[Union[StructuringElementShape2D, StructuringElementShape3D], StructuringElementSize]
|
|
17
|
+
|
|
18
|
+
@validate_call(config=ConfigDict(arbitrary_types_allowed=True))
|
|
19
|
+
def dilate_image(
|
|
20
|
+
image: Annotated[ImageAny, Field(description="Input image to perform dilation on")],
|
|
21
|
+
structuring_element: Annotated[Union[StructuringElement, StructuringElementParameters], Field(description="Structuring element for dilation operation as either an NDArray or a tuple of (StructuringElement[N]D, size)")]
|
|
22
|
+
) -> ImageAny:
|
|
23
|
+
"""Apply morphological dilation to an image.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
image: Input image (2D or 3D grayscale)
|
|
27
|
+
structuring_element: Structuring element for dilation operation as an NDArray or a tuple of (StructuringElement[N]D, size)
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
Dilated image with same dimensions and type as input
|
|
31
|
+
|
|
32
|
+
Raises:
|
|
33
|
+
NotImplementedError: If trying to apply 3D structuring element to 2D image
|
|
34
|
+
"""
|
|
35
|
+
if isinstance(structuring_element, tuple):
|
|
36
|
+
structuring_element = get_structuring_element(structuring_element[0], structuring_element[1])
|
|
37
|
+
return morphology_dilation(image, structuring_element)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Options and enums for DilateImage module
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# Note: DilateImage is a simple morphological operation module that doesn't require
|
|
8
|
+
# complex enums. The main configuration is handled through the StructuringElement
|
|
9
|
+
# setting which is managed by the core framework. This file is created for
|
|
10
|
+
# consistency with the refactoring pattern but may be minimal.
|
|
11
|
+
|
|
12
|
+
# Currently no custom enums needed for DilateImage as it uses standard
|
|
13
|
+
# StructuringElement configuration from cellprofiler_core. For structuring element shapes,
|
|
14
|
+
# see cellprofiler_library.opts.structuring_elements
|
|
15
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cellprofiler-library-nightly
|
|
3
|
-
Version: 5.0.0.
|
|
3
|
+
Version: 5.0.0.dev328
|
|
4
4
|
Summary: cellprofiler-library implements CellProfiler's image processing and mathematical code, and is usable as a standalone library
|
|
5
5
|
Author: Anne Carpenter, Thouis (Ray) Jones, Lee Kamentsky, Vebjorn Ljosa, David Logan, Mark Bray, Madison Swain-Bowden, Allen Goodman, Claire McQuinn, Alice Lucas, Callum Tromans-Coia
|
|
6
6
|
Author-email: Beth Cimini <bcimini@broadinstitute.org>, David Stirling <dstirling@glencoesoftware.com>, Nodar Gogoberidze <ngogober@broadinstitute.org>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
cellprofiler_library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
cellprofiler_library/_version.py,sha256=
|
|
2
|
+
cellprofiler_library/_version.py,sha256=PsxcwOzzb9oolouEbYbSgdrb1UXw3VQZXFhGnok7G2U,721
|
|
3
3
|
cellprofiler_library/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
cellprofiler_library/types.py,sha256=cU38AwLLsMiI3XCwfrmWmDNpGWgLfpCpsuwnijaT8vU,8559
|
|
5
5
|
cellprofiler_library/functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
cellprofiler_library/functions/file_processing.py,sha256=jumpdgxReyV5xzF4YXZWhkei9CQ9GtWD-VUCuFh-FZM,5168
|
|
7
|
-
cellprofiler_library/functions/image_processing.py,sha256=
|
|
7
|
+
cellprofiler_library/functions/image_processing.py,sha256=AqOq2Sf6YykX7wv2o4i94QehaCkUpamNLigqSMtWJ4g,36077
|
|
8
8
|
cellprofiler_library/functions/measurement.py,sha256=8pXcEb1fLgwOEDiTJho1_O-fFGTtIp-Qn1lStjQBjbo,29221
|
|
9
9
|
cellprofiler_library/functions/object_processing.py,sha256=3cKNq5ewBf_HWz6rdX3XR4WUbd6SklbHZ_H40xt9ODM,19443
|
|
10
10
|
cellprofiler_library/functions/segmentation.py,sha256=LNE22ByY0X7GepQaHqLdxkzlmIXjD3EglAYJjtT2dGo,25257
|
|
@@ -16,6 +16,7 @@ cellprofiler_library/modules/_convertimagetoobjects.py,sha256=_X2YWEHK4hFaP13LEB
|
|
|
16
16
|
cellprofiler_library/modules/_convertobjectstoimage.py,sha256=PMYjH_prBKma4LNgUxmA5GzF7fQ6ko09XszKatTulB4,2274
|
|
17
17
|
cellprofiler_library/modules/_correctilluminationapply.py,sha256=8bZC3AnQv3vpUrNSnLvcc_s0E-P63XbrfwMv7OZNjt4,2084
|
|
18
18
|
cellprofiler_library/modules/_crop.py,sha256=0T0sQsK7o5dHVXMZ4OqvAJkskkyez1MXcnPlU5yqsV4,2422
|
|
19
|
+
cellprofiler_library/modules/_dilateimage.py,sha256=9mdB3Ft7muCkArTcEebs-Dz7_Ptg3YZsdL1qkr9K_0o,1812
|
|
19
20
|
cellprofiler_library/modules/_enhanceedges.py,sha256=PaXZck8fPcxRf-IXCstu-OWmsvM_rDDPMMQ3cZFfVZc,2951
|
|
20
21
|
cellprofiler_library/modules/_erodeimage.py,sha256=nFHn4hdpjXJaPvnpSyfPAxWgd7UXi0fUUgPqEl26CCY,1802
|
|
21
22
|
cellprofiler_library/modules/_expandorshrinkobjects.py,sha256=A1oeW_O8C5NLJr-xU1R9pSulDau8XUeWaKiilpr-85g,856
|
|
@@ -38,13 +39,14 @@ cellprofiler_library/opts/convertimagetoobjects.py,sha256=9e3VOdpjd4084ATZyFtSQg
|
|
|
38
39
|
cellprofiler_library/opts/convertobjectstoimage.py,sha256=U3jeVtKYFgfxbO7NYndanAyZFoEvbyScOq4T8cpjfX8,188
|
|
39
40
|
cellprofiler_library/opts/correctilluminationapply.py,sha256=IkAqjMjaRdsoY2aXw5_dLI1iRYqCwvcNwCWEpWNZrN4,96
|
|
40
41
|
cellprofiler_library/opts/crop.py,sha256=GaArWq3WZd_Ykunj1SSbFOYkqDQ6TXy2MDKxG4fA6ZE,879
|
|
42
|
+
cellprofiler_library/opts/dilateimage.py,sha256=KsRf7gTKzFcTcylfIBrwue9csKBtJZdbVPFT5P_OjOM,588
|
|
41
43
|
cellprofiler_library/opts/erodeimage.py,sha256=T3LCqu83rTqTDlc_7ebuPBKnr-FKomRHA8WD0uA9Y1g,584
|
|
42
44
|
cellprofiler_library/opts/measureimageoverlap.py,sha256=uopQCJTX1Uk-NNDAISsdYEOuOtiEBYOyCwu57ZT7X84,134
|
|
43
45
|
cellprofiler_library/opts/objectsizeshapefeatures.py,sha256=3GIntOH3qXs7F16Tpjmtg7opHYAmmOjEdEwW6q3ht_Y,6306
|
|
44
46
|
cellprofiler_library/opts/structuring_elements.py,sha256=Q4pBdCgDmjPx05t61Zqi40Iof8Nj3UR5k-F7brImLZY,263
|
|
45
47
|
cellprofiler_library/opts/threshold.py,sha256=yg_i5to22Nd9hTakaRxo9UIQZRYWFpavJimjl5JONx4,938
|
|
46
|
-
cellprofiler_library_nightly-5.0.0.
|
|
47
|
-
cellprofiler_library_nightly-5.0.0.
|
|
48
|
-
cellprofiler_library_nightly-5.0.0.
|
|
49
|
-
cellprofiler_library_nightly-5.0.0.
|
|
50
|
-
cellprofiler_library_nightly-5.0.0.
|
|
48
|
+
cellprofiler_library_nightly-5.0.0.dev328.dist-info/licenses/LICENSE,sha256=QLWaBS7kAioYx7PmJNXAMJaY8NODcFAag60YlUWuyz0,2276
|
|
49
|
+
cellprofiler_library_nightly-5.0.0.dev328.dist-info/METADATA,sha256=13FKaSOrSkR-hnmCuPWJ6v2wW5AbcscIqxuN586eV2A,5534
|
|
50
|
+
cellprofiler_library_nightly-5.0.0.dev328.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
51
|
+
cellprofiler_library_nightly-5.0.0.dev328.dist-info/top_level.txt,sha256=LXq0ApDeDD4gotb6YFTySzdyScvHfS_pqoTg1QsNLBs,21
|
|
52
|
+
cellprofiler_library_nightly-5.0.0.dev328.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|