from skimage.exposure import rescale_intensity
import matplotlib.pyplot as plt
def gray2color(u,channel):
"""
Compute color image from intensity in fluorescence in a given channel.
Arguments:
-----------
u: np.ndarray
Input fluorescence image (2D).
channel: int
Channel to code the image in (0: Red, 1: Green, 2: Blue).
Returns:
-----------
u_color: np.ndarray
The computed output image in color.
"""
u_color = np.dstack((
rescale_intensity(u if channel==0 else np.zeros_like(u), out_range='float'),
rescale_intensity(u if channel==1 else np.zeros_like(u), out_range='float'),
rescale_intensity(u if channel==2 else np.zeros_like(u), out_range='float'),
))
return u_color
def show_Green(img):
plt.imshow(gray2color(img,1))
plt.show()
plt.figure()
show_Green(inputImage)
Reference
https://www.jscholler.com/2020-04-20-Outer_segment_orientation/