microfilm package
Contents
microfilm package¶
Submodules¶
microfilm.colorify module¶
- microfilm.colorify.check_input(images, is_volume=False)¶
Converts input, either 2D (3D if is_volume) array, list of 2D (3D) arrays or 3D (4D) array of size DxNxM (DxZxNxM) where D<4 to list of 2D (3D) arrays.
- microfilm.colorify.check_rescale_type(rescale_type, limits)¶
Adjust rescale_type depending on its own value and that of limits
- microfilm.colorify.cmaps_def(cmap_name, num_colors=256, flip_map=False)¶
Return a colormap defined by its name
- Parameters
cmap_name (str) – {‘pure_red’, ‘pure_green’, ‘pure_blue’, ‘pure_magenta’, ‘pure_cyan’, ‘pure_yellow’} or Matplotlib colormap
num_colors (int) – number of steps in color scale
flip_map (bool) – invert colormap
- Returns
cmap
- Return type
Matplotlib colormap
- microfilm.colorify.color_translate(cmap_name)¶
- microfilm.colorify.colorify_by_cmap(image, cmap, rescale_type='min_max', limits=None)¶
Directly use an existing colormap cmap to colorize an image
- Parameters
image (2d array) – image to convert to RGB
cmap (Matplotlib cmap) – colormap to use for coloring
rescale_type (str) – ‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
limits (list) – [min, max] limits to use for rescaling
- Returns
image_colored (array) – 3D RGB float array
min_max (tuple) – actual min and max values used for rescaling
- microfilm.colorify.colorify_by_hex(image, cmap_hex='#ff6600', flip_map=False, rescale_type='min_max', limits=None, num_colors=256)¶
Return 2D image as 3D RGB stack colored with a hex color.
- Parameters
image (2d array) – image to convert to RGB
cmap_hex (str) – hex string defining color, default ‘#ff6600’
flip_map (bool) – invert colormap
rescale_type (str) – ‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
limits (list) – [min, max] limits to use for rescaling
num_colors (int) – number of steps in color scale
- Returns
image_colored (array) – 3D RGB float array
cmap (Matplotlib colormap object) – Generated colormap from name
min_max (tuple) – actual min and max values used for rescaling
- microfilm.colorify.colorify_by_name(image, cmap_name, flip_map=False, rescale_type='min_max', limits=None, num_colors=256)¶
Return 2D image as 3D RGB stack colored with a given colormap.
- Parameters
image (2d array) – image to convert to RGB
cmap_name (str) – {‘pure_red’, ‘pure_green’, ‘pure_blue’, ‘pure_magenta’, ‘pure_cyan’, ‘pure_yellow’} or Matplotlib colormap
flip_map (bool) – invert colormap
rescale_type (str) – ‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
limits (list) – [min, max] limits to use for rescaling
num_colors (int) – number of steps in color scale
- Returns
image_colored (array) – 3D RGB float array
cmap (Matplotlib colormap object) – Generated colormap from name
min_max (tuple) – actual min and max values used for rescaling
- microfilm.colorify.combine_image(images, proj_type='max', alpha=0.5)¶
Combine a list of 3D RGB arrays into a single RGB image. The combination is done via maximum or a sum projection or via alpha blending.
- Parameters
images (list of arrays) – list of 3d rgb(a) arrays
proj_type (str) – projection type of color combination max: maximum sum: sum projection, restricted to dtype range alpha: alpha blending
alpha (float) – transparency in range [0,1] of overlayed image(s) for proj_type == alpha
- Returns
im_combined – 3D RGB array
- Return type
array
- microfilm.colorify.multichannel_to_rgb(images, cmaps=None, flip_map=False, rescale_type='min_max', limits=None, num_colors=256, proj_type='max', alpha=0.5, cmap_objects=None)¶
Convert a list of images to a single RGB image. Options can be passed as lists, one per channel, or as single element in which case the same value is used for all channel.
- Parameters
images (list or array) – list of 2d arrays or DxMxN array where D<4
cmaps (list of str / Matplotlib colormaps) – colormap as names (e.g. ‘pure_red’ as specified in cmaps_def) or directly as Matplotlib colormaps (e.g. as returned by cmaps_def)
flip_map (bool or list of bool) – invert colormap or not
rescale_type (str or list of str) – ‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
limits (list or list of lists) – [min, max] limits to use for rescaling
num_colors (int) – number of steps in color scale
proj_type (str) – projection type of color combination max: maximum sum: sum projection, restricted to dtype range alpha: alpha blending
alpha (float) – transparency in range [0,1] of overlayed image for proj_type == alpha
cmap_objects (list) – list of Matplotlib cmaps, one per channel to use for coloring if provided, no colormaps are computed and cmap names are ignored
- Returns
converted (2d array) – multi-channel RGB image
cmap_objects (list) – list of Matplotlib cmaps generated for each channel
image_min_max (list of tuples) – actual (min, max) values used for rescaling for each image
- microfilm.colorify.project_volume(images, proj_type)¶
Project a list of 3D images to a list of 2D images
- Parameters
images (list of arrays) – list of 3d arrays of shape ZxNxM
proj_type (str) – projection type for volume max: maximum min: minimum sum: sum mean: mean
- Returns
images_proj – projected arrays
- Return type
list of 2D arrays (float32)
- microfilm.colorify.random_cmap(alpha=0.5, num_colors=256)¶
Create random colormap for segmentation
- microfilm.colorify.random_grandient_cmap(num_colors=25, seed=42)¶
Create a colormap as the gradient of a given random color
- microfilm.colorify.rescale_image(image, rescale_type='min_max', limits=None)¶
Rescale the image between 0-1 according to a rescaling type.
- Parameters
image (2d array) – image to scale
rescale_type (str) – ‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
limits (list) – [min, max] limits to use for rescaling
- Returns
image_rescaled (2d array)
min_max (tuple) – actual min and max values used for rescaling
microfilm.microanim module¶
- class microfilm.microanim.Microanim(data, channels=None, cmaps=None, flip_map=False, rescale_type=None, limits=None, num_colors=256, proj_type='max', alpha=0.5, volume_proj=None, channel_names=None, channel_label_show=False, channel_label_type='title', channel_label_size=0.05, scalebar_thickness=0.1, scalebar_unit_per_pix=None, scalebar_size_in_units=None, unit=None, scalebar_location='lower right', scalebar_color='white', scalebar_font_size=12, scalebar_kwargs=None, scalebar_font_properties=None, ax=None, fig_scaling=3, dpi=72, label_text=None, label_location='upper left', label_color='white', label_font_size=15, label_kwargs={}, cmap_objects=None, show_colorbar=False, show_plot=True)¶
Bases:
microfilm.microplot.Microimage
Class implementing an animation object. This object is a subclass of of the Microimage object and takes the same options. The main difference is that it takes a time-lapse dataset as obligatory parameter, not a simple image.
- add_time_stamp(unit, unit_per_frame, location='upper left', timestamp_size=15, timestamp_color='white', time_format='HH:MM:SS', time_stamp_kwargs={})¶
Add time-stamp to movie
- Parameters
unit (str) – unit of time ‘mmm’ millisecond, ‘SS’ seconds, ‘MM’ minute, ‘HH’ hours
unit_per_frame (int) – number of units per frame e.g. 5 for 5s steps
location (str or list) – position of the time-stamp on the image, can be ‘upper left’, ‘upper right’, ‘lower left’, ‘lower right’ or a list with xy coordinates [xpos, ypos] where 0 < xpos, ypos < 1
timestamp_size (int) – size of timestamp font
timestamp_color (str) – color of label
time_format (str) – How the time stamp should be represented. The string should contain the ‘HH’ for hours, ‘MM’ for minutes, ‘SS’ for seconds and ‘mmm’ for milliseconds
time_stamp_kwargs (dict) – additional options for label formatting passed to Matplotlib text object
- save_movie(movie_name, fps=20, quality=5, format=None)¶
- show()¶
Display animation object
- time_range(unit, unit_per_frame, num_step, time_format='HH:MM:SS:mmm')¶
Create string time-stamps with arbitrary formatting.
- Parameters
unit (str) – unit of time ‘mmm’ millisecond, ‘SS’ seconds, ‘MM’ minute, ‘HH’ hours
unit_per_frame (int) – number of units per frame e.g. 5 for 5s steps
num_steps (int) – number of steps
time_format (str) – How the time stamp should be represented. The string should contain the ‘HH’ for hours, ‘MM’ for minutes, ‘SS’ for seconds and ‘mmm’ for milliseconds
- update_animation(t)¶
Update animation to time t
- update_timeslider(change=None)¶
Update segmentation plot
- class microfilm.microanim.Microanimpanel(rows, cols, margin=0.01, figscaling=5, figsize=None, channel_label_size=0.05, label_line_space=0.2, **fig_kwargs)¶
Bases:
object
Class implementing a multi-panel animation. All animations should have the same number of time points.
- Parameters
rows (int) – number of rows
cols (int) – number of columns
margin (float) – fraction of figure size reserved for margins between plots
figscaling (float) – adjust the size of the figure without providing explicit size
figsize (float or list) – figure size, either square or rectangular
dpi (int) – dots per inches passed to plt.figure
channel_label_size (float) – font size for channel labels (fraction of figure)
label_line_space (float) – space between label lines in fraction of channel_label_size
fig_kwargs (parameters normally passed to plt.subplots()) –
- microanims¶
list of Microanim objects
- Type
list
- time_slider¶
time slider
- Type
ipywidget slider
- output¶
widget to display plot
- Type
ipywidget Output
- fig¶
figure containing the panel
- Type
Matplotlib figure object
- ax¶
list of Matplotlib axis objects
- Type
list
- ui¶
animation interface
- Type
ipywidgets box
- max_time¶
number of time points
- Type
int
- add_channel_label(channel_label_size=None, label_line_space=None)¶
Add channel labels to all plots and set their size
- add_element(pos, microanim, fig_update=True)¶
Add an animation object to a panel
- Parameters
pos (list) – i,j position of the plot in the panel
microanim (Microanim object) – object to add to panel
- save_movie(movie_name, fps=20, quality=5, format=None)¶
- update_animation(t)¶
Update all subplots
- update_timeslider(change=None)¶
Update segmentation plot
- microfilm.microanim.save_movie(anim_object, movie_name, fps=20, quality=5, format=None)¶
Save a movie
- Parameters
movie_name (str or path object) – where to save the movie
fps (int) – frames per second
quality (int) – quality of images (see imageio)
format (str) – format for export
microfilm.microplot module¶
- class microfilm.microplot.Microimage(images, cmaps=None, flip_map=False, rescale_type=None, limits=None, num_colors=256, proj_type='max', alpha=0.5, volume_proj=None, channel_names=None, channel_label_show=False, channel_label_type='title', channel_label_size=0.05, scalebar_thickness=0.02, scalebar_unit_per_pix=None, scalebar_size_in_units=None, unit=None, scalebar_location='lower right', scalebar_color='white', scalebar_font_size=12, scalebar_kwargs=None, scalebar_font_properties=None, ax=None, fig_scaling=3, dpi=72, label_text=None, label_location='upper left', label_color='white', label_font_size=15, label_kwargs={}, cmap_objects=None, show_colorbar=False)¶
Bases:
object
Class implementing the plot object. It is usually created by calling the microshow function but can also be used directly.
- Parameters
images (list or array) – list of 2d arrays or DxMxN array D<4
cmaps (list of str / Matplotlib colormaps or single str) – colormap can be provided as names (e.g. ‘pure_red’ as specified in cmaps_def) or directly as Matplotlib colormaps (e.g. as returned by cmaps_def) for single channel images, you can pass a single str instead of a list
flip_map (bool or list of bool) – invert colormap or not
rescale_type (str or list of str) – ‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
limits (list or list of lists) – [min, max] limits to use for rescaling
num_colors (int) – number of steps in color scale
proj_type (str) – projection type of color combination max: maximum sum: sum projection, restricted to dtype range
alpha (float) – transparency in range [0,1] of overlayed image for proj_type == alpha
volume_proj (str) – projection type for volume images None: no projection ‘max’: maximum projection ‘sum’: sum projection, restricted to dtype range ‘mean’: mean projection
channel_names (list) – list of channel names
channel_label_show (bool) –
channel_label_type (str) – ‘title’, ‘in_fig’
channel_label_size (float) – relative font size of channel label
scalebar_thickness (float) – fraction of height of scale bar
scalebar_unit_per_pix (float) – pixel scaling (e.g. 25um per pixel)
scalebar_size_in_units (float) – size of scale bar in true units
unit (str) – name of the scale unit
scalebar_location (str) – upper right, lower right etc.
scalebar_color (str) – color of scale bar
scalebar_font_size (int) – size of text, set to None for no text
scalebar_kwargs (dict) – additional keyword arguments for scalebar
scalebar_font_properties (dict) – font properties for scalebar text
ax (Matplotlib axis) – provide existing axis
fig_scaling (int) – control figure scaling
dpi (int) – dots per inches passed to plt.figure
label_text (str) – image label
label_location (str or list) – position of the label on the image, can be ‘upper left’, ‘upper right’, ‘lower left’, ‘lower right’ or a list with xy coordinates [xpos, ypos] where 0 < xpos, ypos < 1
label_color (str) – color of label
label_font_size (int) – size of label
label_kwargs (dict) – additional options for label formatting passed to Matplotlib text object
cmaps_object (list) – list of cmap objects for each channel if provided, cmap names are ignored
show_colorbar (bool) – show colorbar
- add_channel_labels(channel_names=None, channel_label_size=0.05)¶
Add the channel names color with the corresponding colormap as figure title
- Parameters
channel_names (list) – list of channel names, defaults to channel-1, channel-2 etc.
channel_label_size (float) – relative font size of label
- add_colorbar()¶
Add colorbar
- add_label(label_text, label_name='default', label_location='upper left', label_color='white', label_font_size=15, label_kwargs={})¶
Add a figure label to an image.
- Parameters
label_text (str) – image label
label_location (str or list) – position of the label on the image, can be ‘upper left’, ‘upper right’, ‘lower left’, ‘lower right’ or a list with xy coordinates [xpos, ypos] where 0 < xpos, ypos < 1
label_color (str) – color of label
label_font_size (int) – size of label
label_kwargs (dict) – additional options for label formatting passed to Matplotlib text object
- add_scalebar(unit, scalebar_size_in_units, scalebar_unit_per_pix, scalebar_thickness=0.02, scalebar_location='lower right', scalebar_color='white', scalebar_font_size=12, scalebar_kwargs=None, scalebar_font_properties=None)¶
Add scalebar to an image.
- Parameters
unit (str) – name of the scale unit
scalebar_size_in_units (float) – size of scale bar in true units
scalebar_unit_per_pix (float) – pixel scaling (e.g. 25um per pixel)
scalebar_thickness (float) – fraction of height of scale bar
scale_location (str) – upper right, lower left etc.
scalebar_color (str) – color of scale bar
scalebar_font_size (float) – relative size of text, set to None for no text
scalebar_kwargs (dict) – additional options for scalebar formatting passed
scalebar_font_properties (dict) – font properties for scalebar text
- savefig(*args, **kwargs)¶
Save the current figure.
Call signature:
savefig(fname, *, dpi='figure', format=None, metadata=None, bbox_inches=None, pad_inches=0.1, facecolor='auto', edgecolor='auto', backend=None, **kwargs )
The available output formats depend on the backend being used.
- Parameters
fname (str or path-like or binary file-like) –
A path, or a Python file-like object, or possibly some backend-dependent object such as matplotlib.backends.backend_pdf.PdfPages.
If format is set, it determines the output format, and the file is saved as fname. Note that fname is used verbatim, and there is no attempt to make the extension, if any, of fname match format, and no extension is appended.
If format is not set, then the format is inferred from the extension of fname, if there is one. If format is not set and fname has no extension, then the file is saved with :rc:`savefig.format` and the appropriate extension is appended to fname.
dpi (float or ‘figure’, default: :rc:`savefig.dpi`) – The resolution in dots per inch. If ‘figure’, use the figure’s dpi value.
format (str) – The file format, e.g. ‘png’, ‘pdf’, ‘svg’, … The behavior when this is unset is documented under fname.
metadata (dict, optional) –
Key/value pairs to store in the image metadata. The supported keys and defaults depend on the image format and backend:
’png’ with Agg backend: See the parameter
metadata
of ~.FigureCanvasAgg.print_png.’pdf’ with pdf backend: See the parameter
metadata
of ~.backend_pdf.PdfPages.’svg’ with svg backend: See the parameter
metadata
of ~.FigureCanvasSVG.print_svg.’eps’ and ‘ps’ with PS backend: Only ‘Creator’ is supported.
bbox_inches (str or .Bbox, default: :rc:`savefig.bbox`) – Bounding box in inches: only the given portion of the figure is saved. If ‘tight’, try to figure out the tight bbox of the figure.
pad_inches (float, default: :rc:`savefig.pad_inches`) – Amount of padding around the figure when bbox_inches is ‘tight’.
facecolor (color or ‘auto’, default: :rc:`savefig.facecolor`) – The facecolor of the figure. If ‘auto’, use the current figure facecolor.
edgecolor (color or ‘auto’, default: :rc:`savefig.edgecolor`) – The edgecolor of the figure. If ‘auto’, use the current figure edgecolor.
backend (str, optional) – Use a non-default backend to render the file, e.g. to render a png file with the “cairo” backend rather than the default “agg”, or a pdf file with the “pgf” backend rather than the default “pdf”. Note that the default backend is normally sufficient. See the-builtin-backends for a list of valid backends for each file format. Custom backends can be referenced as “module://…”.
orientation ({'landscape', 'portrait'}) – Currently only supported by the postscript backend.
papertype (str) – One of ‘letter’, ‘legal’, ‘executive’, ‘ledger’, ‘a0’ through ‘a10’, ‘b0’ through ‘b10’. Only supported for postscript output.
transparent (bool) –
If True, the Axes patches will all be transparent; the Figure patch will also be transparent unless facecolor and/or edgecolor are specified via kwargs.
If False has no effect and the color of the Axes and Figure patches are unchanged (unless the Figure patch is specified via the facecolor and/or edgecolor keyword arguments in which case those colors are used).
The transparency of these patches will be restored to their original values upon exit of this function.
This is useful, for example, for displaying a plot on top of a colored background on a web page.
bbox_extra_artists (list of ~matplotlib.artist.Artist, optional) – A list of extra artists that will be considered when the tight bbox is calculated.
pil_kwargs (dict, optional) – Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.
- update(ax=None, copy=False)¶
Update the Microimage axis or create a new copy of the object with a new axis and figure.
- Parameters
ax (Matplotlib axis) – Matplotlib axis to use for plot
copy (bool) – create a new figure for plot, by default False
- Returns
microim – object is returned
- Return type
if a new plot object is created (copy==True), the
- class microfilm.microplot.Micropanel(rows, cols, margin=0.01, figscaling=5, figsize=None, channel_label_size=0.05, label_line_space=0.2, **fig_kwargs)¶
Bases:
object
Class implementing a panel object of multiple Microimage objects.
- Parameters
rows (int) – number of panel rows
cols (int) – number of panel columns
margin (float) – fraction of figure size reserved for margins between plots
figscaling (float) – adjust the size of the figure without providing explicit size
figsize (list) – figure size [x, y]
channel_label_size (float) – font size for channel labels (fraction of figure)
fig_kwargs (parameters normally passed to plt.subplots()) –
- fig¶
- Type
Matplotlib figure object
- ax¶
list of Matplotlib axis objects
- Type
list
- microplots¶
array of Microimage objects
- Type
2d array
- add_channel_label(channel_label_size=None, label_line_space=None)¶
Add channel labels to all plots and set their size
- add_element(pos, microim)¶
Add a microimage object to a panel
- Parameters
pos (list) – i,j position of the plot in the panel
microim (Microim object) – object to add to panel
- construct_figure()¶
Construct the figure
- savefig(*args, **kwargs)¶
Save the current figure.
Call signature:
savefig(fname, *, dpi='figure', format=None, metadata=None, bbox_inches=None, pad_inches=0.1, facecolor='auto', edgecolor='auto', backend=None, **kwargs )
The available output formats depend on the backend being used.
- Parameters
fname (str or path-like or binary file-like) –
A path, or a Python file-like object, or possibly some backend-dependent object such as matplotlib.backends.backend_pdf.PdfPages.
If format is set, it determines the output format, and the file is saved as fname. Note that fname is used verbatim, and there is no attempt to make the extension, if any, of fname match format, and no extension is appended.
If format is not set, then the format is inferred from the extension of fname, if there is one. If format is not set and fname has no extension, then the file is saved with :rc:`savefig.format` and the appropriate extension is appended to fname.
dpi (float or ‘figure’, default: :rc:`savefig.dpi`) – The resolution in dots per inch. If ‘figure’, use the figure’s dpi value.
format (str) – The file format, e.g. ‘png’, ‘pdf’, ‘svg’, … The behavior when this is unset is documented under fname.
metadata (dict, optional) –
Key/value pairs to store in the image metadata. The supported keys and defaults depend on the image format and backend:
’png’ with Agg backend: See the parameter
metadata
of ~.FigureCanvasAgg.print_png.’pdf’ with pdf backend: See the parameter
metadata
of ~.backend_pdf.PdfPages.’svg’ with svg backend: See the parameter
metadata
of ~.FigureCanvasSVG.print_svg.’eps’ and ‘ps’ with PS backend: Only ‘Creator’ is supported.
bbox_inches (str or .Bbox, default: :rc:`savefig.bbox`) – Bounding box in inches: only the given portion of the figure is saved. If ‘tight’, try to figure out the tight bbox of the figure.
pad_inches (float, default: :rc:`savefig.pad_inches`) – Amount of padding around the figure when bbox_inches is ‘tight’.
facecolor (color or ‘auto’, default: :rc:`savefig.facecolor`) – The facecolor of the figure. If ‘auto’, use the current figure facecolor.
edgecolor (color or ‘auto’, default: :rc:`savefig.edgecolor`) – The edgecolor of the figure. If ‘auto’, use the current figure edgecolor.
backend (str, optional) – Use a non-default backend to render the file, e.g. to render a png file with the “cairo” backend rather than the default “agg”, or a pdf file with the “pgf” backend rather than the default “pdf”. Note that the default backend is normally sufficient. See the-builtin-backends for a list of valid backends for each file format. Custom backends can be referenced as “module://…”.
orientation ({'landscape', 'portrait'}) – Currently only supported by the postscript backend.
papertype (str) – One of ‘letter’, ‘legal’, ‘executive’, ‘ledger’, ‘a0’ through ‘a10’, ‘b0’ through ‘b10’. Only supported for postscript output.
transparent (bool) –
If True, the Axes patches will all be transparent; the Figure patch will also be transparent unless facecolor and/or edgecolor are specified via kwargs.
If False has no effect and the color of the Axes and Figure patches are unchanged (unless the Figure patch is specified via the facecolor and/or edgecolor keyword arguments in which case those colors are used).
The transparency of these patches will be restored to their original values upon exit of this function.
This is useful, for example, for displaying a plot on top of a colored background on a web page.
bbox_extra_artists (list of ~matplotlib.artist.Artist, optional) – A list of extra artists that will be considered when the tight bbox is calculated.
pil_kwargs (dict, optional) – Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.
- microfilm.microplot.microshow(images=None, cmaps=None, flip_map=False, rescale_type=None, limits=None, num_colors=256, proj_type='max', alpha=0.5, volume_proj=None, channel_names=None, channel_label_show=False, channel_label_type='title', channel_label_size=0.05, scalebar_thickness=0.02, scalebar_unit_per_pix=None, scalebar_size_in_units=None, unit=None, scalebar_location='lower right', scalebar_color='white', scalebar_font_size=12, scalebar_kwargs=None, scalebar_font_properties=None, ax=None, fig_scaling=3, dpi=72, label_text=None, label_location='upper left', label_color='white', label_font_size=15, label_kwargs={}, cmap_objects=None, show_colorbar=False, microim=None)¶
Plot image
- Parameters
images (list or array) – list of 2d arrays or DxMxN array D<4
cmaps (list of str / Matplotlib colormaps or single str) – colormap can be provided as names (e.g. ‘pure_red’ as specified in cmaps_def) or directly as Matplotlib colormaps (e.g. as returned by cmaps_def) for single channel images, you can pass a single str instead of a list
flip_map (bool or list of bool) – invert colormap or not
rescale_type (str or list of str) – ‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
limits (list or list of lists) – [min, max] limits to use for rescaling
num_colors (int) – number of steps in color scale
proj_type (str) – projection type of color combination max: maximum sum: sum projection, restricted to dtype range alpha: alpa blending
alpha (float) – transparency in range [0,1] of overlayed image for proj_type == alpha
volume_proj (str) – projection type for volume images None: no projection ‘max’: maximum projection ‘sum’: sum projection, restricted to dtype range ‘mean’: mean projection
channel_names (list) – list of channel names
channel_label_show (bool) –
channel_label_type (str) – ‘title’, ‘in_fig’
channel_label_size (float) – relative font size for channel labels
scalebar_thickness (float) – fraction height of scale bar
scalebar_unit_per_pix (float) – pixel scaling (e.g. 25um per pixel)
scalebar_size_in_units (float) – size of scale bar in true units
unit (str) – name of the scale unit
scale_location (str) – upper right, lower left etc.
scalebar_color (str) – color of scale bar
scalebar_font_size (int) – size of text, set to None for no text
scalebar_kwargs (dict) – additional options for scalebar formatting passed
scalebar_font_properties (dict) – font properties for scalebar text
ax (Matplotlib axis) – provide existing axis
fig_scaling (int) – control figure scaling
dpi (int) – dots per inches passed to plt.figure
label_text (str) – image label
label_location (str or list) – position of the label on the image, can be ‘upper left’, ‘upper right’, ‘lower left’, ‘lower right’ or a list with xy coordinates [xpos, ypos] where 0 < xpos, ypos < 1
label_color (str) – color of label
label_font_size (int) – size of label
label_kwargs (dict) – additional options for label formatting passed to Matplotlib text object
cmap_objects (list) – list of Matplotlib colormaps to use for coloring if provided, the cmap names are ignored
show_colorbar (bool) – show colorbar
microim (Microimage object) – object to re-use
- Return type
Microimage object
- microfilm.microplot.volshow(images, volume_proj='mean', **kwargs)¶
Plot volume
- images: list or array
list of 2d arrays or DxMxN array D<4
- cmaps: list of str / Matplotlib colormaps or single str
colormap can be provided as names (e.g. ‘pure_red’ as specified in cmaps_def) or directly as Matplotlib colormaps (e.g. as returned by cmaps_def) for single channel images, you can pass a single str instead of a list
- flip_map: bool or list of bool
invert colormap or not
- rescale_type: str or list of str
‘min_max’: between extrema values of image ‘dtype’: full range of image dtype ‘zero_max’: between zero and image max ‘limits’: between limits given by parameter limits
- limits: list or list of lists
[min, max] limits to use for rescaling
- num_colors: int
number of steps in color scale
- proj_type: str
projection type of color combination max: maximum sum: sum projection, restricted to dtype range alpha: alpa blending
- alpha: float
transparency in range [0,1] of overlayed image for proj_type == alpha
- volume_proj: str
projection type for volume images None: no projection ‘max’: maximum projection ‘sum’: sum projection, restricted to dtype range ‘mean’: mean projection
- channel_names: list
list of channel names
channel_label_show: bool channel_label_type: str
‘title’, ‘in_fig’
- channel_label_size: float
relative font size for channel labels
- scalebar_thickness: float
fraction height of scale bar
- scalebar_unit_per_pix: float
pixel scaling (e.g. 25um per pixel)
- scalebar_size_in_units: float
size of scale bar in true units
- unit: str
name of the scale unit
- scale_location: str
upper right, lower left etc.
- scalebar_color: str
color of scale bar
- scalebar_font_size: int
size of text, set to None for no text
- scalebar_kwargs: dict
additional options for scalebar formatting passed
- scalebar_font_properties: dict
font properties for scalebar text
- ax: Matplotlib axis
provide existing axis
- fig_scaling: int
control figure scaling
- dpi: int
dots per inches passed to plt.figure
- label_text: str
image label
- label_location: str or list
position of the label on the image, can be ‘upper left’, ‘upper right’, ‘lower left’, ‘lower right’ or a list with xy coordinates [xpos, ypos] where 0 < xpos, ypos < 1
- label_color: str
color of label
- label_font_size: int
size of label
- label_kwargs: dict
additional options for label formatting passed to Matplotlib text object
- cmap_objects: list
list of Matplotlib colormaps to use for coloring if provided, the cmap names are ignored
- show_colorbar: bool
show colorbar
- microim: Microimage object
object to re-use
Microimage object