简体   繁体   中英

Command won't stop running

I have the following piece of code

import skimage.color
import skimage.io
import skimage.viewer
import skimage.filters

fname = "/Users/harryhat/Desktop/Code/Experimental/Frames/frame00055.png"

# read image
image = skimage.io.imread(fname, as_gray=True)

# display the image
viewer = skimage.viewer.ImageViewer(image)
viewer.show()

However when I run the code, firstly the command won't stop running and secondly when I interrupt the command I have to restart the kernel to be able to type in the console. I was wondering why this would be the case / any other ways to do this. Any help would be much appreciated.

The skimage viewer is a Qt application. To run these in a notebook, you need to enable the Qt event loop integration by typing %gui qt in its own cell at the start of the notebook.

Just by the way, the scikit-image viewer is going to be deprecated. I recommend trying out https://napari.org as an alternative. (But the advice above still applies!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM