3D Slicer 4.7.0 VS 2010 Compile 编译
花了将近一周的时间的,终于在VS2010成功的编译了最新版的3D Slicer 4.7.0,感觉快要崩溃了。Slicer用了20多个外部的库,全都要一起编译,完整编译一次起码要七八个小时,光VS的Output输出窗口有十万多行,复制到txt中,文本内容居然有26MB之多,可怕!经过台式机和笔记本分别进行多次编译,出错,改错,再编译,再出错,再改错。。。总共编译了有二三十次,终于在台式机上成功了编译了Slicer,感觉眼泪都要掉下来了,下面整理下成功编译的心得,希望给他人开路,不要再像博主这样无数次尝试:
1. 下载Slicer的最新代码 (https://github.com/Slicer/Slicer)
2. 下载Qt 4.8.6 (https://download.qt.io/archive/qt/4.8/4.8.6/),博主编译的是32位的,所以这里下载的是x86-vs2010版本的
3. 下载最新版的CMake 3.7.2, 注意这里一定要下载最新版本的,因为用老版本很可能会出错!
4. Slicer的编译路径要尽可能的短,最好就放在某个盘的根目录,比如code放在 C:/Slicer,编译的文件放在C:/build。(血与泪的教训啊,如果路径名太长,会在编译的时候可能会找不到某些头文件)
5. 在用Cmake配置的时候,取消 Unselect Slicer_USE_NUMPY, 因为编译这个很有可能会出错,而且一般情况下我们用不上,所以不用选。
6. 然后就是在打开Slicer.sln后,选择Release模式,进行编译。
下面是楼主在编译的过程中遇到的错误,以及改正方法:
Error 1:
>C:\Slicer\libs\vtkitk\itkMorphologicalContourInterpolator.hxx(): error C2668: 'pow' : ambiguous call to overloaded function [C:\build\Slicer-build\Libs\vtkITK\vtkITK.vcxproj]
>C:\Slicer\libs\vtkitk\itkMorphologicalContourInterpolator.hxx(): fatal error C1903: unable to recover from previous error(s); stopping compilation [C:\build\Slicer-build\Libs\vtkITK\vtkITK.vcxproj]
Change:
m_MinAlignIters( pow( , TImage::ImageDimension ) ), // smaller of this and pixel count of the search image
to:
m_MinAlignIters( pow( , (double)TImage::ImageDimension ) ), // smaller of this and pixel count of the search image
Change:
m_MaxAlignIters( pow( , TImage::ImageDimension ) ), // bigger of this and root of pixel count of the search image
to:
m_MaxAlignIters( pow( , (double)TImage::ImageDimension ) ), // bigger of this and root of pixel count of the search image
Error 2:
>..\..\..\..\Slicer\Libs\vtkAddon\vtkAddonMathUtilities.cxx(): error C2668: 'sqrt' : ambiguous call to overloaded function [C:\build\Slicer-build\Libs\vtkAddon\vtkAddon.vcxproj]
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): could be 'double sqrt(double)'
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): or 'float sqrt(float)'
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): or 'long double sqrt(long double)'
> while trying to match the argument list '(unsigned __int64)'
Change:
int dimension = std::sqrt(elements.size()) + 0.5; // Since conversion to int just truncates
to:
int dimension = std::sqrt((double)elements.size()) + 0.5; // Since conversion to int just truncates
Error 3:
>C:\Slicer\libs\vtkitk\itkMorphologicalContourInterpolator.hxx(): error C2668: 'sqrt' : ambiguous call to overloaded function [C:\build\Slicer-build\Libs\vtkITK\vtkITK.vcxproj]
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): could be 'long double sqrt(long double)'
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): or 'float sqrt(float)'
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): or 'double sqrt(double)'
> while trying to match the argument list '(unsigned long)'
> C:\Slicer\libs\vtkitk\itkMorphologicalContourInterpolator.hxx() : while compiling class template member function 'itk::Index<VIndexDimension> itk::MorphologicalContourInterpolator<TImage>::Align(itk::SmartPointer<TObjectType> &,long,itk::SmartPointer<TObjectType> &,const std::vector<_Ty> &)'
Change:
IdentifierType maxIter = std::max( m_MaxAlignIters, (IdentifierType)sqrt( searchRegion.GetNumberOfPixels() ) );
to:
IdentifierType maxIter = std::max( m_MaxAlignIters, (IdentifierType)sqrt( (double)searchRegion.GetNumberOfPixels() ) );
Error 4:
>..\..\..\..\..\..\Slicer\Libs\MRML\Core\Testing\vtkMRMLSceneTest2.cxx(): error C2039: 'back_inserter' : is not a member of 'std' [C:\build\Slicer-build\Libs\MRML\Core\Testing\MRMLCoreCxxTests.vcxproj]
>..\..\..\..\..\..\Slicer\Libs\MRML\Core\Testing\vtkMRMLSceneTest2.cxx(): error C3861: 'back_inserter': identifier not found [C:\build\Slicer-build\Libs\MRML\Core\Testing\MRMLCoreCxxTests.vcxproj]
Add:
#include <iterator>
Error 5:
>..\..\..\..\..\..\Slicer\Modules\Loadable\Segmentations\EditorEffects\qSlicerSegmentEditorScissorsEffect.cxx(): error C2668: 'sqrt' : ambiguous call to overloaded function [C:\build\Slicer-build\Modules\Loadable\Segmentations\EditorEffects\qSlicerSegmentationsEditorEffects.vcxproj]
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): could be 'long double sqrt(long double)'
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): or 'float sqrt(float)'
> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(): or 'double sqrt(double)'
> while trying to match the argument list '(int)'
Change:
double radius = sqrt((eventPosition[] - this->DragStartPosition[])*(eventPosition[] - this->DragStartPosition[])
+ (eventPosition[] - this->DragStartPosition[])*(eventPosition[] - this->DragStartPosition[]));
to:
double radius = sqrt((double)(eventPosition[] - this->DragStartPosition[])*(eventPosition[] - this->DragStartPosition[])
+ (eventPosition[] - this->DragStartPosition[])*(eventPosition[] - this->DragStartPosition[]));
Error 6:
'ACPCTransformCLP.h': No such file or directory
'AddScalarVolumesCLP.h': No such file or directory
'BRAINSDWICleanupCLP.h': No such file or directory
'BRAINSDemonWarpCLP.h': No such file or directory
'BRAINSFitCLP.h': No such file or directory
'BRAINSLabelStatsCLP.h': No such file or directory
'BRAINSROIAutoCLP.h': No such file or directory
'BRAINSResampleCLP.h': No such file or directory
'BRAINSResizeCLP.h': No such file or directory
'BRAINSStripRotationCLP.h': No such file or directory
'BRAINSTransformConvertCLP.h': No such file or directory
'BSplineToDeformationFieldCLP.h': No such file or directory
'CLIModule4TestCLP.h': No such file or directory
'CLIROITestCLP.h': No such file or directory
'CastScalarVolumeCLP.h': No such file or directory
'CheckerBoardFilterCLP.h': No such file or directory
'CreateDICOMSeriesCLP.h': No such file or directory
'CurvatureAnisotropicDiffusionCLP.h': No such file or directory
'DWIConvertCLP.h': No such file or directory
'DiffusionTensorTestCLP.h': No such file or directory
'EMSegmentCommandLineCLP.h': No such file or directory
'EMSegmentTransformToNewFormatCLP.h': No such file or directory
'ExecutionModelTourCLP.h': No such file or directory
'ExpertAutomatedRegistrationCLP.h': No such file or directory
'ExtractSkeletonCLP.h': No such file or directory
'FiducialRegistrationCLP.h': No such file or directory
'GaussianBlurImageFilterCLP.h': No such file or directory
'GradientAnisotropicDiffusionCLP.h': No such file or directory
'GrayscaleFillHoleImageFilterCLP.h': No such file or directory
'GrayscaleGrindPeakImageFilterCLP.h': No such file or directory
'GrayscaleModelMakerCLP.h': No such file or directory
'HistogramMatchingCLP.h': No such file or directory
'ImageLabelCombineCLP.h': No such file or directory
'IslandRemovalCLP.h': No such file or directory
'LabelMapSmoothingCLP.h': No such file or directory
'MaskScalarVolumeCLP.h': No such file or directory
'MedianImageFilterCLP.h': No such file or directory
'MergeModelsCLP.h': No such file or directory
'ModelMakerCLP.h': No such file or directory
'ModelToLabelMapCLP.h': No such file or directory
'MultiplyScalarVolumesCLP.h': No such file or directory
'N4ITKBiasFieldCorrectionCLP.h': No such file or directory
'OrientScalarVolumeCLP.h': No such file or directory
'OtsuThresholdImageFilterCLP.h': No such file or directory
'PETStandardUptakeValueComputationCLP.h': No such file or directory
'PerformMetricTestCLP.h': No such file or directory
'ProbeVolumeWithModelCLP.h': No such file or directory
'ResampleDTIVolumeCLP.h': No such file or directory
'ResampleScalarVectorDWIVolumeCLP.h': No such file or directory
'ResampleScalarVolumeCLP.h': No such file or directory
'RobustStatisticsSegmenterCLP.h': No such file or directory
'SimpleRegionGrowingSegmentationCLP.h': No such file or directory
'SubtractScalarVolumesCLP.h': No such file or directory
'TestGridTransformRegistrationCLP.h': No such file or directory
'ThresholdScalarVolumeCLP.h': No such file or directory
'VBRAINSDemonWarpCLP.h': No such file or directory
'VotingBinaryHoleFillingImageFilterCLP.h': No such file or directory
Solution:
Make the path short for CMake! For example, put Slicer source code at C:/Slicer, put the build files at C:/build
成功编译后得到如图所示的界面:

