stitching_plots#
Plot functions and Layout/Alignment plot mixins for rigid and wobbly stitching.
Mixins are injected at runtime via @lazy_mixin, so matplotlib is never
imported on a headless cluster unless a plot method is actually called.
Standalone functions duck-type on layout / source / alignment objects and only
import from stitching_rigid / stitching_wobbly locally when they need to
construct helper objects.
- class AlignmentBasePlotMixin[source]#
Bases:
objectPlot methods for
AlignmentBase, injected via@lazy_mixin.
- class AlignmentPlotMixin[source]#
Bases:
AlignmentBasePlotMixinPlot methods for
Alignment.Overrides
plotto shift post by the computed displacement before overlaying.
- class LayoutPlotMixin[source]#
Bases:
objectPlot methods for
Layout, injected via@lazy_mixin.- plot(colors=None, percentile=98, normalize=True, color_ids=None, coordinate=None, axis=2)[source]#
Plots overlayed sources to check their placement.
Arguments
- colorslist of tuple of floats or color names
The optional RGB colors to use.
- percentileint
Use this percentile as upper cutoff in the resulting image to enhance contrast.
- normalizebool
If True normalize image to floats between 0 and 1.
- color_idslist of ints
Use specific color ids for the sources contributing to the layout.
- coordinateint or None
Optional coordinate at which to take a slice.
- axisint
Optional axis to take the slice in.
Returns
- imagearray
A color image.
- class WobblyAlignmentPlotMixin[source]#
Bases:
objectPlot methods for
WobblyAlignment, injected via@lazy_mixin.- overlay_mip_wobbly(overlap=True, mip_axis=None, percentile=98, normalize=True)[source]#
Colour MIP overlay of the wobbly alignment.
- class WobblyLayoutPlotMixin[source]#
Bases:
objectPlot methods for
WobblyLayout, injected via@lazy_mixin.
- layout_along_axis_mip(src1, src2, axis=2, depth=10, max_shifts=10, ranges=None, verbose=False)[source]#
Build a Layout from MIP-projected sources.
- layout_coloring(layout, colors=None, color_ids=None)[source]#
Assign colours to sources based on adjacency colouring.
- overlay_along_axis_mip(src1, src2, axis=2, depth=10, max_shifts=10, ranges=None, verbose=False, **kwargs)[source]#
Build a colour overlay of a MIP-projected alignment.
- overlay_layout(layout, colors=None, percentile=98, normalize=True, color_ids=None)[source]#
Build a colour-overlay array of all sources in a layout.
Arguments
- layoutLayout
The layout with the sources to overlay.
- colorslist of colours,
'ids', or None RGB colours, or
'ids'to return per-channel arrays.- percentileint
Upper cutoff percentile for contrast enhancement.
- normalizebool
Normalize to [0, 1] floats.
- color_idslist of int or None
Explicit colour index per source.
Returns
- imagearray
A colour image (or list of single-channel images when
colors='ids').
- overlay_sources(sources, colors=None, percentile=98, normalize=True)[source]#
Overlays the sources to check their placement.
Arguments
- sourceslist of Source
The sources to overlay.
- colorslist of tuple of floats or color names
The optional RGB colors to use.
- percentileint
Use this percentile as upper cutoff in the resulting image to enhance contrast.
- normalizebool
If True normalize image to floats between 0 and 1.
Returns
- imagearray
A color image.
- plot_alignments(alignments, sources=None, axes=None, annotate=True, min_quality=-inf, cmap=None)[source]#
Plot alignment edges coloured by quality.
- plot_along_axis_mip(src1, src2, axis=2, depth=10, max_shifts=10, ranges=None, verbose=False, **kwargs)[source]#
Plot a MIP-projected alignment.
- plot_layout(layout, colors=None, percentile=98, normalize=True, color_ids=None)[source]#
Overlays and plots sources in a layout to check alignment.
- ..Note::
For 2-D layouts uses matplotlib; for 3-D uses Plot3d.
Arguments
- layoutLayout class
The layout to use for plotting.
- colorslist of colors or None
The optional RGB colors to use.
- percentileint
Use this percentile as upper cutoff in the resulting image to enhance contrast.
- normalizebool
If True normalize image to floats between 0 and 1.
Returns
- imagearray
A color image of the overlayed sources.
- plot_regions(regions, sources=None, cmap=None, annotate=True, axes=None)[source]#
Overlays and plots regions to check the alignment.
Arguments
- regionslist of Region classes
The regions to plot.
- sourceslist of Source or None
Sources used for annotation ids.
- cmapcolormap
The color map to use to color the regions.
- annotatebool
Use annotation or not.
- plot_sources(sources, colors=None, percentile=98, normalize=True)[source]#
Overlays and plots sources in a layout to check alignment.
Arguments
- sourceslist of Source
The sources to overlay.
- colorslist of colors or None
The optional RGB colors to use.
- percentileint
Use this percentile as upper cutoff in the resulting image to enhance contrast.
- normalizebool
If True normalize image to floats between 0 and 1.
Returns
- imagearray
A color image of the overlayed sources.