cellprofiler-library-nightly 5.0.0.dev410__tar.gz → 5.0.0.dev413__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 (72) hide show
  1. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/PKG-INFO +2 -1
  2. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/_version.py +3 -3
  3. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/functions/image_processing.py +156 -1
  4. cellprofiler_library_nightly-5.0.0.dev413/cellprofiler_library/modules/_resize.py +50 -0
  5. cellprofiler_library_nightly-5.0.0.dev413/cellprofiler_library/opts/resize.py +22 -0
  6. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library_nightly.egg-info/PKG-INFO +2 -1
  7. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library_nightly.egg-info/SOURCES.txt +2 -0
  8. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library_nightly.egg-info/requires.txt +1 -0
  9. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/pyproject.toml +1 -1
  10. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/LICENSE +0 -0
  11. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/README.md +0 -0
  12. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/__init__.py +0 -0
  13. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/functions/__init__.py +0 -0
  14. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/functions/file_processing.py +0 -0
  15. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/functions/measurement.py +0 -0
  16. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/functions/object_processing.py +0 -0
  17. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/functions/segmentation.py +0 -0
  18. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/__init__.py +0 -0
  19. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_closing.py +0 -0
  20. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_colortogray.py +0 -0
  21. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_combineobjects.py +0 -0
  22. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_convertimagetoobjects.py +0 -0
  23. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_convertobjectstoimage.py +0 -0
  24. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_correctilluminationapply.py +0 -0
  25. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_crop.py +0 -0
  26. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_dilateimage.py +0 -0
  27. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_dilateobjects.py +0 -0
  28. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_enhanceedges.py +0 -0
  29. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_enhanceorsuppressfeatures.py +0 -0
  30. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_erodeimage.py +0 -0
  31. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_erodeobjects.py +0 -0
  32. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_expandorshrinkobjects.py +0 -0
  33. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_fillobjects.py +0 -0
  34. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_gaussianfilter.py +0 -0
  35. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_measureimageoverlap.py +0 -0
  36. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_measureobjectsizeshape.py +0 -0
  37. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_medialaxis.py +0 -0
  38. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_medianfilter.py +0 -0
  39. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_morph.py +0 -0
  40. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_morphologicalskeleton.py +0 -0
  41. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_opening.py +0 -0
  42. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_overlayobjects.py +0 -0
  43. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_overlayoutlines.py +0 -0
  44. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_reducenoise.py +0 -0
  45. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_removeholes.py +0 -0
  46. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_savecroppedobjects.py +0 -0
  47. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_threshold.py +0 -0
  48. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/modules/_watershed.py +0 -0
  49. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/__init__.py +0 -0
  50. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/colortogray.py +0 -0
  51. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/convertimagetoobjects.py +0 -0
  52. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/convertobjectstoimage.py +0 -0
  53. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/correctilluminationapply.py +0 -0
  54. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/crop.py +0 -0
  55. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/dilateimage.py +0 -0
  56. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/dilateobjects.py +0 -0
  57. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/enhanceorsuppressfeatures.py +0 -0
  58. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/erodeimage.py +0 -0
  59. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/erodeobjects.py +0 -0
  60. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/measureimageoverlap.py +0 -0
  61. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/morph.py +0 -0
  62. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/objectsizeshapefeatures.py +0 -0
  63. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/overlayoutlines.py +0 -0
  64. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/removeholes.py +0 -0
  65. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/structuring_elements.py +0 -0
  66. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/opts/threshold.py +0 -0
  67. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/py.typed +0 -0
  68. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library/types.py +0 -0
  69. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library_nightly.egg-info/dependency_links.txt +0 -0
  70. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/cellprofiler_library_nightly.egg-info/top_level.txt +0 -0
  71. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/environment.yml +0 -0
  72. {cellprofiler_library_nightly-5.0.0.dev410 → cellprofiler_library_nightly-5.0.0.dev413}/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.dev410
3
+ Version: 5.0.0.dev413
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>
@@ -68,6 +68,7 @@ Description-Content-Type: text/markdown
68
68
  License-File: LICENSE