3D Slicer 4.7.0 VS 2010 Compile 编译的更多相关文章
- Qt 4.8.6 PCL 1.8.0 VS 2010 联合编译常见错误
在Qt和PCL联合编译的过程中,会出现各种各样的错误,解决这些错误的过程真是痛苦万分,所以总结一些常见错误方便自己也方便他人.比如我们要编译PCL1.8.0中的apps中的point_cloud_ed ...
- 3D Slicer中文教程(四)—图像分割
1.数据获取 (1)下载3D Slicer自带的样本数据 (2)选择自由的数据 (3)网上数据库等其他方式下载数据 2.分割工具 Segment Editor是一个用于分割的模块.细分(也称为轮廓)描 ...
- 3D Slicer Modify Mouse Event 修改3D Slicer中的鼠标响应事件
在3D Slicer中,我们如果想在自己写的插件中来修改默认的鼠标响应事件的话,就需要先将原有的响应事件链接删除,然后建立自定义的响应事件链接,然后将自己要实现的功能写在响应事件函数中. 比如Slic ...
- 3D Slicer中文教程(八)—导出STL文件
一.STL文件简介 STL(立体平版印刷术的缩写)是由3D Systems创建的立体平版印刷CAD软件原生的文件格式STL有“标准三角语言”和“标准镶嵌语言”等几个事后回溯.这种文件格式是由许多其他软 ...
- 3D Slicer中文教程(七)—图像中值滤波
1.中值滤波概念 中值滤波是对一个滑动窗口内的诸像素灰度值排序,用其中值代替窗口中心象素的原来灰度值,它是一种非线性的图像平滑法,它对脉冲干扰级椒盐噪声的抑制效果好,在抑制随机噪声的同时能有效保护边缘 ...
- 3D Slicer中文教程(六)—调用matlab函数(MatlabBridge使用方法)
1.安装MatlabBridge插件 (1)在工具栏找到Extension,点击进入Extension Manager (2)找到MatlabBridge,安装 2.配置MATLAB环境 (1)在模块 ...
- 3D Slicer中文教程(五)—三维视图颜色改变
3D Slicer在分割后三维重建的图像,效果很好,但是存在一定的不足,默认的颜色并不是很合适,这时手动设置三维视图下的需要的颜色就很有必要了.如下图所示,默认的三维重建后的颜色. 这样的颜色显然不是 ...
- 3D Slicer中文教程(三)—数据加载及保存方式
1.打开数据与保存数据 (1)打开数据 ——可以将数据拖拽到3D Slicer应用窗口或者从菜单栏工具栏打开. ——多种方式加载大量数据. 有关DICOM数据,请参阅DICOM模块文档. 对于几乎所有 ...
- 3D Slicer中文教程(一)—下载及安装方法
3D Slicer是用于医学图像信息学,图像处理和三维可视化的开源软件平台. 通过国家卫生研究院和全球开发人员社区的支持,二十多年来,Slicer为医生,研究人员和公众提供了免费,强大的跨平台加工工具 ...
随机推荐
- android:如何通过自定义工程模板让新建的工程都默认支持lambda表达式
首先参考这篇文章:自定义Android Studio工程模板,了解如何自定义模板 然后结合我们上一篇文章 android: 在android studio中使用retrolambda的步骤的要点, ...
- 如何将revit模型背景设置为黑色
Revit软件建模窗口默认的背景色为白色,在用惯了CAD的新用户转到Revit软件的时候,会对Revit白色的背景不太适应,跟AutoCAD一样,Revit提供自定义工作区背景颜色的功能--其实,你只 ...
- 本地项目文件夹同步到GitLab的操作步骤
一.需求 本地有一个微信小程序的项目源码,只是文件夹的形式,包括一些js和一些页面,想把这个文件夹用GitLab管理,于是就需要把本地文件夹push到服务器的GitLab上面 二.操作 2.1:本地文 ...
- 浅谈压缩感知(二十四):压缩感知重构算法之子空间追踪(SP)
主要内容: SP的算法流程 SP的MATLAB实现 一维信号的实验与结果 测量数M与重构成功概率关系的实验与结果 SP与CoSaMP的性能比较 一.SP的算法流程 压缩采样匹配追踪(CoSaMP)与子 ...
- IDEA使用笔记(四)——工具栏的显示隐藏切换
这也是在玩快捷键的时候,自己试验出来的,觉得不常用但是一旦想用了可能一下不知道怎么弄,还需要找,不如记下来,起码能加深一下印象!
- 在Repeater中使用DropDownList的方法
在Repeater中使用DropDownList的方法 以下代码并不完整,只记录了关键的方法 aspx代码中 假设这是一个用户管理的系统的模型,有一个下拉菜单来操作用户状态 <asp:Repea ...
- [svc]mysql备份恢复及常用命令
如何实现mysql读写分离 1.通过程序实现读写分类(性能 效率最佳) php和java都可以通过设置多个连接文件轻松实现对db的读写分离,即当select时,就去连读库的连接文件,当update,i ...
- python os详解
1.os.getcwd()--起始执行目录 获取当前执行程序文件所在的目录,需要注意的是,getcwd不是获取代码所在文件的目录,也不是获取执行文件所在的目录,而是起始执行目录. 目录结构: test ...
- 【网络】TCP和UDP的区别以及TCP的三次握手四次释放
一.两者区别 1.TCP面向连接的运输层协议,UDP无连接 2.TCP是可靠交付,UDP是尽最大努力交付 3.TCP面向字节流,UDP面向报文 4.TCP是点对点连接的,UDP一对一,一对多,多对多都 ...
- 【Ubuntu】PHP环境安装-phpstudy for linux版
安装: wget -c http://lamp.phpstudy.net/phpstudy.bin chmod +x phpstudy.bin #权限设置sudo ./phpstudy.bin ...