CellProfiler-nightly 5.0.0.dev313__py3-none-any.whl → 5.0.0.dev318__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/_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.dev313'
32
- __version_tuple__ = version_tuple = (5, 0, 0, 'dev313')
31
+ __version__ = version = '5.0.0.dev318'
32
+ __version_tuple__ = version_tuple = (5, 0, 0, 'dev318')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -25,7 +25,6 @@ See also
25
25
 
26
26
  See also **CorrectIlluminationCalculate**.
27
27
  """
28
-
29
28
  import numpy
30
29
  from cellprofiler_core.image import Image
31
30
  from cellprofiler_core.module import Module
@@ -37,9 +36,8 @@ from cellprofiler_core.setting.do_something import DoSomething
37
36
  from cellprofiler_core.setting.do_something import RemoveSettingButton
38
37
  from cellprofiler_core.setting.subscriber import ImageSubscriber
39
38
  from cellprofiler_core.setting.text import ImageName
40
-
41
- DOS_DIVIDE = "Divide"
42
- DOS_SUBTRACT = "Subtract"
39
+ from cellprofiler_library.opts.correctilluminationapply import Method
40
+ from cellprofiler_library.modules._correctilluminationapply import correct_illumination_apply
43
41
 
44
42
  ######################################
45
43
  #
@@ -58,7 +56,6 @@ RE_MATCH = "Match maximums"
58
56
 
59
57
  SETTINGS_PER_IMAGE = 4
60
58
 
61
-
62
59
  class CorrectIlluminationApply(Module):
63
60
  category = "Image Processing"
64
61
  variable_revision_number = 5
@@ -116,22 +113,22 @@ a future version of CellProfiler. You can export .mat format images as
116
113
 
117
114
  divide_or_subtract = Choice(
118
115
  "Select how the illumination function is applied",
119
- [DOS_DIVIDE, DOS_SUBTRACT],
120
- doc="""\
116
+ [Method.DIVIDE.value, Method.SUBTRACT.value],
117
+ doc=f"""\
121
118
  This choice depends on how the illumination function was calculated and
122
119
  on your physical model of the way illumination variation affects the
123
120
  background of images relative to the objects in images; it is also
124
121
  somewhat empirical.
125
122
 
126
- - *%(DOS_SUBTRACT)s:* Use this option if the background signal is
123
+ - *{Method.SUBTRACT.value}:* Use this option if the background signal is
127
124
  significant relative to the real signal coming from the cells. If you
128
125
  created the illumination correction function using
129
126
  *Background*, then you will want to choose
130
- *%(DOS_SUBTRACT)s* here.
131
- - *%(DOS_DIVIDE)s:* Choose this option if the signal to background
127
+ *{Method.SUBTRACT.value}* here.
128
+ - *{Method.DIVIDE.value}:* Choose this option if the signal to background
132
129
  ratio is high (the cells are stained very strongly). If you created
133
130
  the illumination correction function using *Regular*, then
134
- you will want to choose *%(DOS_DIVIDE)s* here.
131
+ you will want to choose *{Method.DIVIDE.value}* here.
135
132
  """
136
133
  % globals(),
137
134
  )
@@ -248,6 +245,9 @@ somewhat empirical.
248
245
  orig_image = workspace.image_set.get_image(image_name)
249
246
  illum_function = workspace.image_set.get_image(illum_correct_name)
250
247
  illum_function_pixel_data = illum_function.pixel_data
248
+ #
249
+ # Validate the illumination function
250
+ #
251
251
  if orig_image.pixel_data.ndim == 2:
252
252
  illum_function = workspace.image_set.get_image(
253
253
  illum_correct_name, must_be_grayscale=True
@@ -257,7 +257,6 @@ somewhat empirical.
257
257
  illum_function_pixel_data = illum_function_pixel_data[
258
258
  :, :, numpy.newaxis
259
259
  ]
260
- # Throw an error if image and illum data are incompatible
261
260
  if orig_image.pixel_data.shape[:2] != illum_function_pixel_data.shape[:2]:
262
261
  raise ValueError(
263
262
  "This module requires that the image and illumination function have equal dimensions.\n"
@@ -271,27 +270,16 @@ somewhat empirical.
271
270
  )
272
271
  )
273
272
  #
274
- # Either divide or subtract the illumination image from the original
273
+ # Apply the illumination function
275
274
  #
276
- if image.divide_or_subtract == DOS_DIVIDE:
277
- output_pixels = orig_image.pixel_data / illum_function_pixel_data
278
- elif image.divide_or_subtract == DOS_SUBTRACT:
279
- output_pixels = orig_image.pixel_data - illum_function_pixel_data
280
- output_pixels[output_pixels < 0] = 0
281
- else:
282
- raise ValueError(
283
- "Unhandled option for divide or subtract: %s"
284
- % image.divide_or_subtract.value
285
- )
286
-
287
- #
288
- # Optionally, clip high and low values
289
- #
290
- if self.truncate_low.value:
291
- output_pixels = numpy.where(output_pixels < 0, 0, output_pixels)
292
- if self.truncate_high.value:
293
- output_pixels = numpy.where(output_pixels > 1, 1, output_pixels)
294
-
275
+ output_pixels = correct_illumination_apply(
276
+ orig_image.pixel_data,
277
+ illum_function_pixel_data,
278
+ image.divide_or_subtract.value,
279
+ truncate_low=self.truncate_low.value,
280
+ truncate_high=self.truncate_high.value,
281
+ )
282
+
295
283
  #
296
284
  # Save the output image in the image set and have it inherit
297
285
  # mask & cropping from the original image.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CellProfiler-nightly
