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实现简单字典树的方法
Apr 29 Python
Python设计模式之命令模式简单示例
Jan 10 Python
python解决字符串倒序输出的问题
Jun 25 Python
浅谈Django的缓存机制
Aug 23 Python
python清除字符串前后空格函数的方法
Oct 21 Python
python实现微信自动回复及批量添加好友功能
Jul 03 Python
python实现邮件发送功能
Aug 10 Python
python创建学生管理系统
Nov 22 Python
Python调用.net动态库实现过程解析
Jun 05 Python
基于python实现生成指定大小txt文档
Jul 20 Python
使用Python Tkinter实现剪刀石头布小游戏功能
Oct 23 Python
python 实现百度网盘非会员上传超过500个文件的方法
Jan 07 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作为Shell脚本语言使用
2006/10/09 PHP
一个简单的自动发送邮件系统(二)
2006/10/09 PHP
PHP的面试题集
2006/11/19 PHP
Php获取金书网的书名的实现代码
2010/06/11 PHP
浅谈使用 PHP 进行手机 APP 开发(API 接口开发)
2014/08/11 PHP
php生成随机颜色方法汇总
2014/12/03 PHP
PHP 5.3和PHP 5.4出现FastCGI Error解决方法
2015/02/12 PHP
PHP基于堆栈实现的高级计算器功能示例
2017/09/15 PHP
javascript replace方法与正则表达式
2008/02/19 Javascript
event对象的方法 兼容多浏览器
2009/06/27 Javascript
防止登录页面出现在frame中js代码
2014/07/22 Javascript
javascript弹性运动效果简单实现方法
2016/01/08 Javascript
浅析JSONP技术原理及实现
2016/06/08 Javascript
JS正则表达式验证密码格式的集中情况总结
2017/02/23 Javascript
vue + vuex todolist的实现示例代码
2018/03/09 Javascript
nodejs实现百度舆情接口应用示例
2020/02/07 NodeJs
[00:27]DOTA2战队VP、Secret贺新春
2018/02/11 DOTA
[49:08]OpTic vs Serenity 2018国际邀请赛小组赛BO2 第一场 8.18
2018/08/19 DOTA
Python的字典和列表的使用中一些需要注意的地方
2015/04/24 Python
定制FileField中的上传文件名称实例
2017/08/23 Python
Python爬虫实现(伪)球迷速成
2018/06/10 Python
解决新django中的path不能使用正则表达式的问题
2018/12/18 Python
django框架使用方法详解
2019/07/18 Python
BeautifulSoup中find和find_all的使用详解
2020/12/07 Python
前端隐藏出边界内容的实现方法
2016/04/14 HTML / CSS
HTML5实时语音通话聊天MP3压缩传输3KB每秒
2019/08/28 HTML / CSS
澳大利亚宠物食品和用品商店:PETstock
2020/01/02 全球购物
瀑布模型都有哪些优缺点
2014/06/23 面试题
电脑教师的自我评价
2013/12/18 职场文书
校园活动策划书范文
2014/01/10 职场文书
大一新生学期自我评价
2014/04/09 职场文书
保密工作责任书
2014/04/16 职场文书
红旗渠导游词
2015/02/09 职场文书
爱国主义电影观后感
2015/06/18 职场文书
2019假期福利管理制度!
2019/07/15 职场文书
MySQL中JOIN连接的基本用法实例
2022/06/05 MySQL