MultichannelToRGB¶
- class MultichannelToRGB(color_dict=None)[source]¶
Class to convert multi-channel images to RGB images.
Initialize the MultichannelToRGB converter.
- Parameters:
Methods
Generate a set of visually distinct colors.
Validate the input color_dict on first read from image.
- __call__(image)[source]¶
Convert a multi-channel image to an RGB image.
- Parameters:
image (np.ndarray) – Input image of shape (H, W, N)
self (MultichannelToRGB)
- Returns:
RGB image of shape (H, W, 3)
- Return type:
np.ndarray
- generate_colors(n_channels)[source]¶
Generate a set of visually distinct colors.
- Parameters:
n_channels (int) – Number of channels/colors to generate
self (MultichannelToRGB)
- Returns:
Array of RGB colors
- Return type:
np.ndarray
- validate(n)[source]¶
Validate the input color_dict on first read from image.
Checks that n is either equal to the number of colors provided, or is one less. In the latter case it is assumed that the last channel is background autofluorescence and is not in the tiff and we will drop it from the color_dict with a warning.
- Parameters:
n (int) – Number of channels
self (MultichannelToRGB)
- Return type:
None