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为医生,研究人员和公众提供了免费,强大的跨平台加工工具 ...
随机推荐
- 包含MIN函数的栈+一个数组实现两个堆栈+两个数组实现MIN栈
1.题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈最小元素的min函数. 思路:利用一个辅助栈来存放最小值 栈 3,4,2,5,1 辅助栈 3,2,1 每入栈一次,就与辅 ...
- postgre 导出单表和导入
pg除了可以通过dump的方式导入和导出.如果只是导出数据,可以直接使用copy 导出 COPY user TO '/tmp/data/test.csv' WITH csv; COPY user(na ...
- art.template 循环里面分组。
后台提供给我们一个数组,我们要用模版实现上面的格式输出怎么版呢? 下面就是解决方案: <h2>循环4个一组</h2> <script type="text/ht ...
- Android性能优化-减小APK大小
前言 用户通常会避免下载比较大的应用,特别是连接到2G和3G网络,或者按流量收费的设备.这篇文章描述了如何减小apk的大小,帮助你让更多的用户下载你的app. 一 理解APK的结构 在讨论如何减小ap ...
- 常见网站CSS样式重置
腾讯 1 2 3 4 5 6 7 8 9 body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,fieldset,legend,input,textarea, ...
- Visual Studio 统计代码行数
介绍一种简单的统计代码行数的小技巧, 使用正则表达式,用VS强大的查找功能 b[^:b#/]+.$ 最后结果:
- 使用 LaTeX 画图系列
可以使用TikZ,用TikZ绘制出来的图形效果非常好,原生支持所有LaTeX语法. 使用 LaTeX 画柱状图/条形图参考:Guide to draw charts (basic, pie, bar) ...
- MySQL binlog_format (Mixed,Statement,Row)[转]
MySQL 5.5 中对于二进制日志 (binlog) 有 3 种不同的格式可选:Mixed,Statement,Row,默认格式是 Statement.总结一下这三种格式日志的优缺点. MySQL ...
- Bash 中的特殊字符大全【转】
Linux下无论如何都是要用到shell命令的,在Shell的实际使用中,有编程经验的很容易上手,但稍微有难度的是shell里面的那些个符号,各种特殊的符号在我们编写Shell脚本的时候如果能够用的好 ...
- ES6,Array.from()函数的用法
ES6为Array增加了from函数用来将其他对象转换成数组. 当然,其他对象也是有要求,也不是所有的,可以将两种对象转换成数组. 1.部署了Iterator接口的对象,比如:Set,Map,Arra ...