1. from skimage.exposure import rescale_intensity
  2. import matplotlib.pyplot as plt
  3. def gray2color(u,channel):
  4. """
  5. Compute color image from intensity in fluorescence in a given channel.
  6. Arguments:
  7. -----------
  8. u: np.ndarray
  9. Input fluorescence image (2D).
  10. channel: int
  11. Channel to code the image in (0: Red, 1: Green, 2: Blue).
  12. Returns:
  13. -----------
  14. u_color: np.ndarray
  15. The computed output image in color.
  16. """
  17. u_color = np.dstack((
  18. rescale_intensity(u if channel==0 else np.zeros_like(u), out_range='float'),
  19. rescale_intensity(u if channel==1 else np.zeros_like(u), out_range='float'),
  20. rescale_intensity(u if channel==2 else np.zeros_like(u), out_range='float'),
  21. ))
  22. return u_color
  23. def show_Green(img):
  24. plt.imshow(gray2color(img,1))
  25. plt.show()
  26. plt.figure()
  27. show_Green(inputImage)

Reference

https://www.jscholler.com/2020-04-20-Outer_segment_orientation/