cellprofiler-library-nightly 5.0.0.dev337__py3-none-any.whl → 5.0.0.dev343__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.
@@ -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.dev337'
32
- __version_tuple__ = version_tuple = (5, 0, 0, 'dev337')
31
+ __version__ = version = '5.0.0.dev343'
32
+ __version_tuple__ = version_tuple = (5, 0, 0, 'dev343')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -629,3 +629,50 @@ def erode_objects_with_structuring_element(
629
629
 
630
630
  return y_data
631
631
 
632
+ ################################################################################
633
+ # DilateObjects
634
+ ################################################################################
635
+
636
+ def dilate_objects_with_structuring_element(
637
+ labels: ObjectSegmentation,
638
+ structuring_element: StructuringElement
639
+ ) -> ObjectSegmentation:
640
+ """Dilate objects based on the structuring element provided.
641
+
642
+ This function is similar to the "Expand" function of ExpandOrShrinkObjects,
643
+ with two major distinctions:
644
+ 1. DilateObjects supports 3D objects, unlike ExpandOrShrinkObjects.
645
+ 2. In ExpandOrShrinkObjects, two objects closer than the expansion distance
646
+ will expand until they meet and then stop there. In this module, the object with
647
+ the larger object number (the object that is lower in the image) will be expanded
648
+ on top of the object with the smaller object number.
649
+
650
+ Args:
651
+ labels: Input labeled objects array
652
+ structuring_element: Structuring element for dilation operation
653
+
654
+ Returns:
655
+ Dilated objects array with same dimensions as input
656
+ """
657
+ is_strel_2d = structuring_element.ndim == 2
658
+
659
+ is_img_2d = labels.ndim == 2
660
+
661
+ if is_strel_2d and not is_img_2d:
662
+ y_data = numpy.zeros_like(labels)
663
+
664
+ for index, plane in enumerate(labels):
665
+
666
+ y_data[index] = skimage.morphology.dilation(plane, structuring_element)
667
+
668
+ return y_data
669
+
670
+ if not is_strel_2d and is_img_2d:
671
+ raise NotImplementedError(
672
+ "A 3D structuring element cannot be applied to a 2D image."
673
+ )
674
+
675
+ y_data = skimage.morphology.dilation(labels, structuring_element)
676
+
677
+ return y_data
678
+
@@ -0,0 +1,46 @@
1
+ # coding=utf-8
2
+
3
+ """
4
+ DilateObjects module for the CellProfiler library.
5
+
6
+ This module contains the core algorithms for object 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 StructuringElement, ObjectSegmentation
12
+ from cellprofiler_library.functions.object_processing import dilate_objects_with_structuring_element
13
+ from cellprofiler_library.functions.image_processing import get_structuring_element
14
+ from cellprofiler_library.opts.structuring_elements import StructuringElementShape2D, StructuringElementShape3D
15
+
16
+ StructuringElementSize = Annotated[int, Field(description="Size of structuring element", gt=0)]
17
+ StructuringElementParameters = Tuple[Union[StructuringElementShape2D, StructuringElementShape3D], StructuringElementSize]
18
+
19
+ @validate_call(config=ConfigDict(arbitrary_types_allowed=True))
20
+ def dilate_objects(
21
+ labels: Annotated[ObjectSegmentation, Field(description="Input object segmentations")],
22
+ 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)")],
23
+ ) -> ObjectSegmentation:
24
+ """Dilate objects based on the structuring element provided.
25
+
26
+ This function is similar to the "Expand" function of ExpandOrShrinkObjects,
27
+ with two major distinctions:
28
+ 1. DilateObjects supports 3D objects, unlike ExpandOrShrinkObjects.
29
+ 2. In ExpandOrShrinkObjects, two objects closer than the expansion distance
30
+ will expand until they meet and then stop there. In this module, the object with
31
+ the larger object number (the object that is lower in the image) will be expanded
32
+ on top of the object with the smaller object number.
33
+
34
+ Args:
35
+ labels: Input labeled objects array
36
+ structuring_element: Structuring element for dilation operation
37
+
38
+ Returns:
39
+ Dilated objects array with same dimensions as input
40
+ """
41
+ if isinstance(structuring_element, tuple):
42
+ structuring_element = get_structuring_element(structuring_element[0], structuring_element[1])
43
+ return dilate_objects_with_structuring_element(
44
+ labels=labels,
45
+ structuring_element=structuring_element
46
+ )
@@ -0,0 +1,15 @@
1
+ # coding=utf-8
2
+
3
+ """
4
+ Options and enums for DilateObjects module
5
+ """
6
+
7
+ # Note: DilateObjects 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 DilateObjects 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.dev337
3
+ Version: 5.0.0.dev343
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,12 +1,12 @@
1
1
  cellprofiler_library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- cellprofiler_library/_version.py,sha256=uqhbZqMaLWPM_eN5M1IR2mS3YSSFhvbkhyhU3mlT590,721
2
+ cellprofiler_library/_version.py,sha256=hHfirX4ltVJs32-gRsCUTurfTDi5DV9l3kEHu8iRv4A,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
7
  cellprofiler_library/functions/image_processing.py,sha256=d9T0Ro2BaOS9Y9CrNgqUlOjUHTJVLnxOG696IWeLQeg,43556
8
8
  cellprofiler_library/functions/measurement.py,sha256=8pXcEb1fLgwOEDiTJho1_O-fFGTtIp-Qn1lStjQBjbo,29221
9
- cellprofiler_library/functions/object_processing.py,sha256=5yHR_toKMH0KfWPAtEESQfK9JOdaD3L7WZskjGyoZ2o,23209
9
+ cellprofiler_library/functions/object_processing.py,sha256=5dPl8PWRSJbPLWjxV0kCRZDKLCg0tJCTmRnRd1CXys4,24897
10
10
  cellprofiler_library/functions/segmentation.py,sha256=LNE22ByY0X7GepQaHqLdxkzlmIXjD3EglAYJjtT2dGo,25257
11
11
  cellprofiler_library/modules/__init__.py,sha256=Z4Wy42OTD9ujAON4g1oyLJ0oA6K7h3XQiV66JzHGkOw,789
12
12
  cellprofiler_library/modules/_closing.py,sha256=aIqIE0IcT2OcrOmTSWjFzu4iIQKk2yDC9qPHARqRIkc,204
@@ -17,6 +17,7 @@ cellprofiler_library/modules/_convertobjectstoimage.py,sha256=PMYjH_prBKma4LNgUx
17
17
  cellprofiler_library/modules/_correctilluminationapply.py,sha256=8bZC3AnQv3vpUrNSnLvcc_s0E-P63XbrfwMv7OZNjt4,2084
18
18
  cellprofiler_library/modules/_crop.py,sha256=0T0sQsK7o5dHVXMZ4OqvAJkskkyez1MXcnPlU5yqsV4,2422
19
19
  cellprofiler_library/modules/_dilateimage.py,sha256=9mdB3Ft7muCkArTcEebs-Dz7_Ptg3YZsdL1qkr9K_0o,1812
20
+ cellprofiler_library/modules/_dilateobjects.py,sha256=lq5uY8uogp1CcVPVOXSLUfpxcw0ZRUFk8P8PwoksfW0,2338
20
21
  cellprofiler_library/modules/_enhanceedges.py,sha256=PaXZck8fPcxRf-IXCstu-OWmsvM_rDDPMMQ3cZFfVZc,2951
21
22
  cellprofiler_library/modules/_enhanceorsuppressfeatures.py,sha256=UkcJ2qM32hmnB_68yyjKmdaus78OXcpWi7E5OwRz9R8,3469
22
23
  cellprofiler_library/modules/_erodeimage.py,sha256=nFHn4hdpjXJaPvnpSyfPAxWgd7UXi0fUUgPqEl26CCY,1802
@@ -42,6 +43,7 @@ cellprofiler_library/opts/convertobjectstoimage.py,sha256=U3jeVtKYFgfxbO7NYndanA
42
43
  cellprofiler_library/opts/correctilluminationapply.py,sha256=IkAqjMjaRdsoY2aXw5_dLI1iRYqCwvcNwCWEpWNZrN4,96
43
44
  cellprofiler_library/opts/crop.py,sha256=GaArWq3WZd_Ykunj1SSbFOYkqDQ6TXy2MDKxG4fA6ZE,879
44
45
  cellprofiler_library/opts/dilateimage.py,sha256=KsRf7gTKzFcTcylfIBrwue9csKBtJZdbVPFT5P_OjOM,588
46
+ cellprofiler_library/opts/dilateobjects.py,sha256=gQXrxyTtHYcVvAB5PrNlwBVNB6hsZ95Lcv4KQljZT1w,594
45
47
  cellprofiler_library/opts/enhanceorsuppressfeatures.py,sha256=8Ej5TFUX-EKTbUcV3AidcIaomwh_A9A5lNJVRu76pc4,449
46
48
  cellprofiler_library/opts/erodeimage.py,sha256=T3LCqu83rTqTDlc_7ebuPBKnr-FKomRHA8WD0uA9Y1g,584
47
49
  cellprofiler_library/opts/erodeobjects.py,sha256=jOooDWqy01qdh17nAF0nbluU1lPToO2ZZqqsAzj2iNg,591
@@ -49,8 +51,8 @@ cellprofiler_library/opts/measureimageoverlap.py,sha256=uopQCJTX1Uk-NNDAISsdYEOu
49
51
  cellprofiler_library/opts/objectsizeshapefeatures.py,sha256=3GIntOH3qXs7F16Tpjmtg7opHYAmmOjEdEwW6q3ht_Y,6306
50
52
  cellprofiler_library/opts/structuring_elements.py,sha256=Q4pBdCgDmjPx05t61Zqi40Iof8Nj3UR5k-F7brImLZY,263
51
53
  cellprofiler_library/opts/threshold.py,sha256=yg_i5to22Nd9hTakaRxo9UIQZRYWFpavJimjl5JONx4,938
52
- cellprofiler_library_nightly-5.0.0.dev337.dist-info/licenses/LICENSE,sha256=QLWaBS7kAioYx7PmJNXAMJaY8NODcFAag60YlUWuyz0,2276
53
- cellprofiler_library_nightly-5.0.0.dev337.dist-info/METADATA,sha256=lIKBVisf5Nx_AsUb84QM6RnhSzuUngvrS0wGzFRy4-w,5534
54
- cellprofiler_library_nightly-5.0.0.dev337.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- cellprofiler_library_nightly-5.0.0.dev337.dist-info/top_level.txt,sha256=LXq0ApDeDD4gotb6YFTySzdyScvHfS_pqoTg1QsNLBs,21
56
- cellprofiler_library_nightly-5.0.0.dev337.dist-info/RECORD,,
54
+ cellprofiler_library_nightly-5.0.0.dev343.dist-info/licenses/LICENSE,sha256=QLWaBS7kAioYx7PmJNXAMJaY8NODcFAag60YlUWuyz0,2276
55
+ cellprofiler_library_nightly-5.0.0.dev343.dist-info/METADATA,sha256=1ntqPcoI25QFWfqFcfG743HLq0n5_awtWK23WFMruLU,5534
56
+ cellprofiler_library_nightly-5.0.0.dev343.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
57
+ cellprofiler_library_nightly-5.0.0.dev343.dist-info/top_level.txt,sha256=LXq0ApDeDD4gotb6YFTySzdyScvHfS_pqoTg1QsNLBs,21
58
+ cellprofiler_library_nightly-5.0.0.dev343.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5