cellprofiler-library-nightly 5.0.0.dev337__tar.gz → 5.0.0.dev343__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.
Files changed (64) hide show
  1. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/PKG-INFO +1 -1
  2. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/_version.py +3 -3
  3. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/functions/object_processing.py +47 -0
  4. cellprofiler_library_nightly-5.0.0.dev343/cellprofiler_library/modules/_dilateobjects.py +46 -0
  5. cellprofiler_library_nightly-5.0.0.dev343/cellprofiler_library/opts/dilateobjects.py +15 -0
  6. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library_nightly.egg-info/PKG-INFO +1 -1
  7. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library_nightly.egg-info/SOURCES.txt +2 -0
  8. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/LICENSE +0 -0
  9. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/README.md +0 -0
  10. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/__init__.py +0 -0
  11. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/functions/__init__.py +0 -0
  12. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/functions/file_processing.py +0 -0
  13. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/functions/image_processing.py +0 -0
  14. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/functions/measurement.py +0 -0
  15. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/functions/segmentation.py +0 -0
  16. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/__init__.py +0 -0
  17. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_closing.py +0 -0
  18. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_colortogray.py +0 -0
  19. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_combineobjects.py +0 -0
  20. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_convertimagetoobjects.py +0 -0
  21. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_convertobjectstoimage.py +0 -0
  22. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_correctilluminationapply.py +0 -0
  23. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_crop.py +0 -0
  24. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_dilateimage.py +0 -0
  25. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_enhanceedges.py +0 -0
  26. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_enhanceorsuppressfeatures.py +0 -0
  27. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_erodeimage.py +0 -0
  28. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_erodeobjects.py +0 -0
  29. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_expandorshrinkobjects.py +0 -0
  30. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_fillobjects.py +0 -0
  31. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_gaussianfilter.py +0 -0
  32. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_measureimageoverlap.py +0 -0
  33. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_measureobjectsizeshape.py +0 -0
  34. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_medialaxis.py +0 -0
  35. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_medianfilter.py +0 -0
  36. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_morphologicalskeleton.py +0 -0
  37. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_opening.py +0 -0
  38. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_overlayobjects.py +0 -0
  39. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_reducenoise.py +0 -0
  40. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_savecroppedobjects.py +0 -0
  41. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_threshold.py +0 -0
  42. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/modules/_watershed.py +0 -0
  43. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/__init__.py +0 -0
  44. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/colortogray.py +0 -0
  45. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/convertimagetoobjects.py +0 -0
  46. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/convertobjectstoimage.py +0 -0
  47. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/correctilluminationapply.py +0 -0
  48. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/crop.py +0 -0
  49. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/dilateimage.py +0 -0
  50. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/enhanceorsuppressfeatures.py +0 -0
  51. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/erodeimage.py +0 -0
  52. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/erodeobjects.py +0 -0
  53. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/measureimageoverlap.py +0 -0
  54. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/objectsizeshapefeatures.py +0 -0
  55. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/structuring_elements.py +0 -0
  56. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/opts/threshold.py +0 -0
  57. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/py.typed +0 -0
  58. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library/types.py +0 -0
  59. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library_nightly.egg-info/dependency_links.txt +0 -0
  60. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library_nightly.egg-info/requires.txt +0 -0
  61. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/cellprofiler_library_nightly.egg-info/top_level.txt +0 -0
  62. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/environment.yml +0 -0
  63. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/pyproject.toml +0 -0
  64. {cellprofiler_library_nightly-5.0.0.dev337 → cellprofiler_library_nightly-5.0.0.dev343}/setup.cfg +0 -0
@@ -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>
@@ -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
- __commit_id__ = commit_id = 'g6c4ae2cb6'
34
+ __commit_id__ = commit_id = 'gc6a344488'
@@ -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>
@@ -21,6 +21,7 @@ cellprofiler_library/modules/_convertobjectstoimage.py
21
21
  cellprofiler_library/modules/_correctilluminationapply.py
22
22
  cellprofiler_library/modules/_crop.py
23
23
  cellprofiler_library/modules/_dilateimage.py
24
+ cellprofiler_library/modules/_dilateobjects.py
24
25
  cellprofiler_library/modules/_enhanceedges.py
25
26
  cellprofiler_library/modules/_enhanceorsuppressfeatures.py
26
27
  cellprofiler_library/modules/_erodeimage.py
@@ -46,6 +47,7 @@ cellprofiler_library/opts/convertobjectstoimage.py
46
47
  cellprofiler_library/opts/correctilluminationapply.py
47
48
  cellprofiler_library/opts/crop.py
48
49
  cellprofiler_library/opts/dilateimage.py
50
+ cellprofiler_library/opts/dilateobjects.py
49
51
  cellprofiler_library/opts/enhanceorsuppressfeatures.py
50
52
  cellprofiler_library/opts/erodeimage.py
51
53
  cellprofiler_library/opts/erodeobjects.py