69
69
  Requires-Dist: numpy<2,>=1.26.4
70
70
  Requires-Dist: scikit-image>=0.20.0
71
+ Requires-Dist: scikit-learn>=1.3.0
71
72
  Requires-Dist: scipy<1.11,>=1.9.1
72
73
  Requires-Dist: mahotas>=1.4.13
73
74
  Requires-Dist: centrosome>=1.3.0
@@ -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.dev410'
32
- __version_tuple__ = version_tuple = (5, 0, 0, 'dev410')
31
+ __version__ = version = '5.0.0.dev413'
32
+ __version_tuple__ = version_tuple = (5, 0, 0, 'dev413')
33
33
 
34
- __commit_id__ = commit_id = 'ga62cfe468'
34
+ __commit_id__ = commit_id = 'gd6becfb42'
@@ -3,21 +3,26 @@ import skimage.color
3
3
  import skimage.morphology
4
4
  import skimage.segmentation
5
5
  import skimage.util
6
+ import skimage.transform
7
+ import skimage
8
+ import skimage.restoration
6
9
  import centrosome
7
10
  import centrosome.threshold
8
11
  import centrosome.filter
9
12
  import scipy
13
+ import scipy.interpolate
10
14
  import matplotlib
11
15
  import math
12
16
  from numpy.typing import NDArray
13
17
  import centrosome.filter
14
18
  from typing import Any, Optional, Tuple, Callable, Union, List, TypeVar
15
- from cellprofiler_library.types import ImageGrayscale, ImageGrayscaleMask, Image2DColor, Image2DGrayscale, ImageAny, ImageAnyMask, ObjectSegmentation, Image2D, Image2DMask, StructuringElement, ObjectLabelSet, ImageColor
19
+ from cellprofiler_library.types import ImageGrayscale, ImageGrayscaleMask, Image2DColor, Image2DGrayscale, ImageAny, ImageAnyMask, ObjectSegmentation, Image2D, Image2DMask, StructuringElement, ObjectLabelSet, ImageColor, ImageBinaryMask
16
20
  from cellprofiler_library.opts import threshold as Threshold
17
21
  from cellprofiler_library.opts.enhanceorsuppressfeatures import SpeckleAccuracy, NeuriteMethod
18
22
  from cellprofiler_library.opts.overlayoutlines import BrightnessMode
19
23
  from cellprofiler_library.opts.crop import RemovalMethod
20
24
  from cellprofiler_library.opts.structuring_elements import StructuringElementShape2D, StructuringElementShape3D
25
+ from ..opts.resize import ResizingMethod, DimensionMethod, InterpolationMethod
21
26
 
22
27
  T = TypeVar("T", bound=ImageAny)
23
28
  MorphImageT = TypeVar("Union[ImageGrayscale, ImageGrayscaleMask]", bound=Union[ImageGrayscale, ImageGrayscaleMask])
