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常用模块介绍
Nov 21 Python
线程和进程的区别及Python代码实例
Feb 04 Python
python+Django+apache的配置方法详解
Jun 01 Python
python使用pyqt写带界面工具的示例代码
Oct 23 Python
Python中创建二维数组
Oct 17 Python
python ddt数据驱动最简实例代码
Feb 22 Python
python3中property使用方法详解
Apr 23 Python
Docker部署Python爬虫项目的方法步骤
Jan 19 Python
From CSV to SQLite3 by python 导入csv到sqlite实例
Feb 14 Python
使用scrapy ImagesPipeline爬取图片资源的示例代码
Sep 28 Python
Python Pandas list列表数据列拆分成多行的方法实现
Dec 14 Python
Python中常见的导入方式总结
May 06 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
盘点被央视点名过的日本动画电影 一部比一部强
2020/03/08 日漫
php把数据表导出为Excel表的最简单、最快的方法(不用插件)
2014/05/10 PHP
Yii CDBCriteria常用方法实例小结
2017/01/19 PHP
PHP自动补全表单的两种方法
2017/03/06 PHP
PHP学习记录之常用的魔术常量详解
2019/12/12 PHP
javascript encodeURI和encodeURIComponent的比较
2010/04/03 Javascript
node.js入门教程迷你书、node.js入门web应用开发完全示例
2014/04/06 Javascript
jQuery实现文件上传进度条特效
2015/08/12 Javascript
Jquery Ajax Error 调试错误的技巧
2015/11/20 Javascript
AngularJS控制器详解及示例代码
2016/08/16 Javascript
浅谈js对象的创建和对6种继承模式的理解和遐想
2016/10/16 Javascript
深入理解vue-loader如何使用
2017/06/06 Javascript
详解利用 Vue.js 实现前后端分离的RBAC角色权限管理
2017/09/15 Javascript
vue实现表格过滤功能
2019/09/27 Javascript
如何利用JavaScript编写更好的条件语句详解
2020/08/10 Javascript
使用webpack5从0到1搭建一个react项目的实现步骤
2020/12/16 Javascript
django 常用orm操作详解
2017/09/13 Python
Python实现使用卷积提取图片轮廓功能示例
2018/05/12 Python
Python Pillow Image Invert
2019/01/22 Python
python覆盖写入,追加写入的实例
2019/06/26 Python
python 数据提取及拆分的实现代码
2019/08/26 Python
python 函数的缺省参数使用注意事项分析
2019/09/17 Python
python爬虫数据保存到mongoDB的实例方法
2020/07/28 Python
Django filter动态过滤与排序实现过程解析
2020/11/26 Python
英国皇室御用百货:福南梅森(Fortnum & Mason)
2017/12/03 全球购物
拥有超过850家商店的美国在线派对商店:Party City
2018/10/21 全球购物
护理专业推荐信
2013/11/07 职场文书
工业自动化毕业生自荐信范文
2014/01/04 职场文书
党员学习十八大感想
2014/01/17 职场文书
外语系毕业生求职自荐信
2014/04/12 职场文书
党支部遵守党的政治纪律情况对照检查材料
2014/09/26 职场文书
个人四风对照检查材料
2014/09/26 职场文书
技术股份合作协议书
2014/10/05 职场文书
销售合作意向书范本
2015/05/08 职场文书
详解vue中v-for的key唯一性
2021/05/15 Vue.js
css height属性中的calc方法详解
2021/06/03 HTML / CSS