SimpleITK.Show() 在 Macbook 上的 ImageJ 中生成错误
我在Jupyter上与ImageJ斗争。这是我正在运行的代码的一部分:
def ImageGen(a,b,x_0,y_0, sigma_x, sigma_y, theta ):
g=GaussianFunc(x_0,y_0,sigma_x,sigma_y,theta)
g2=sitk.GetImageFromArray(g)
res=a*g2+b
if ("SITK_NOSHOW" not in os.environ):
sitk.Show(res, title="res", debugOn=True)
Image_a=ImageGen(40,100,100,200,20,20,0)
输出是:
Exception thrown in SimpleITK Show:
../../Code/IO/src/sitkImageViewer.cxx:620:
sitk::ERROR: No ImageJ/Fiji application found.
ImageJ已经在应用程序中并且运行良好,因此我不确定此错误的原因是什么。如果有人可以帮助我解决这个问题,我会很感激。先感谢您!
I'm struggling with imagej on Jupyter. This is part of the code that i'm running:
def ImageGen(a,b,x_0,y_0, sigma_x, sigma_y, theta ):
g=GaussianFunc(x_0,y_0,sigma_x,sigma_y,theta)
g2=sitk.GetImageFromArray(g)
res=a*g2+b
if ("SITK_NOSHOW" not in os.environ):
sitk.Show(res, title="res", debugOn=True)
Image_a=ImageGen(40,100,100,200,20,20,0)
and the output is:
Exception thrown in SimpleITK Show:
../../Code/IO/src/sitkImageViewer.cxx:620:
sitk::ERROR: No ImageJ/Fiji application found.
The ImageJ is already in the applications and it works well, so i'm not sure what is the reason for this error. I would be grateful if anyone can help me to fix that. Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您的 ImageJ 可执行文件位于哪里?显然 SimpleITK 没有找到它。您可以使用 SITK_SHOW_COMMAND 环境变量给出 ImageJ 可执行文件的完整路径。
例如,在我的 Mac 上,我可以按如下方式设置 SITK_SHOW_COMMAND:
默认情况下 SimpleITK 在 /Applications 和 ~/Applications 中搜索 Fiji/ImageJ
您可以在此处阅读有关在 Jupyter 笔记本中使用 SimpleITK 显示图像的更多信息: http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/04_Image_Display.html
Where is your ImageJ executable located? Clearly SimpleITK is not finding it. You can use the SITK_SHOW_COMMAND environment variable give the full path to the ImageJ executable.
For instance, on my Mac, I could set SITK_SHOW_COMMAND as follows:
By default SimpleITK searches for Fiji/ImageJ in /Applications and ~/Applications
You can read more about displaying images with SimpleITK in Jupyter notebooks here: http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/04_Image_Display.html