花了将近一周的时间的,终于在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 编译的更多相关文章

  1. Qt 4.8.6 PCL 1.8.0 VS 2010 联合编译常见错误

    在Qt和PCL联合编译的过程中,会出现各种各样的错误,解决这些错误的过程真是痛苦万分,所以总结一些常见错误方便自己也方便他人.比如我们要编译PCL1.8.0中的apps中的point_cloud_ed ...

  2. 3D Slicer中文教程(四)—图像分割

    1.数据获取 (1)下载3D Slicer自带的样本数据 (2)选择自由的数据 (3)网上数据库等其他方式下载数据 2.分割工具 Segment Editor是一个用于分割的模块.细分(也称为轮廓)描 ...

  3. 3D Slicer Modify Mouse Event 修改3D Slicer中的鼠标响应事件

    在3D Slicer中,我们如果想在自己写的插件中来修改默认的鼠标响应事件的话,就需要先将原有的响应事件链接删除,然后建立自定义的响应事件链接,然后将自己要实现的功能写在响应事件函数中. 比如Slic ...

  4. 3D Slicer中文教程(八)—导出STL文件

    一.STL文件简介 STL(立体平版印刷术的缩写)是由3D Systems创建的立体平版印刷CAD软件原生的文件格式STL有“标准三角语言”和“标准镶嵌语言”等几个事后回溯.这种文件格式是由许多其他软 ...

  5. 3D Slicer中文教程(七)—图像中值滤波

    1.中值滤波概念 中值滤波是对一个滑动窗口内的诸像素灰度值排序,用其中值代替窗口中心象素的原来灰度值,它是一种非线性的图像平滑法,它对脉冲干扰级椒盐噪声的抑制效果好,在抑制随机噪声的同时能有效保护边缘 ...

  6. 3D Slicer中文教程(六)—调用matlab函数(MatlabBridge使用方法)

    1.安装MatlabBridge插件 (1)在工具栏找到Extension,点击进入Extension Manager (2)找到MatlabBridge,安装 2.配置MATLAB环境 (1)在模块 ...

  7. 3D Slicer中文教程(五)—三维视图颜色改变

    3D Slicer在分割后三维重建的图像,效果很好,但是存在一定的不足,默认的颜色并不是很合适,这时手动设置三维视图下的需要的颜色就很有必要了.如下图所示,默认的三维重建后的颜色. 这样的颜色显然不是 ...

  8. 3D Slicer中文教程(三)—数据加载及保存方式

    1.打开数据与保存数据 (1)打开数据 ——可以将数据拖拽到3D Slicer应用窗口或者从菜单栏工具栏打开. ——多种方式加载大量数据. 有关DICOM数据,请参阅DICOM模块文档. 对于几乎所有 ...

  9. 3D Slicer中文教程(一)—下载及安装方法

    3D Slicer是用于医学图像信息学,图像处理和三维可视化的开源软件平台. 通过国家卫生研究院和全球开发人员社区的支持,二十多年来,Slicer为医生,研究人员和公众提供了免费,强大的跨平台加工工具 ...

随机推荐

  1. 用.Net打造一个移动客户端(Android/IOS)的服务端框架NHM(四)——Android端Http访问类(转)

    本章目的 在上一章中,我们利用Hibernate Tools完成了Android Model层的建立,依赖Hibernate Tools的强大功能,自动生成了Model层.在本章,我们将继续我们的项目 ...

  2. Win-Sshfs无法连ubuntu1404原因

    ubunbtu 默认不允许root远程访问,设置为允许就可以了 1)vi /etc/ssh/sshd_config,将PermitRootLogin的值改成yes,并保存 PermitRootLogi ...

  3. IDependency自动注册autofac

    ContainerBuilder builder = new ContainerBuilder(); builder.RegisterGeneric(typeof(Repository<,> ...

  4. Android——媒体库 相关知识总结贴

    Android媒体库 http://www.apkbus.com/android-19283-1-1.html Android本地图片选择打开媒体库,选择图片 http://www.apkbus.co ...

  5. 11G新特性 -- 收缩临时表空间

    当大任务执行完毕,并不会立即释放临时表空间.有时候通过删除然后重建临时表空间的速度可能更快.不过对于在线系统可能不会那么容易删除重建,所以11g中可以在线收缩临时表空间或单个临时数据文件. 收缩临时表 ...

  6. Socket网络编程--聊天程序(1)

    很早的一段时间,看了APUE和UNPv1了解了网络编程,但是但是只是看而已,没有具体的实践,趁现在没有什么事做,就来实践了解一下网络编程.写博客保存下来,方便以后用到的时候可以查到. 此次的聊天程序是 ...

  7. lua -- 生成协议

    这是爬塔的协议 <?xml version="1.0" encoding="utf-8" ?> <coder name="Tower ...

  8. eslint 入门学习

    想学eslint已经很久了,可是每次进到官网看一下就觉得头大,无法下手,但是最近到了年底,进行年度总结,作为一个有志向的程序媛,还是要追求编码规范的,因此今天再次拿起来了eslint,记录一下我的学习 ...

  9. ⑤NuPlayer播放框架之GenericSource源码分析

    [时间:2017-01] [状态:Open] [关键词:android,nuplayer,开源播放器,播放框架,GenericSource] 0 导读 GenericSource是NuPlayer:: ...

  10. git技巧

    工作区 -> git add -> 暂存区 -> git commit -> 版本库 -> git push -> 远程仓库 版本库HEAD表示当前版本,上一个版本 ...