SimpleITK.Show() generates error in ImageJ on Linux

Viewed 3926

EDIT NOTE: This question was originally phrased as

How to link SimpleITK.Show() to imageJ in linux?

By upgrading SimpleITK 1.0.0 to 1.0.1, I was able to launch ImageJ from SimpleITK.Show(). However, ImageJ is unable to open "sample_mri.hdr". ImageJ generates the following error messages.

File is not in a supported format, a reader

plugin is not available, or it was not found.

root/local/linux/ImageJ/open("/temp/TempFile-7131-2.nii");

root/local/linux/ImageJ/rename("/temp/TempFile-7131-2.nii");

I have installed the appropriate plugins for ImageJ to read hdr/img (Analyze format). I can open "sample_mri.hdr" from ImageJ directly by going to file>open

debug messages:

sitk.Show(img, 'sample image', debugOn=True)

FindApplication search path: [ ./Fiji.app, /cis/home/vwang/bin/Fiji.app, ~/bin/Fiji.app, /opt/Fiji.app, /usr/local/Fiji.app ]

Result:

FindApplication search path: [ ./Fiji.app, /cis/home/vwang/bin/Fiji.app, ~/bin/Fiji.app, /opt/Fiji.app, /usr/local/Fiji.app ]

Result:

FindApplication search path: [ ./ImageJ, /cis/home/vwang/bin/ImageJ, ~/bin/ImageJ, /opt/ImageJ, /usr/local/ImageJ ]

Result:

FindApplication search path: [ ./, /cis/home/vwang/bin/, ~/bin/, /opt/, /usr/local/ ]

Result: /usr/local/bin/ImageJ

Show command: '/usr/local/bin/ImageJ' '-e' 'open("/tmp/sample-4434-0.nii"); rename("sample");'

plugins:

How to link SimpleITK.Show() to imageJ in linux?

I've downloaded ImageJ and I can view images by running ImageJ directly. A similar question was asked and answered in the past (Can not "link"SimpleITK::Show() with FIJI), but the solution was for windows OS. What is the unix equivalent of

setx SITK_SHOW_COMMAND "C:\blah\blah\ImageJ\ImageJ.exe

My python code:

import SimpleITK as sitk

img = sitk.ReadImage("sample_mri.hdr")
sitk.Show(img, 'sample image')

Error message:

    return _SimpleITK.Show(*args, **kwargs)
RuntimeError: Exception thrown in SimpleITK Show: 
/tmp/SimpleITK/Code/IO/src/sitkShow.cxx:500:
sitk::ERROR: Error in administrating child process: [No such file or directory]
2 Answers

On Ubuntu, I had the exact same problem, here is the solution:

  1. download http://imagej.net/Fiji
  2. unzip Fiji to home directory, ~/Fiji.app
  3. add this folder to your PATH

fiji will include all the plugins you need to display mri files, such as nifti and mha

Related