Python SimpleElastix安装教程

安装前准备工作

需要的软件

  • python(Anaconda)
  • VScode2019社区版
  • Cmaker
  • git软件或者GitHub桌面版
python

这里推荐用Anaconda创建一个虚拟环境,专门用于SimpleElastix,便于管理包

conda create -n elastix python=3.5
VScode2019

这里给出巨硬的下载地址,因为我一般不用C++,所以下载社区版就够用了,免费的,下载地址:
VScode19下载

Cmaker下载

有好心的博主给出了下载地址:
https://blog.csdn.net/u013626215/article/details/105097608/
这里面给出的版本是3.18.2的

git SimpleElastix

打开git命令行,跳转到你的目标目录(如:cd D:\Elastix\SimpleElastix)
然后在git中键入:

git clone https://github.com/kaspermarstal/SimpleElastix

设置Cmaker

在这里插入图片描述
PS:最好在Search中输入Python,并且把PYTHON_EXECUTABLE, PYTHON_INCLUDE_DIR ,PYTHON_LIBRARY这三项修改成对应到你的刚才为SimpleElastix创建的虚拟环境下的python路径。

然后点击Configure
注意Python的版本,是64位的还是32位的(这步非常重要!!!
在这里插入图片描述
修改python对应的路径
如果报错:
在这里插入图片描述

VScode识别不出来解决方案

https://www.cnblogs.com/qq2806933146xiaobai/p/13359446.html

修改完python路径,再点击config,最后点generate
在这里插入图片描述

用VScode编译

注意要切换到Cmake build的那个文件夹
在这里插入图片描述

输入:

msbuild ALL_BUILD.vcxproj /p:Configuration=Release

在这里插入图片描述

最后封装python语言

打开Anaconda Prompt
在这里插入图片描述
运行

python setup.py install

可能会出现报错:
error: can’t copy ‘D:\build\SimpleElastix\SimpleITK-build\Wrapping\Python\Packaging_SimpleITK.pyd’: doesn’t exist or not a regular file
不要慌!这个文件在上一级Python目录下,复制一下
在这里插入图片描述
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_44217573/article/details/108991866

参考

  1. https://simpleelastix.readthedocs.io/GettingStarted.html#compiling-on-windows
  2. https://www.pythonf.cn/read/60822
  3. https://blog.csdn.net/thinkpad1234567890/article/details/78955253?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase
  4. https://github.com/SuperElastix/SimpleElastix/issues/233
  5. https://blog.csdn.net/weixin_43975801/article/details/104927304
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