napari_ndev.image_overview
#
Function and class to create and manage image overviews with stackview.
It includes a function image_overview
to generate an overview of images
and a class ImageOverview
to generate and save image overviews.
ImageOverview
#
A class for generating and saving image overviews.
Use this class to prevent a memory leak otherwise generated by the image_overview() function when show=True. For some reason, preventing the memory leak requires the use of a class instead of a function, and show=False.
Source code in src/napari_ndev/image_overview.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
__init__
#
__init__(image_sets, xscale=3, yscale=3, image_title='', show=False)
Initialize an ImageOverivew object.
Parameters:
-
image_sets
#list of dict
) –A list of dictionaries containing image sets. See
napari_ndev.image_overview
for more information. -
xscale
#float
, default:3
) –The scale factor for the x-axis. Default is 3.
-
yscale
#float
, default:3
) –The scale factor for the y-axis. Default is 3.
-
image_title
#str
, default:''
) –The title of the image overview. Default is an empty string.
-
show
#bool
, default:False
) –Whether to display the generated overview. Default is False. Prevents memory leak when False.
Source code in src/napari_ndev/image_overview.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
save
#
save(directory=None, filename=None)
Save the generated image overview with matplotlib.savefig.
Parameters:
-
directory
#str
, default:None
) –The directory to save the image overview. If not provided, the current directory will be used.
-
filename
#str
, default:None
) –The filename of the saved image overview. If not provided, a default filename will be used.
Source code in src/napari_ndev/image_overview.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
image_overview
#
image_overview(image_sets, xscale=3, yscale=3, plot_title='')
Create an overview of images.
Parameters:
-
image_sets
#list of dict
) –A list of dictionaries, each containing an image set. Each image set should be a dictionary containing the following keys: - image (list): A list of images to display. - title (list of str, optional): The title of the image set. - colormap (list of str, optional): The colormap to use. "labels" will display the image as labels. - labels (list of bool, optional): Whether to display labels. - **kwargs: Additional keyword arguments to pass to stackview.imshow.
-
xscale
#float
, default:3
) –The x scale of the overview. Defaults to 3.
-
yscale
#float
, default:3
) –The y scale of the overview. Defaults to 3.
-
plot_title
#str
, default:''
) –The title of the plot. Defaults to an empty string.
Returns:
-
fig
(Figure
) –The matplotlib figure object containing the image overview.
Source code in src/napari_ndev/image_overview.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|