首页 > 解决方案 > Jupyter 内核在尝试另存为 .VTP 文件时死机

问题描述

我正在尝试执行一个需要.VTP文件作为输入的 vmtkfunction,但我需要一个.VTP文件作为输出。但是,每次将输出文件位置指定为.VTP文件时,我都会收到一条错误消息,提示我的内核自动停止并需要重新启动。当运行相同的命令行但使用.vti文件作为输出时,笔记本工作并运行。但是,对于我要执行的下一个操作,我需要一个.vtp文件作为输入。

我的代码如下:

from vmtk import vmtkscripts

vmtk_image = vmtkscripts.vmtkImageReader() #load vmtkImageReader to read images
vmtk_image.InputFileName = 'input.vti'
vmtk_image.Execute() #actually executing of the file being read.

vmtk_to_numpy_image = vmtkscripts.vmtkImageToNumpy() 
vmtk_to_numpy_image.Image = vmtk_image.Image
vmtk_to_numpy_image.Execute()

vmtk_segmentation = vmtkscripts.vmtkLevelSetSegmentation() #import the LevelSetSegmentation function in jupyter notebook
vmtk_segmentation.Image = vmtk_to_numpy_image.Image #define which image has to be segmentated
vmtk_segmentation.LevelSetsOutputFileName = 'output.vtp'
vmtk_segmentation.Execute()
vmtk_segmentation.IOWrite()

vmtk_smoothing_surface = vmtkscripts.vmtkSurfaceSmoothing()
vmtk_smoothing_surface.SurfaceInputFileName = 'output.vtp'
vmtk_smoothing_surface.Execute()

标签: pythonjupyter-notebookjupyterimage-segmentation

解决方案


推荐阅读