python sitk.show()与imageJ结合使用常见的问题


Posted in Python onApril 20, 2020

在python中配置simpleITK时,遇到了以下这个问题。

simpleITK已经通过pip install安装,但是sitk.show()功能无法正常使用,类似如下

实例代码

import SimpleITK as sitk
import sys
import os
example = sitk.ReadImage("filename")
sitk.show(example)

在sitk.show()这一步会出现以下错误

“Traceback (most recent call last):
File "", line 1, in 
sitk.Show(image)
File "C:\Python27\lib\site-packages\SimpleITK.py", line 4158, in Show
return _SimpleITK.Show(*args, **kwargs)
RuntimeError: Exception thrown in SimpleITK Show: ............\Build\ITK\SimpleITK-0.7.1\Code\IO\src\sitkShow.cxx:463:
 
sitk::ERROR: Error in administrating child process: [参数错误。]”

原因是SimpleITK的图像显示功能是通过类似ITK-snap,ImageJ进行实现的,所以在进行sitk.show()之前,需要对此进行设置才能正常实现。

这里参考stack overflow别人给的意见https://stackoverflow.com/questions/43215774/can-not-linksimpleitkshow-with-fiji

ImageJ Installation

Go to https://imagej.nih.gov/ij/download.html

Make sure to download the bundled with 64-bit Java 1.8.0_112 version

ImageJ Setup

Go to https://imagej.nih.gov/ij/plugins/nifti.html

Download nifti_io.jar

Go to C:\blah\blah\ImageJ\plugins\Input-Output

Delete the existing nifti_io.jar file from the folder

Copy the downloaded nifti_io.jar file into the folder

Restart ImageJ and check if File -> Import -> NIfTI-Analyze is there

If it is there, the plugin was successfully installed

SimpleITK Setup

Find the path where your ImageJ.exe file exists

Open cmd

Type in setx SITK_SHOW_COMMAND "C:\blah\blah\ImageJ\ImageJ.exe"

You should get the message SUCCESS: Specified value was saved

Check if everything works

Restart your text editor or IDE (if it was already open)

Run your code

​​​​​​除了下载ImageJ操作,另外的很简单。

  • 在环境变量里面添加SITK_SHOW_COMMAND ,以imageJ为例,路径指向ImageJ-win64.exe
  • 在环境变量中的path中添加%SITK_SHOW_COMMAND%

到此这篇关于python sitk.show()与imageJ结合使用常见的问题的文章就介绍到这了,更多相关sitk.show()结合imageJ内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Python 相关文章推荐
python中使用mysql数据库详细介绍
Mar 27 Python
python中将函数赋值给变量时需要注意的一些问题
Aug 18 Python
Django视图之ORM数据库查询操作API的实例
Oct 27 Python
Python实现备份MySQL数据库的方法示例
Jan 11 Python
Python装饰器原理与简单用法实例分析
Apr 29 Python
在python中创建指定大小的多维数组方式
Nov 28 Python
Python如何实现在字符串里嵌入双引号或者单引号
Mar 02 Python
如何实现更换Jupyter Notebook内核Python版本
May 18 Python
pandas 像SQL一样使用WHERE IN查询条件说明
Jun 05 Python
python代码区分大小写吗
Jun 17 Python
运行Python编写的程序方法实例
Oct 21 Python
详解Python 中的 defaultdict 数据类型
Feb 22 Python
使用Python对Dicom文件进行读取与写入的实现
Apr 20 #Python
python 错误处理 assert详解
Apr 20 #Python
解决Jupyter Notebook使用parser.parse_args出现错误问题
Apr 20 #Python
在ipython notebook中使用argparse方式
Apr 20 #Python
Python绘制全球疫情变化地图的实例代码
Apr 20 #Python
spyder 在控制台(console)执行python文件,debug python程序方式
Apr 20 #Python
python实现小程序推送页面收录脚本
Apr 20 #Python
You might like
用PHP动态创建Flash动画
2006/10/09 PHP
php堆排序(heapsort)练习
2013/11/13 PHP
ThinkPHP快速入门实例教程之数据分页
2014/07/01 PHP
PHP处理postfix邮件内容的方法
2015/06/16 PHP
PHP多维数组转一维数组的简单实现方法
2015/12/23 PHP
php插入含有特殊符号数据的处理方法
2016/11/24 PHP
php大小写转换函数(strtolower、strtoupper)用法介绍
2017/11/17 PHP
jQuery 学习6 操纵元素显示效果的函数
2010/02/07 Javascript
artDialog 4.1.5 Dreamweaver代码提示/补全插件 附下载
2012/07/31 Javascript
jquery插件jquery倒计时插件分享
2013/12/27 Javascript
详细分析JavaScript函数定义
2015/07/16 Javascript
实例代码详解jquery.slides.js
2015/11/16 Javascript
Three.js学习之文字形状及自定义形状
2016/08/01 Javascript
Angular.js ng-file-upload结合springMVC的使用教程
2017/07/10 Javascript
判断div滑动到底部的scroll实例代码
2017/11/15 Javascript
vue todo-list组件发布到npm上的方法
2018/04/04 Javascript
js点击事件的执行过程实例分析【冒泡与捕获】
2020/04/11 Javascript
Vue发布订阅模式实现过程图解
2020/04/30 Javascript
[54:29]2018DOTA2亚洲邀请赛 4.7 淘汰赛 VP vs LGD 第二场
2018/04/09 DOTA
[54:54]Newbee vs Serenity 2018国际邀请赛小组赛BO2 第一场 8.17
2018/08/18 DOTA
Python提示[Errno 32]Broken pipe导致线程crash错误解决方法
2014/11/19 Python
python通过线程实现定时器timer的方法
2015/03/16 Python
深入解读Python解析XML的几种方式
2016/02/16 Python
python3+requests接口自动化session操作方法
2018/10/13 Python
Python: tkinter窗口屏幕居中,设置窗口最大,最小尺寸实例
2020/03/04 Python
解决Keras中循环使用K.ctc_decode内存不释放的问题
2020/06/29 Python
使用Python Tkinter实现剪刀石头布小游戏功能
2020/10/23 Python
CSS实现圆形放大镜狙击镜效果 只有圆圈里的放大
2012/12/10 HTML / CSS
h5页面背景图很长要有滚动条滑动效果的实现
2021/01/27 HTML / CSS
中国跨境在线时尚零售商:Bellelily
2018/04/06 全球购物
自我评价的写作规则
2014/01/06 职场文书
大学生考试作弊检讨书1000字
2014/10/14 职场文书
社区敬老月活动总结
2015/05/07 职场文书
python 常用的异步框架汇总整理
2021/06/18 Python
Python制作表白爱心合集
2022/01/22 Python
Nginx 匹配方式
2022/05/15 Servers