Explore relationships between different parameters of an input function.

Using ParamGrid, we can map a function to the image and explore the interplay between different parameters of the function.

In the example below, we are using the median filter function on the input image pol and exploring how the pol image would look with different median filter size. The col parameter is set to "size" which means that the different size filters will be plotted along the column of the grid.

The function to be mapped can be any *callable function* that takes image data as its first input or one of the *implemented image filters* in seaborn-image (isns.implemented_filters())

import seaborn_image as isns
from scipy.ndimage import median_filter as median

isns.set_image(cmap="inferno") # set default colormap to inferno

# sample dataset
pol = isns.load_image("polymer")

g = isns.ParamGrid(pol, median, col="size", size=[3,4,5,7])
/home/docs/checkouts/ FutureWarning: --rc={'figure.dpi': 96} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> ... multiple times to add items to a dict.

We can also specify the col_wrap parameter to only have a grid of the specified size.

Below, 'median' passed as a string is looking through seaborn_image.implemented_filters() for the corresponding function. As a side note, these implemented_filters exist primarily for convenience and are generally the common filters one would use for typical image analysis.

g = isns.ParamGrid(pol, "median", col="size", size=[3,4,5,7], col_wrap=2)

We can specify different parameters across the row and col of the grid.

In the example below, we are plotting different percentile parameters across row and different size parameters across col for a percentile function applied to the input pol image.

g = isns.ParamGrid(pol,
                    percentile=[3, 5, 7, 10],
                    size=[3, 5, 7, 10]

We can also specify additional parameters that need to be passed to the input function. Here, mode=reflect is the additional parameter passed to the median filter function and is constant across all the different size parameters.

g = isns.ParamGrid(pol, "median", col="size", size=[2,3,4,5], mode="reflect")

We can also specify additional parameters for ParamGrid. Here, we are additionally specifying the parameters relevant for adding a scale bar (dx and units)

scale = {"dx" : 15, "units" : "nm"}

g = isns.ParamGrid(pol,