Merge pull request #1116 from rebeccaroisin/inplace_addition

Speed-up through in-place addition (closes gh-1089)
This commit is contained in:
Stefan van der Walt
2014-08-31 13:44:30 +01:00
+2 -1
View File
@@ -1127,7 +1127,8 @@ def separate_stains(rgb, conv_matrix):
>>> ihc = data.immunohistochemistry()
>>> ihc_hdx = separate_stains(ihc, hdx_from_rgb)
"""
rgb = dtype.img_as_float(rgb) + 2
rgb = dtype.img_as_float(rgb, force_copy=True)
rgb += 2
stains = np.dot(np.reshape(-np.log(rgb), (-1, 3)), conv_matrix)
return np.reshape(stains, rgb.shape)