@@ -221,6 +226,156 @@ def reduce_noise(image, patch_size, patch_distance, cutoff_distance, channel_axi
221
226
  return denoised
222
227
 
223
228
 
229
+ ################################################################################
230
+ # Resize Functions
231
+ ################################################################################
232
+
233
+ def resized_shape(
234
+ im_pixel_data: ImageAny,
235
+ im_dimensions: int,
236
+ size_method: str,
237
+ resizing_factor_x: float,
238
+ resizing_factor_y: float,
239
+ resizing_factor_z: Optional[float],
240
+ use_manual_or_image: DimensionMethod,
241
+ specific_width: Optional[int],
242
+ specific_height: Optional[int],
243
+ specific_planes: Optional[int],
244
+ reference_image_shape: Optional[Tuple[int, ...]] = None,
245
+ ) -> NDArray[numpy.int_]:
246
+ """Calculate target dimensions based on resize method."""
247
+ im_volumetric = True if im_dimensions == 3 else False
248
+ im_multichannel = True if im_pixel_data.ndim > im_dimensions else False
249
+
250
+
251
+ shape = numpy.array(im_pixel_data.shape).astype(float)
252
+
253
+ if size_method == ResizingMethod.BY_FACTOR:
254
+ factor_x = resizing_factor_x
255
+ factor_y = resizing_factor_y
256
+
257
+ if im_volumetric:
258
+ assert resizing_factor_z is not None, "Z-axis scaling factor must be specified when resizing by factor"
259
+ factor_z = resizing_factor_z
260
+ height, width = shape[1:3]
261
+ planes = shape[0]
262
+ planes = numpy.round(planes * factor_z)
263
+ else:
264
+ height, width = shape[:2]
265
+
266
+ height = numpy.round(height * factor_y)
267
+ width = numpy.round(width * factor_x)
268
+
269
+ else:
270
+ if use_manual_or_image == DimensionMethod.MANUAL:
271
+ assert specific_height is not None, "Specific height must be specified when using manual dimensions"
272
+ assert specific_width is not None, "Specific width must be specified when using manual dimensions"
273
+ height = specific_height
274
+ width = specific_width
275
+ if im_volumetric:
276
+ assert specific_planes is not None, "Specific planes must be specified when using manual dimensions"
277
+ planes = specific_planes
278
+ else:
279
+ assert reference_image_shape is not None, "Reference image shape must be provided when using image-based dimensions"
280
+
281
+ if im_volumetric:
282
+ planes, height, width = reference_image_shape[:3]
283
+ else:
284
+ height, width = reference_image_shape[:2]
285
+
286
+ new_shape = []
287
+
288
+ if im_volumetric:
289
+ new_shape += [planes]
290
+
291
+ new_shape += [height, width]
292
+
293
+ if im_multichannel:
294
+ new_shape += [shape[-1]]
295
+
296
+ return numpy.asarray(new_shape)
297
+
298
+
299
+ def spline_order(interpolation_method: str) -> int:
300
+ """Determine interpolation order from method."""
301
+
302
+ if interpolation_method == InterpolationMethod.NEAREST_NEIGHBOR:
303
+ return 0
304
+
305
+ if interpolation_method == InterpolationMethod.BILINEAR:
306
+ return 1
307
+
308
+ return 3
309
+
310
+
311
+ def apply_resize(
312
+ im_pixel_data: ImageAny,
313
+ im_mask: ImageGrayscaleMask,
314
+ im_dimensions: int,
315
+ im_crop_mask: Optional[ImageGrayscaleMask],
316
+ size_method: str,
317
+ resizing_factor_x: float,
318
+ resizing_factor_y: float,
319
+ resizing_factor_z: Optional[float],
320
+ use_manual_or_image: DimensionMethod,
321
+ specific_width: Optional[int],
322
+ specific_height: Optional[int],
323
+ specific_planes: Optional[int],
324
+ reference_image_shape: Optional[Tuple[int, ...]] = None,
325
+ interpolation_method: str = "bilinear",
326
+ ) -> Tuple[ImageAny, ImageGrayscaleMask, Optional[ImageBinaryMask]]:
327
+
328
+ new_shape = resized_shape(
329
+ im_pixel_data,
330
+ im_dimensions,
331
+ size_method,
332
+ resizing_factor_x,
333
+ resizing_factor_y,
334
+ resizing_factor_z,
335
+ use_manual_or_image,
336
+ specific_width,
337
+ specific_height,
338
+ specific_planes,
339
+ reference_image_shape,
340
+ )
341
+
342
+ order = spline_order(interpolation_method)
343
+ im_volumetric = True if im_dimensions == 3 else False
344
+ im_multichannel = True if im_pixel_data.ndim > im_dimensions else False
345
+ if im_volumetric and im_multichannel:
346
+ output_pixels = numpy.zeros(new_shape.astype(int), dtype=im_pixel_data.dtype)
347
+
348
+ for idx in range(int(new_shape[-1])):
349
+ output_pixels[:, :, :, idx] = skimage.transform.resize(
350
+ im_pixel_data[:, :, :, idx],
351
+ new_shape[:-1],
352
+ order=order,
353
+ mode="symmetric",
354
+ )
355
+ else:
356
+ output_pixels = skimage.transform.resize(
357
+ im_pixel_data, new_shape, order=order, mode="symmetric"
358
+ )
359
+
360
+ if im_multichannel and len(new_shape) > im_dimensions:
361
+ new_shape = new_shape[:-1]
362
+
363
+ mask = skimage.transform.resize(im_mask, new_shape, order=0, mode="constant")
364
+
365
+ mask = skimage.img_as_bool(mask)
366
+
367
+ if im_crop_mask is not None:
368
+ cropping = skimage.transform.resize(
369
+ im_crop_mask, new_shape, order=0, mode="constant"
370
+ )
371
+
372
+ cropping = skimage.img_as_bool(cropping)
373
+ else:
374
+ cropping = None
375
+
376
+ return output_pixels, mask, cropping
377
+
378
+
224
379
  def get_threshold_robust_background(
225
380
  image: ImageGrayscale,
226
381
  lower_outlier_fraction: float = 0.05,
@@ -0,0 +1,50 @@
1
+ """Resize module core functionality.
2
+
3
+ This module contains the extracted resize functions that implement
4
+ the core image resizing algorithms.
5
+ """
6
+
7
+ from typing import Annotated, Optional, Tuple
8
+ from pydantic import Field, validate_call, ConfigDict
9
+
10
+ from cellprofiler_library.types import ImageGrayscaleMask, ImageAny, ImageBinary
11
+ from cellprofiler_library.functions.image_processing import apply_resize
12
+ from cellprofiler_library.opts.resize import ResizingMethod, DimensionMethod, InterpolationMethod
13
+
14
+
15
+ @validate_call(config=ConfigDict(arbitrary_types_allowed=True))
16
+ def resize_image(
17
+ im_pixel_data: Annotated[ImageAny, Field(description="Input image pixel data array")],
18
+ im_mask: Annotated[ImageGrayscaleMask, Field(description="Input image mask")],
19
+ im_dimensions: Annotated[int, Field(description="Number of spatial dimensions in the image", ge=2, le=3)],
20
+ im_crop_mask: Annotated[Optional[ImageBinary], Field(description="Image crop mask")],
21
+ size_method: Annotated[ResizingMethod, Field(description="Method for determining resize dimensions")],
22
+ resizing_factor_x: Annotated[float, Field(description="X-axis scaling factor", gt=0)],
23
+ resizing_factor_y: Annotated[float, Field(description="Y-axis scaling factor", gt=0)],
24
+ resizing_factor_z: Annotated[Optional[float], Field(description="Z-axis scaling factor", gt=0)],
25
+ use_manual_or_image: Annotated[DimensionMethod, Field(description="Method for specifying dimensions")],
26
+ specific_width: Annotated[Optional[int], Field(description="Specific width in pixels", ge=1)],
27
+ specific_height: Annotated[Optional[int], Field(description="Specific height in pixels", ge=1)],
28
+ specific_planes: Annotated[Optional[int], Field(description="Specific number of planes", ge=1)],
29
+ reference_image_shape: Annotated[Optional[Tuple[int, ...]], Field(description="Shape of reference image for dimensions")],
30
+ interpolation_method: Annotated[InterpolationMethod, Field(description="Interpolation method for resizing")],
31
+ ) -> Tuple[ImageAny, ImageGrayscaleMask, Optional[ImageBinary]]:
32
+ # Apply the resize operation using library
33
+ return apply_resize(
34
+ im_pixel_data,
35
+ im_mask,
36
+ im_dimensions,
37
+ im_crop_mask,
38
+ size_method,
39
+ resizing_factor_x,
40
+ resizing_factor_y,
41
+ resizing_factor_z,
42
+ use_manual_or_image,
43
+ specific_width,
44
+ specific_height,
45
+ specific_planes,
46
+ reference_image_shape,
47
+ interpolation_method,
48
+ )
49
+
50
+
@@ -0,0 +1,22 @@
1
+ """Resize module enums and configuration options."""
2
+
3
+ from enum import Enum
4
+
5
+
6
+ class ResizingMethod(str, Enum):
7
+ """Method for specifying resize dimensions."""
8
+ BY_FACTOR = "Resize by a fraction or multiple of the original size"
9
+ TO_SIZE = "Resize by specifying desired final dimensions"
10
+
11
+
12
+ class DimensionMethod(str, Enum):
13
+ """Method for specifying target dimensions when resizing to size."""
14
+ MANUAL = "Manual"
15
+ IMAGE = "Image"
16
+
17
+
18
+ class InterpolationMethod(str, Enum):
19
+ """Interpolation method for resize operation."""
20
+ NEAREST_NEIGHBOR = "Nearest Neighbor"
21
+ BILINEAR = "Bilinear"
22
+ BICUBIC = "Bicubic"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cellprofiler-library-nightly
3
- Version: 5.0.0.dev410
3
+ Version: 5.0.0.dev413
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>
@@ -68,6 +68,7 @@ Description-Content-Type: text/markdown
68
68
  License-File: LICENSE
69
69
  Requires-Dist: numpy<2,>=1.26.4
70
70
  Requires-Dist: scikit-image>=0.20.0
71
+ Requires-Dist: scikit-learn>=1.3.0
71
72
  Requires-Dist: scipy<1.11,>=1.9.1
72
73
  Requires-Dist: mahotas>=1.4.13
73
74
  Requires-Dist: centrosome>=1.3.0
@@ -40,6 +40,7 @@ cellprofiler_library/modules/_overlayobjects.py
40
40
  cellprofiler_library/modules/_overlayoutlines.py
41
41
  cellprofiler_library/modules/_reducenoise.py
42
42
  cellprofiler_library/modules/_removeholes.py
43
+ cellprofiler_library/modules/_resize.py
43
44
  cellprofiler_library/modules/_savecroppedobjects.py
44
45
  cellprofiler_library/modules/_threshold.py
45
46
  cellprofiler_library/modules/_watershed.py
@@ -59,6 +60,7 @@ cellprofiler_library/opts/morph.py
59
60
  cellprofiler_library/opts/objectsizeshapefeatures.py
60
61
  cellprofiler_library/opts/overlayoutlines.py
61
62
  cellprofiler_library/opts/removeholes.py
63
+ cellprofiler_library/opts/resize.py
62
64
  cellprofiler_library/opts/structuring_elements.py
63
65
  cellprofiler_library/opts/threshold.py
64
66
  cellprofiler_library_nightly.egg-info/PKG-INFO
@@ -1,5 +1,6 @@
1
1
  numpy<2,>=1.26.4
2
2
  scikit-image>=0.20.0
3
+ scikit-learn>=1.3.0
3
4
  scipy<1.11,>=1.9.1
4
5
  mahotas>=1.4.13
5
6
  centrosome>=1.3.0
@@ -9,7 +9,7 @@ readme = "README.md"
9
9
  requires-python = ">=3.9"
10
10
  keywords = [ "computer vision", "image analysis", "biology", "cell", "cellprofiler",]
11
11
  classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.9", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Image Recognition", "Topic :: Scientific/Engineering :: Image Processing", "Topic :: Scientific/Engineering",]
12
- dependencies = [ "numpy>=1.26.4,<2", "scikit-image>=0.20.0", "scipy>=1.9.1,<1.11", "mahotas>=1.4.13", "centrosome>=1.3.0", "matplotlib>=3.1.3,<4", "packaging>=20.0", "pydantic>=2.11.4",]
12
+ dependencies = [ "numpy>=1.26.4,<2", "scikit-image>=0.20.0", "scikit-learn>=1.3.0", "scipy>=1.9.1,<1.11", "mahotas>=1.4.13", "centrosome>=1.3.0", "matplotlib>=3.1.3,<4", "packaging>=20.0", "pydantic>=2.11.4",]
13
13
  dynamic = [ "version",]
14
14
  [[project.authors]]
15
15
  name = "Anne Carpenter"