stackview supports colormaps as defined in Matplotlib and aims at compatibility with microfilm.
import stackview
import numpy as np
from skimage.io import imread
image = imread("data/blobs.tif")
You can show images with colormaps such as pure_green
, pure_red
, pure_magenta_r
. The _r
by the end specifies that low values correspond to high intensity.
stackview.slice(image, colormap="pure_magenta_r")
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=254, width=256),)),)), IntSlider(value=127, de…
stackview.curtain(image, image, colormap="pure_green", curtain_colormap="pure_green_r")
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=254, width=256),)),)), IntSlider(value=127, de…
As imswitch()
shows a list (or dictionary) of images, you can also specify a list of colormaps.
stackview.switch(
[image, image, image],
colormap=["pure_magenta", "pure_green", "pure_cyan"]
)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=254, width=256),)),)), HBox(children=(Button(d…
You can also specify a single colormap for all images.
stackview.switch(
[image, image[::-1], image[:,::-1]],
colormap="pure_green"
)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=254, width=256),)),)), HBox(children=(Button(d…
stackview.crop(image, colormap='pure_green')
_Cropper(children=(IntRangeSlider(value=(0, 254), description='Y', max=254), IntRangeSlider(value=(0, 256), de…
labels = np.zeros_like(image, dtype=np.uint32)
labels[10:20, 10:20] = 1
stackview.annotate(image, labels, colormap="pure_magenta")
VBox(children=(HBox(children=(HBox(children=(VBox(children=(ImageWidget(height=254, width=256),)),)), VBox(chi…
def flip(image, flip_x:bool, flip_y:bool):
if flip_x:
image = image[...,::-1]
if flip_y:
image = image[::-1]
return image
stackview.interact(flip, image, colormap="pure_magenta")
VBox(children=(interactive(children=(Checkbox(value=False, description='flip_x'), Checkbox(value=False, descri…
mri = imread("data/Haase_MRT_tfl3d1.tif")
stackview.orthogonal(mri, colormap="pure_green")
HBox(children=(VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=160, width=160),)),)), IntSlide…
stackview.picker(mri, colormap="pure_green")
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=160, width=160),)),)), IntSlider(value=60, des…
One can also tune the display range by providing the minimum and maximum intensity that should be shown.
stackview.slice(image, display_max=100)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=254, width=256),)),)), IntSlider(value=127, de…
stackview.slice(image, display_min=50)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=254, width=256),)),)), IntSlider(value=127, de…
To overlay multi-channel images with defined colormaps per channel, you can also stackview.switch()
with toggleable=True
.
hela_cells = imread("data/hela-cells.tif")
stackview.switch(
{"lysosomes": hela_cells[:,:,0],
"mitochondria":hela_cells[:,:,1],
"nuclei": hela_cells[:,:,2]
},
colormap=["pure_magenta", "pure_green", "pure_blue"],
toggleable=True
)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=512, width=672),)),)), HBox(children=(ToggleBu…