SimpleITK如何使用imagej進行圖像顯示

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章