SimpleITK如何使用imagej进行图像显示

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/PiaoLiangHXD/article/details/75009671
            </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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值