</div>
<!--一个博主专栏付费入口-->
<!--一个博主专栏付费入口结束-->
<link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-4a3473df85.css">
<div id="content_views" class="markdown_views prism-atom-one-dark">
<!-- flowchart 箭头图标 勿删 -->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path>
</svg>
<h2 id="simpleitk-3d-image-visualization-on-windows-64-bit"><a name="t0"></a>SimpleITK 3D image visualization on Windows 64-bit</h2>
SimpleITK does not do visualization, it does contain a built in Show method. This function writes the image out to disk and then launches a program for visualization. By default it is configured to use ImageJ, because it is readily supports all the image types which SimpleITK has and load very quickly. However, it’s easily customizable by setting environment variables.
These are written in SimpleITK’s official tutorial on GitHub, 01 Image Basics.ipynb.
But in my case, when I run
sitk.Show(image)
- 1
I got a process error
Exception thrown in SimpleITK show: .../SimpleTIK/Code/IO/src/sitkShow.cxx:500:
sitk::ERROR:Error in administrating child process: [No such file or directory]
- 1
- 2
As I have installed ImageJ, the question is that SimpleITK could not find ImageJ to show images.
Reason
Here’s the source code. It appears that for windows the 64-bit program files directory is not searched. Only 32-bit Windows, Linux and Mac OS are listed.
Then to launch Show correctly, we should set environment path of ImageJ to Show.
Solution
System environment:
- Windows 10 64-bit
- Python 3.5.2 (Anaconda 4.2 64-bit)
- SimpleITK 1.0.0
- ImageJ bundled with 64-bit Java 1.8.0_112
Here’s the original answer from stackoverflow:
SimpleITK requires an external image viewer to display images (ImageJ, 3DSlicer, ITK-Snap, etc).
ImageJ Installation
- 1.Go to download ImageJ.
- 2.Make sure to download the bundled with 64-bit Java 1.8.0_112 version
ImageJ Setup
- 1.Go to download nifti.
- 2.Download nifti_io.jar
- 3.Go to \path-to-ImageJ\plugins\Input-Output
- 4.Delete the existing nifti_io.jar file from the folder
- 5.Copy the downloaded nifti_io.jar file into the folder
- 6.Restart ImageJ and check if File -> Import -> NIfTI-Analyze is there
- 7.If it is there, the plugin was successfully installed
SimpleITK Setup
- 1.Find the path where your ImageJ.exe file exists
- 2.Open cmd
- 3.Type in
setx SITK_SHOW_COMMAND "C:\blah\blah\ImageJ\ImageJ.exe"
- 4.You should get the message SUCCESS: Specified value was saved
Check if everything works
- 1.Restart your text editor or IDE (if it was already open)
- 2.Run your code
Then Show could run correctly and launch ImageJ to display your 3D image.
7/12/2017 1:48:35 PM