python sitk.show()與imageJ結(jié)合使用常見的問題
在python中配置simpleITK時(shí),遇到了以下這個(gè)問題。
simpleITK已經(jīng)通過pip install安裝,但是sitk.show()功能無法正常使用,類似如下
實(shí)例代碼
import SimpleITK as sitk import sys import os example = sitk.ReadImage("filename") sitk.show(example)
在sitk.show()這一步會(huì)出現(xiàn)以下錯(cuò)誤
“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: [參數(shù)錯(cuò)誤。]”
原因是SimpleITK的圖像顯示功能是通過類似ITK-snap,ImageJ進(jìn)行實(shí)現(xiàn)的,所以在進(jìn)行sitk.show()之前,需要對(duì)此進(jìn)行設(shè)置才能正常實(shí)現(xiàn)。
這里參考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操作,另外的很簡單。
- 在環(huán)境變量里面添加SITK_SHOW_COMMAND ,以imageJ為例,路徑指向ImageJ-win64.exe
- 在環(huán)境變量中的path中添加%SITK_SHOW_COMMAND%
到此這篇關(guān)于python sitk.show()與imageJ結(jié)合使用常見的問題的文章就介紹到這了,更多相關(guān)sitk.show()結(jié)合imageJ內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- Python庫skimage繪制二值圖像代碼實(shí)例
- Python 實(shí)現(xiàn)Image和Ndarray互相轉(zhuǎn)換
- Python 實(shí)現(xiàn)將數(shù)組/矩陣轉(zhuǎn)換成Image類
- Python Pillow.Image 圖像保存和參數(shù)選擇方式
- Python 實(shí)現(xiàn)OpenCV格式和PIL.Image格式互轉(zhuǎn)
- 詳解python opencv、scikit-image和PIL圖像處理庫比較
- Python imageio讀取視頻并進(jìn)行編解碼詳解
- Python圖像處理模塊ndimage用法實(shí)例分析
- 在python image 中安裝中文字體的實(shí)現(xiàn)方法
- 解決Python3用PIL的ImageFont輸出中文亂碼的問題
相關(guān)文章
TensorFlow2.4完成Word2vec詞嵌入訓(xùn)練方法詳解
這篇文章主要為大家介紹了TensorFlow2.4完成Word2vec詞嵌入訓(xùn)練方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-11-11python?manage.py?createsuperuser運(yùn)行錯(cuò)誤問題解決
這篇文章主要介紹了python?manage.py?createsuperuser運(yùn)行錯(cuò)誤,本文給大家分享錯(cuò)誤復(fù)現(xiàn)及解決方案,感興趣的朋友一起看看吧2023-10-10在Python中實(shí)現(xiàn)替換字符串中的子串的示例
今天小編就為大家分享一篇在Python中實(shí)現(xiàn)替換字符串中的子串的示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-10-10Python 點(diǎn)擊指定位置驗(yàn)證碼破解的實(shí)現(xiàn)代碼
這篇文章主要介紹了Python 點(diǎn)擊指定位置驗(yàn)證碼破解的實(shí)現(xiàn)代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09利用Python實(shí)現(xiàn)RSA加密解密方法實(shí)例
過去幾天我一直在嘗試用Python實(shí)現(xiàn)RSA算法,下面這篇文章主要給大家介紹了關(guān)于利用Python實(shí)現(xiàn)RSA加密解密的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-04-04