import stackview
from skimage.io import imread, imshow
from skimage.filters import gaussian, threshold_otsu, sobel
from skimage.measure import label
image = imread('data/Haase_MRT_tfl3d1.tif')[:,80:120,:40]
stackview.insight(image)
|
|
When working with small images, the view may be suboptimal.
stackview.slice(image)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=40, width=40),)),)), IntSlider(value=60, conti…
Thus, you can provide a zoom_factor
.
stackview.slice(image, zoom_factor=10)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=400, width=400),)),)), IntSlider(value=60, con…
This also works with other tools such as the picker
.
stackview.picker(image, zoom_factor=10)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=400, width=400),)),)), IntSlider(value=60, con…
If you don't like the neareast-neighbor interpolation, you can also specify a higher order of the spline-interpolation used under the hood.
stackview.picker(image, zoom_factor=10, zoom_spline_order=3)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=400, width=400),)),)), IntSlider(value=60, con…
Some more zoomed views to check if stackview
tools work.
stackview.curtain(image, 256-image, zoom_factor=10, continuous_update=True)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=400, width=400),)),)), IntSlider(value=60, des…
blobs = imread('data/blobs.tif')
stackview.picker(label(blobs > 120), zoom_factor=2)
VBox(children=(HBox(children=(VBox(children=(ImageWidget(height=512, width=508),)),)), IntSlider(value=127, co…
stackview.side_by_side(blobs, label(blobs > 120), zoom_factor=0.5, continuous_update=True)
HBox(children=(HBox(children=(VBox(children=(ImageWidget(height=127, width=128),)),)), HBox(children=(VBox(chi…
def my_custom_code(image, sigma:float = 1, show_labels: bool = True):
sigma = abs(sigma)
blurred_image = gaussian(image, sigma=sigma)
binary_image = blurred_image > threshold_otsu(blurred_image)
edge_image = sobel(binary_image)
if show_labels:
return label(binary_image)
else:
return edge_image * image.max() + image
stackview.interact(my_custom_code, blobs, zoom_factor=2)
VBox(children=(interactive(children=(FloatSlider(value=1.0, continuous_update=False, description='sigma', max=…