欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python sitk.show()與imageJ結(jié)合使用常見的問題

 更新時(shí)間:2020年04月20日 10:23:17   作者:mostztzhang  
這篇文章主要介紹了python sitk.show()與imageJ結(jié)合使用常見的問題,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

在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)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論