3
- Version: 5.0.0.dev313
3
+ Version: 5.0.0.dev318
4
4
  Summary: CellProfiler is a free open-source software designed to enable biologists without training in computer vision or programming to quantitatively measure phenotypes from thousands of images automatically.
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,6 +1,6 @@
1
1
  cellprofiler/__init__.py,sha256=AL2XeOBhIeYkBRyDd0QRgJan7j0DKjT1GD-RdzKvMUY,46
2
2
  cellprofiler/__main__.py,sha256=uy78oz5c6NBGRwDZkZ2Gl4HfhbJZQH6K1n54Qfl2OFc,38075
3
- cellprofiler/_version.py,sha256=X4VkWpCY3W1OoL-UO0Ujz6sOnuBoWBDUvHRgT9ivJRQ,721
3
+ cellprofiler/_version.py,sha256=VKwI68zHVxr7qKLpGyfYE5ws8C3HO1sHftyVZcFWLQk,721
4
4
  cellprofiler/knime_bridge.py,sha256=T6Op-KO79oULx92nGXRQ6lHsEcTutx1Uep1L4ZOKJgc,27767
5
5
  cellprofiler/misc.py,sha256=yqv873lP_mquxxkKcLgE_ZU4Hrc1trtuQ-NXLK2qQVc,553
6
6
  cellprofiler/data/examples/ExampleFly/ExampleFly.cppipe,sha256=JGZK9IZuYlOHOI4hi6a3DK36IahY69cfeLEd7eJ_rO0,15409
@@ -287,7 +287,7 @@ cellprofiler/modules/colortogray.py,sha256=RlFGmNxai_7vqtxprIceb0XILfdpm89c-DVBp
287
287
  cellprofiler/modules/combineobjects.py,sha256=N5cFbqAsGM11VuXdAlfr6L0AbnK0fxqB_Vb04C7ltOg,11043
288
288
  cellprofiler/modules/convertimagetoobjects.py,sha256=qgPb6xNuvELt_GOdkyHsaH2tdSDKtZGVMpNtVcV28sI,4700
289
289
  cellprofiler/modules/convertobjectstoimage.py,sha256=zvn2nlnF3-i6g16F0um1yNT-Y03e2j5AIueZtKbfkoc,7113
290
- cellprofiler/modules/correctilluminationapply.py,sha256=ijqdJHt1keYFvssff46O36BWyGP6uOhtekXBPi79vH8,16247
290
+ cellprofiler/modules/correctilluminationapply.py,sha256=eEcXliF2xNkT36Bo7xkNNh7l2YGbSqkqpss4O7RbwaM,15862
291
291
  cellprofiler/modules/correctilluminationcalculate.py,sha256=wJMCy3W9zK-xPI8PUvh25MLtE_JSI3QuVVzdLjuTwD4,54200
292
292
  cellprofiler/modules/createbatchfiles.py,sha256=a8R5PpbaQYqF8OIvWBuC0uh-yhjzBaU4Uni4m3MRLok,19512
293
293
  cellprofiler/modules/crop.py,sha256=Lg1cQCIzO7o8wcwEgRlsccdt8mgiiugowcNEe44vT0k,36039
@@ -374,9 +374,9 @@ cellprofiler/modules/plugins/segmentationtemplatewithdependencies.py,sha256=Sh76
374
374
  cellprofiler/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
375
375
  cellprofiler/utilities/morphology.py,sha256=8-81TrP8AmE3ETXIvQUKFD1vmKNBy2lfbc1QnM1eGIM,2685
376
376
  cellprofiler/utilities/rules.py,sha256=NoIHwFTA37zGvIP7vcB-aYeys0MDYVYxspfhLJe00OU,8790
377
- cellprofiler_nightly-5.0.0.dev313.dist-info/licenses/LICENSE,sha256=QLWaBS7kAioYx7PmJNXAMJaY8NODcFAag60YlUWuyz0,2276
378
- cellprofiler_nightly-5.0.0.dev313.dist-info/METADATA,sha256=MaaBNm0GqkDagvRVtGz09RSer5tfjcJx_6eEKsV3Yyk,6063
379
- cellprofiler_nightly-5.0.0.dev313.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
380
- cellprofiler_nightly-5.0.0.dev313.dist-info/entry_points.txt,sha256=MNDCjguFW3dKiS5Pcdu1NfWo4I0HHI3DekJLUJ4AKkY,60
381
- cellprofiler_nightly-5.0.0.dev313.dist-info/top_level.txt,sha256=bK7AacDeSj9qAmW8MGlO5wA79hDj6-ACt_mENUNKSIk,13
382
- cellprofiler_nightly-5.0.0.dev313.dist-info/RECORD,,
377
+ cellprofiler_nightly-5.0.0.dev318.dist-info/licenses/LICENSE,sha256=QLWaBS7kAioYx7PmJNXAMJaY8NODcFAag60YlUWuyz0,2276
378
+ cellprofiler_nightly-5.0.0.dev318.dist-info/METADATA,sha256=x_cH5kn90YFPhDW1njHHwH4IHwMxcUKR5bfXgxSIKvQ,6063
379
+ cellprofiler_nightly-5.0.0.dev318.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
380
+ cellprofiler_nightly-5.0.0.dev318.dist-info/entry_points.txt,sha256=MNDCjguFW3dKiS5Pcdu1NfWo4I0HHI3DekJLUJ4AKkY,60
381
+ cellprofiler_nightly-5.0.0.dev318.dist-info/top_level.txt,sha256=bK7AacDeSj9qAmW8MGlO5wA79hDj6-ACt_mENUNKSIk,13
382
+ cellprofiler_nightly-5.0.0.dev318.dist-info/RECORD,,