if input_image.has_mask:
return centrosome.filter.stretch(input_image.pixel_data, input_image.mask)
else:
return centrosome.filter.stretch(input_image.pixel_data)
def manual_input_range(self, input_image, workspace):
"""Stretch the input image from the requested range to 0:1"""
After Change
def stretch(self, input_image):
data = input_image.pixel_data
mask = numpy.ones_like(data, dtype=numpy.bool)
if input_image.has_mask:
mask = input_image.mask
in_range = (min(data[mask]), max(data[mask]))
out_range = (0.0, 1.0)
data[~mask] = 0
rescaled = skimage.exposure.rescale_intensity(data, in_range=in_range, out_range=out_range)
rescaled[~mask] = input_image.pixel_data[~mask]
return rescaled
def manual_input_range(self, input_image, workspace):
"""Stretch the input image from the requested range to 0:1"""