iaf.color¶
Color functions.
- class iaf.color.Color(value)[source]¶
Bases:
EnumA few predefined colors.
- Blue = (0.0, 0.0, 1.0)¶
Blue = (0.0, 0.0, 1.0)
- Cyan = (0.0, 1.0, 1.0)¶
Cyan = (0.0, 1.0, 1.0)
- Gray = (1.0, 1.0, 1.0)¶
Gray = (1.0, 1.0, 1.0)
- Green = (0.0, 1.0, 0.0)¶
Green = (0.0, 1.0, 0.0)
- Orange = (1.0, 0.5, 0.0)¶
Orange = (1.0, 0.5, 0.0)
- Red = (1.0, 0.0, 0.0)¶
Red = (1.0, 0.0, 0.0)
- Yellow = (1.0, 1.0, 0.0)¶
Yellow = (1.0, 1.0, 0.0)
- iaf.color.get_hilo_cmap(n: int = 256) ListedColormap[source]¶
Return the HiLo colormap that shows pixels at 0 intensity as blue and saturated pixels as red.
- Parameters:
n (int) – Number of different colors (optional, default 256). Use 256 for 8-bit images and 65535 for 16-bit images.
- Returns:
colormap – Colormap to be passed to imshow() and other matplotlib functions that take colormaps.
- Return type:
ListedColormap
- iaf.color.get_labels_cmap(n: int = 256) ListedColormap[source]¶
Return a color map that is particularly suited to color-code labels.
- Parameters:
n (int) – Number of different colors (optional, default 256). Use 256 for 8-bit images and 65535 for 16-bit images.
- Returns:
colormap – Colormap to be passed to imshow() and other matplotlib functions that take colormaps.
- Return type:
ListedColormap
- iaf.color.to_composite(images: list[ndarray], colors: list[Color | list | tuple], clip_percentile: float = 0.1) ndarray[source]¶
Create a composite image from a series of gray values images and the corresponding colors.
- Parameters:
images (list[np.ndarray]) – List of gray-value images.
colors (list[Union[Color, list, tuple]]) – List of colors to be used to create a composite. One for each image. Each color is a Color, list or tuple with values for (R, G, B) between 0.0 and 1.0
clip_percentile (float) – Percentile to clip intensity in the low and high parts of the dynamic range.
- Returns:
composite – RGB composite image
- Return type:
np.ndarray