Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ def _absorbance_to_image_int(absorbance, source_intensity, min_val, max_val):
rgb = cp.exp(-absorbance) * source_intensity
# prevent overflow/underflow
rgb = cp.minimum(cp.maximum(rgb, min_val), max_val)
return cp.round(rgb)
return cp.around(rgb)


@cp.fuse()
def _absorbance_to_image_uint8(absorbance, source_intensity):
rgb = cp.exp(-absorbance) * source_intensity
# prevent overflow/underflow
rgb = cp.minimum(cp.maximum(rgb, 0), 255)
return cp.round(rgb).astype(cp.uint8)
return cp.around(rgb).astype(cp.uint8)


def absorbance_to_image(absorbance, source_intensity=255, dtype=cp.uint8):
Expand Down
4 changes: 2 additions & 2 deletions python/cucim/src/cucim/skimage/feature/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ def match_template(image, template, pad_input=False, mode='constant',
[ 0., 0., 0., 0., -1., 0.],
[ 0., 0., 0., 0., 0., 0.]])
>>> result = match_template(image, template)
>>> cp.round(result, 3)
>>> cp.around(result, 3)
array([[ 1. , -0.125, 0. , 0. ],
[-0.125, -0.125, 0. , 0. ],
[ 0. , 0. , 0.125, 0.125],
[ 0. , 0. , 0.125, -1. ]])
>>> result = match_template(image, template, pad_input=True)
>>> cp.round(result, 3)
>>> cp.around(result, 3)
array([[-0.125, -0.125, -0.125, 0. , 0. , 0. ],
[-0.125, 1. , -0.125, 0. , 0. , 0. ],
[-0.125, -0.125, -0.125, 0. , 0. , 0. ],
Expand Down
4 changes: 2 additions & 2 deletions python/cucim/src/cucim/skimage/measure/_moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def moments_coords_central(coords, center=None, order=3):
point, this no longer holds:

>>> coords2 = cp.concatenate((coords, cp.array([[17, 17]])), axis=0)
>>> cp.round(moments_coords_central(coords2),
... decimals=2) # doctest: +NORMALIZE_WHITESPACE
>>> cp.around(moments_coords_central(coords2),
... decimals=2) # doctest: +NORMALIZE_WHITESPACE
array([[17. , 0. , 22.12, -2.49],
[ 0. , 3.53, 1.73, 7.4 ],
[25.88, 6.02, 36.63, 8.83],
Expand Down