nanslice.slice_func module¶
slice_func.py
Functions for manipulating ‘slices’/images (or (X, Y, 3) arrays)
-
nanslice.slice_func.
blend
(img_under, img_over, img_alpha)[source]¶ Blend together two images using an alpha channel image
Parameters:
- img_under – The base image (underneath the overlay)
- img_over – The overlay image
- img_alpha – Transparency/alpha value to use when blending
-
nanslice.slice_func.
blur
(img, sigma=1)[source]¶ Blur an image with a Gaussian kernel
Parameters:
- img – The image to blur
- sigma – The FWHM of the Gaussian kernel, in voxels
-
nanslice.slice_func.
checkerboard
(img1, img2, square_size=16)[source]¶ Combine two images in a checkerboard pattern, useful for checking image registration quality. Idea stolen from @ramaana_ on Twitter
-
nanslice.slice_func.
colorize
(data, cmap, clims=None)[source]¶ Apply a colormap to grayscale data. Takes an (X, Y) array and returns an (X, Y, 3) array
Parameters:
- data – The 2D scalar (X, Y) array to colorize
- cmap – Any valid matplotlib colormap or colormap name
- clims – The limits for the colormap