gpt4 book ai didi

c++ - 使用 ITK 库的错误和警告

转载 作者:行者123 更新时间:2023-11-28 06:09:24 30 4
gpt4 key购买 nike

我正在尝试在我自己的项目中使用 itk 库。我使用 cmake 3.3 构建了 ITK,并使用 cmake 配置我自己的项目。但是,当我尝试使用 Visual Studio 2012 构建项目时,我收到以下警告(在 Debug模式下):

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2176): warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2157) : see declaration of 'std::_Copy_impl'
2> c:\work\myproject\thirdparty\modules\io\imagebase\include\itkImageFileReader.hxx(441) : see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned char*>(_InIt,_InIt,_OutIt)' being compiled
2> with
2> [
2> _OutIt=unsigned char *,
2> _InIt=const unsigned char *
2> ]
2> c:\work\myproject\thirdparty\modules\io\imagebase\include\itkImageFileReader.hxx(353) : while compiling class template member function 'void itk::ImageFileReader<TOutputImage>::GenerateData(void)'
2> with
2> [
2> TOutputImage=ImageType
2> ]
2> C:\Work\myproject\Main.cpp(77) : see reference to class template instantiation 'itk::ImageFileReader<TOutputImage>' being compiled
2> with
2> [
2> TOutputImage=ImageType
2> ]
2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2157) : see declaration of 'std::_Copy_impl'

(之后有关于pdb文件未出现的警告)

当我运行 exe 时,我在 reader->Update() 中遇到异常;在我的文件中(稍后出现在我的问题中)

这是我的 CMakeLists.txt 文件:

project(myproj)
SET( EX_PLATFORM 64 )
SET( EX_PLATFORM_NAME "x64" )
cmake_minimum_required(VERSION 2.6.0)
include_directories ("thirdParty/Modules/Segmentation/Watersheds/include"
"thirdParty/Modules/Segmentation/Voronoi/include"
"thirdParty/Modules/Video/IO/include"
"thirdParty/Modules/Video/Filtering/include"
"thirdParty/Modules/Video/Core/include"
"thirdParty/Modules/Bridge/VTK/include"
"thirdParty/Modules/Core/TestKernel/include"
"thirdParty/Modules/Filtering/SpatialFunction/include"
"thirdParty/Modules/Registration/RegistrationMethodsv4/include"
"thirdParty/Modules/Segmentation/RegionGrowing/include"
"thirdParty/Modules/Filtering/QuadEdgeMeshFiltering/include"
"thirdParty/Modules/Numerics/NeuralNetworks/include"
"thirdParty/Modules/Registration/Metricsv4/include"
"thirdParty/Modules/Numerics/Optimizersv4/include"
"thirdParty/Modules/Segmentation/MarkovRandomFieldsClassifiers/include"
"thirdParty/Modules/Segmentation/LevelSetsv4/include"
"thirdParty/Modules/Segmentation/LabelVoting/include"
"thirdParty/Modules/Segmentation/KLMRegionGrowing/include"
"thirdParty/Modules/Filtering/ImageNoise/include"
"thirdParty/Modules/Filtering/ImageFusion/include"
"thirdParty/Modules/IO/VTK/include"
"thirdParty/Modules/IO/TransformMatlab/include"
"thirdParty/Modules/IO/TransformInsightLegacy/include"
"thirdParty/Modules/IO/TransformHDF5/include"
"thirdParty/Modules/IO/TransformBase/include"
"thirdParty/Modules/IO/Stimulate/include"
"thirdParty/Modules/IO/Siemens/include"
"thirdParty/Modules/IO/RAW/include"
"thirdParty/Modules/IO/PNG/include"
"thirdParty/Modules/ThirdParty/PNG/src"
"thirdParty/itk_target/Modules/ThirdParty/PNG/src"
"thirdParty/Modules/IO/NRRD/include"
"thirdParty/Modules/ThirdParty/NrrdIO/src/NrrdIO"
"thirdParty/itk_target/Modules/ThirdParty/NrrdIO/src/NrrdIO"
"thirdParty/Modules/IO/NIFTI/include"
"thirdParty/Modules/IO/Meta/include"
"thirdParty/Modules/IO/Mesh/include"
"thirdParty/Modules/IO/MRC/include"
"thirdParty/Modules/IO/LSM/include"
"thirdParty/Modules/IO/TIFF/include"
"thirdParty/Modules/ThirdParty/TIFF/src"
"thirdParty/itk_target/Modules/ThirdParty/TIFF/src/itktiff"
"thirdParty/itk_target/Modules/ThirdParty/TIFF/src"
"thirdParty/Modules/IO/JPEG/include"
"thirdParty/Modules/ThirdParty/JPEG/src"
"thirdParty/itk_target/Modules/ThirdParty/JPEG/src"
"thirdParty/Modules/IO/HDF5/include"
"thirdParty/Modules/IO/GIPL/include"
"thirdParty/Modules/IO/GE/include"
"thirdParty/Modules/IO/IPL/include"
"thirdParty/Modules/IO/GDCM/include"
"thirdParty/Modules/IO/CSV/include"
"thirdParty/Modules/IO/BioRad/include"
"thirdParty/Modules/IO/BMP/include"
"thirdPartyitk_target/Modules/ThirdParty/HDF5/src"
"thirdParty/Modules/ThirdParty/HDF5/src"
"thirdParty/Modules/Filtering/GPUThresholding/include"
"thirdParty/Modules/Filtering/GPUSmoothing/include"
"thirdParty/Modules/Registration/GPUPDEDeformable/include"
"thirdParty/Modules/Registration/GPUCommon/include"
"thirdParty/Modules/Filtering/GPUImageFilterBase/include"
"thirdParty/Modules/Filtering/GPUAnisotropicSmoothing/include"
"thirdParty/Modules/Core/GPUFiniteDifference/include"
"thirdParty/Modules/Core/GPUCommon/include"
"thirdParty/Modules/ThirdParty/GIFTI/src/gifticlib"
"thirdParty/Modules/ThirdParty/NIFTI/src/nifti/znzlib"
"thirdParty/Modules/ThirdParty/NIFTI/src/nifti/niftilib"
"thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition"
"thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefinition"
"thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectDefinition"
"thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/Common"
"thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary"
"thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat"
"thirdParty/itk_target/Modules/ThirdParty/GDCM/src/gdcm/Source/Common"
"thirdParty/itk_target/Modules/ThirdParty/GDCM"
"thirdParty/Modules/Registration/FEM/include"
"thirdParty/Modules/Registration/PDEDeformable/include"
"thirdParty/Modules/Numerics/FEM/include"
"thirdParty/Modules/Registration/Common/include"
"thirdParty/Modules/IO/SpatialObjects/include"
"thirdParty/Modules/IO/XML/include"
"thirdParty/Modules/ThirdParty/Expat/src/expat"
"thirdParty/itk_target/Modules/ThirdParty/Expat/src/expat"
"thirdParty/Modules/Numerics/Eigen/include"
"thirdParty/Modules/Filtering/DisplacementField/include"
"thirdParty/Modules/Filtering/DiffusionTensorImage/include"
"thirdParty/Modules/Filtering/Denoising/include"
"thirdParty/Modules/Segmentation/DeformableMesh/include"
"thirdParty/Modules/Filtering/Deconvolution/include"
"thirdParty/Modules/ThirdParty/DICOMParser/src/DICOMParser"
"thirdParty/itk_target/Modules/ThirdParty/DICOMParser/src/DICOMParser"
"thirdParty/Modules/Filtering/Convolution/include"
"thirdParty/Modules/Filtering/FFT/include"
"thirdParty/Modules/Filtering/Colormap/include"
"thirdParty/Modules/Segmentation/Classifiers/include"
"thirdParty/Modules/Segmentation/BioCell/include"
"thirdParty/Modules/Filtering/BiasCorrection/include"
"thirdParty/Modules/Numerics/Polynomials/include"
"thirdParty/Modules/Filtering/AntiAlias/include"
"thirdParty/Modules/Segmentation/LevelSets/include"
"thirdParty/Modules/Segmentation/SignedDistanceFunction/include"
"thirdParty/Modules/Numerics/Optimizers/include"
"thirdParty/Modules/Filtering/ImageFeature/include"
"thirdParty/Modules/Filtering/ImageSources/include"
"thirdParty/Modules/Filtering/ImageGradient/include"
"thirdParty/Modules/Filtering/Smoothing/include"
"thirdParty/Modules/Filtering/ImageCompare/include"
"thirdParty/Modules/Filtering/FastMarching/include"
"thirdParty/Modules/Core/QuadEdgeMesh/include"
"thirdParty/Modules/Filtering/DistanceMap/include"
"thirdParty/Modules/Numerics/NarrowBand/include"
"thirdParty/Modules/Filtering/BinaryMathematicalMorphology/include"
"thirdParty/Modules/Filtering/LabelMap/include"
"thirdParty/Modules/Filtering/MathematicalMorphology/include"
"thirdParty/Modules/Segmentation/ConnectedComponents/include"
"thirdParty/Modules/Filtering/Thresholding/include"
"thirdParty/Modules/Filtering/ImageLabel/include"
"thirdParty/Modules/Filtering/ImageIntensity/include"
"thirdParty/Modules/Filtering/Path/include"
"thirdParty/Modules/Filtering/ImageStatistics/include"
"thirdParty/Modules/Core/SpatialObjects/include"
"thirdParty/Modules/ThirdParty/MetaIO/src/MetaIO/src"
"thirdParty/itk_target/Modules/ThirdParty/MetaIO/src/MetaIO/src"
"thirdParty/Modules/ThirdParty/ZLIB/src"
"thirdParty/itk_target/Modules/ThirdParty/ZLIB/src"
"thirdParty/Modules/Core/Mesh/include"
"thirdParty/Modules/IO/ImageBase/include"
"thirdParty/itk_target/Modules/IO/ImageBase"
"thirdParty/Modules/Filtering/ImageCompose/include"
"thirdParty/Modules/Filtering/AnisotropicSmoothing/include"
"thirdParty/Modules/Filtering/ImageGrid/include"
"thirdParty/Modules/Core/ImageFunction/include"
"thirdParty/Modules/Core/Transform/include"
"thirdParty/Modules/Numerics/Statistics/include"
"thirdParty/itk_target/Modules/ThirdParty/Netlib"
"thirdParty/Modules/Core/ImageAdaptors/include"
"thirdParty/Modules/Filtering/CurvatureFlow/include"
"thirdParty/Modules/Filtering/ImageFilterBase/include"
"thirdParty/Modules/Core/FiniteDifference/include"
"thirdParty/Modules/Core/Common/include"
"thirdParty/itk_target/Modules/Core/Common"
"thirdParty/Modules/ThirdParty/VNLInstantiation/include"
"thirdParty/itk_target/Modules/ThirdParty/VNL/src/vxl/core"
"thirdParty/itk_target/Modules/ThirdParty/VNL/src/vxl/vcl"
"thirdParty/itk_target/Modules/ThirdParty/VNL/src/vxl/v3p/netlib"
"thirdParty/Modules/ThirdParty/VNL/src/vxl/core"
"thirdParty/Modules/ThirdParty/VNL/src/vxl/vcl"
"thirdParty/Modules/ThirdParty/VNL/src/vxl/v3p/netlib"
"thirdParty/itk_target/Modules/ThirdParty/KWSys/src"
"thirdParty/itk_target/Modules/ThirdParty/DoubleConversion/src/double-conversion"
"thirdParty/Modules/ThirdParty/DoubleConversion/src/double-conversion"
"thirdParty/Modules/ThirdParty/VNL/src/vxl/vcl/emulation"
)
SET(DEBUG_DIR "../thirdParty/lib/Debug/")
SET(RELEASE_DIR "../thirdParty/lib/Release/")


SET(Sources "Main.cpp")


add_executable(myproj ${Sources})

target_link_libraries(myproj
debug "${DEBUG_DIR}DeformableRegistration11"
debug "${DEBUG_DIR}DeformableRegistration11"
debug "${DEBUG_DIR}ITKBiasCorrection-4.8"
debug "${DEBUG_DIR}ITKBioCell-4.8"
debug "${DEBUG_DIR}ITKCommon-4.8"
debug "${DEBUG_DIR}ITKDICOMParser-4.8"
debug "${DEBUG_DIR}itkdouble-conversion-4.8"
debug "${DEBUG_DIR}ITKEXPAT-4.8"
debug "${DEBUG_DIR}ITKFEM-4.8"
debug "${DEBUG_DIR}itkgdcmcharls-4.8"
debug "${DEBUG_DIR}itkgdcmCommon-4.8"
debug "${DEBUG_DIR}itkgdcmDICT-4.8"
debug "${DEBUG_DIR}itkgdcmDSED-4.8"
debug "${DEBUG_DIR}itkgdcmIOD-4.8"
debug "${DEBUG_DIR}itkgdcmjpeg12-4.8"
debug "${DEBUG_DIR}itkgdcmjpeg16-4.8"
debug "${DEBUG_DIR}itkgdcmjpeg8-4.8"
debug "${DEBUG_DIR}itkgdcmMEXD-4.8"
debug "${DEBUG_DIR}itkgdcmMSFF-4.8"
debug "${DEBUG_DIR}itkgdcmopenjpeg-4.8"
debug "${DEBUG_DIR}itkgdcmsocketxx-4.8"
debug "${DEBUG_DIR}ITKgiftiio-4.8"
debug "${DEBUG_DIR}itkhdf5-4.8"
debug "${DEBUG_DIR}itkhdf5_cpp-4.8"
debug "${DEBUG_DIR}ITKIOBioRad-4.8"
debug "${DEBUG_DIR}ITKIOBMP-4.8"
debug "${DEBUG_DIR}ITKIOCSV-4.8"
debug "${DEBUG_DIR}ITKIOGDCM-4.8"
debug "${DEBUG_DIR}ITKIOGE-4.8"
debug "${DEBUG_DIR}ITKIOGIPL-4.8"
debug "${DEBUG_DIR}ITKIOHDF5-4.8"
debug "${DEBUG_DIR}ITKIOImageBase-4.8"
debug "${DEBUG_DIR}ITKIOIPL-4.8"
debug "${DEBUG_DIR}ITKIOJPEG-4.8"
debug "${DEBUG_DIR}ITKIOLSM-4.8"
debug "${DEBUG_DIR}ITKIOMesh-4.8"
debug "${DEBUG_DIR}ITKIOMeta-4.8"
debug "${DEBUG_DIR}ITKIOMRC-4.8"
debug "${DEBUG_DIR}ITKIONIFTI-4.8"
debug "${DEBUG_DIR}ITKIONRRD-4.8"
debug "${DEBUG_DIR}ITKIOPNG-4.8"
debug "${DEBUG_DIR}ITKIOSiemens-4.8"
debug "${DEBUG_DIR}ITKIOSpatialObjects-4.8"
debug "${DEBUG_DIR}ITKIOStimulate-4.8"
debug "${DEBUG_DIR}ITKIOTIFF-4.8"
debug "${DEBUG_DIR}ITKIOTransformBase-4.8"
debug "${DEBUG_DIR}ITKIOTransformHDF5-4.8"
debug "${DEBUG_DIR}ITKIOTransformInsightLegacy-4.8"
debug "${DEBUG_DIR}ITKIOTransformMatlab-4.8"
debug "${DEBUG_DIR}ITKIOVTK-4.8"
debug "${DEBUG_DIR}ITKIOXML-4.8"
debug "${DEBUG_DIR}itkjpeg-4.8"
debug "${DEBUG_DIR}ITKKLMRegionGrowing-4.8"
debug "${DEBUG_DIR}ITKLabelMap-4.8"
debug "${DEBUG_DIR}ITKMesh-4.8"
debug "${DEBUG_DIR}ITKMetaIO-4.8"
debug "${DEBUG_DIR}itkNetlibSlatec-4.8"
debug "${DEBUG_DIR}ITKniftiio-4.8"
debug "${DEBUG_DIR}ITKNrrdIO-4.8"
debug "${DEBUG_DIR}ITKOptimizers-4.8"
debug "${DEBUG_DIR}ITKOptimizersv4-4.8"
debug "${DEBUG_DIR}ITKPath-4.8"
debug "${DEBUG_DIR}itkpng-4.8"
debug "${DEBUG_DIR}ITKPolynomials-4.8"
debug "${DEBUG_DIR}ITKQuadEdgeMesh-4.8"
debug "${DEBUG_DIR}ITKSpatialObjects-4.8"
debug "${DEBUG_DIR}ITKStatistics-4.8"
debug "${DEBUG_DIR}itksys-4.8"
debug "${DEBUG_DIR}itktestlib-4.8"
debug "${DEBUG_DIR}itktiff-4.8"
debug "${DEBUG_DIR}itkv3p_lsqr-4.8"
debug "${DEBUG_DIR}itkv3p_netlib-4.8"
debug "${DEBUG_DIR}itkvcl-4.8"
debug "${DEBUG_DIR}ITKVideoCore-4.8"
debug "${DEBUG_DIR}ITKVideoIO-4.8"
debug "${DEBUG_DIR}itkvnl-4.8"
debug "${DEBUG_DIR}ITKVNLInstantiation-4.8"
debug "${DEBUG_DIR}itkvnl_algo-4.8"
debug "${DEBUG_DIR}ITKVTK-4.8"
debug "${DEBUG_DIR}ITKWatersheds-4.8"
debug "${DEBUG_DIR}itkzlib-4.8"
debug "${DEBUG_DIR}ITKznz-4.8"
debug "${DEBUG_DIR}DeformableRegistration1"

optimized "${RELEASE_DIR}DeformableRegistration11"
optimized "${RELEASE_DIR}DeformableRegistration11"
optimized "${RELEASE_DIR}ITKBiasCorrection-4.8"
optimized "${RELEASE_DIR}ITKBioCell-4.8"
optimized "${RELEASE_DIR}ITKCommon-4.8"
optimized "${RELEASE_DIR}ITKDICOMParser-4.8"
optimized "${RELEASE_DIR}itkdouble-conversion-4.8"
optimized "${RELEASE_DIR}ITKEXPAT-4.8"
optimized "${RELEASE_DIR}ITKFEM-4.8"
optimized "${RELEASE_DIR}itkgdcmcharls-4.8"
optimized "${RELEASE_DIR}itkgdcmCommon-4.8"
optimized "${RELEASE_DIR}itkgdcmDICT-4.8"
optimized "${RELEASE_DIR}itkgdcmDSED-4.8"
optimized "${RELEASE_DIR}itkgdcmIOD-4.8"
optimized "${RELEASE_DIR}itkgdcmjpeg12-4.8"
optimized "${RELEASE_DIR}itkgdcmjpeg16-4.8"
optimized "${RELEASE_DIR}itkgdcmjpeg8-4.8"
optimized "${RELEASE_DIR}itkgdcmMEXD-4.8"
optimized "${RELEASE_DIR}itkgdcmMSFF-4.8"
optimized "${RELEASE_DIR}itkgdcmopenjpeg-4.8"
optimized "${RELEASE_DIR}itkgdcmsocketxx-4.8"
optimized "${RELEASE_DIR}ITKgiftiio-4.8"
optimized "${RELEASE_DIR}itkhdf5-4.8"
optimized "${RELEASE_DIR}itkhdf5_cpp-4.8"
optimized "${RELEASE_DIR}ITKIOBioRad-4.8"
optimized "${RELEASE_DIR}ITKIOBMP-4.8"
optimized "${RELEASE_DIR}ITKIOCSV-4.8"
optimized "${RELEASE_DIR}ITKIOGDCM-4.8"
optimized "${RELEASE_DIR}ITKIOGE-4.8"
optimized "${RELEASE_DIR}ITKIOGIPL-4.8"
optimized "${RELEASE_DIR}ITKIOHDF5-4.8"
optimized "${RELEASE_DIR}ITKIOImageBase-4.8"
optimized "${RELEASE_DIR}ITKIOIPL-4.8"
optimized "${RELEASE_DIR}ITKIOJPEG-4.8"
optimized "${RELEASE_DIR}ITKIOLSM-4.8"
optimized "${RELEASE_DIR}ITKIOMesh-4.8"
optimized "${RELEASE_DIR}ITKIOMeta-4.8"
optimized "${RELEASE_DIR}ITKIOMRC-4.8"
optimized "${RELEASE_DIR}ITKIONIFTI-4.8"
optimized "${RELEASE_DIR}ITKIONRRD-4.8"
optimized "${RELEASE_DIR}ITKIOPNG-4.8"
optimized "${RELEASE_DIR}ITKIOSiemens-4.8"
optimized "${RELEASE_DIR}ITKIOSpatialObjects-4.8"
optimized "${RELEASE_DIR}ITKIOStimulate-4.8"
optimized "${RELEASE_DIR}ITKIOTIFF-4.8"
optimized "${RELEASE_DIR}ITKIOTransformBase-4.8"
optimized "${RELEASE_DIR}ITKIOTransformHDF5-4.8"
optimized "${RELEASE_DIR}ITKIOTransformInsightLegacy-4.8"
optimized "${RELEASE_DIR}ITKIOTransformMatlab-4.8"
optimized "${RELEASE_DIR}ITKIOVTK-4.8"
optimized "${RELEASE_DIR}ITKIOXML-4.8"
optimized "${RELEASE_DIR}itkjpeg-4.8"
optimized "${RELEASE_DIR}ITKKLMRegionGrowing-4.8"
optimized "${RELEASE_DIR}ITKLabelMap-4.8"
optimized "${RELEASE_DIR}ITKMesh-4.8"
optimized "${RELEASE_DIR}ITKMetaIO-4.8"
optimized "${RELEASE_DIR}itkNetlibSlatec-4.8"
optimized "${RELEASE_DIR}ITKniftiio-4.8"
optimized "${RELEASE_DIR}ITKNrrdIO-4.8"
optimized "${RELEASE_DIR}ITKOptimizers-4.8"
optimized "${RELEASE_DIR}ITKOptimizersv4-4.8"
optimized "${RELEASE_DIR}ITKPath-4.8"
optimized "${RELEASE_DIR}itkpng-4.8"
optimized "${RELEASE_DIR}ITKPolynomials-4.8"
optimized "${RELEASE_DIR}ITKQuadEdgeMesh-4.8"
optimized "${RELEASE_DIR}ITKSpatialObjects-4.8"
optimized "${RELEASE_DIR}ITKStatistics-4.8"
optimized "${RELEASE_DIR}itksys-4.8"
optimized "${RELEASE_DIR}itktestlib-4.8"
optimized "${RELEASE_DIR}itktiff-4.8"
optimized "${RELEASE_DIR}itkv3p_lsqr-4.8"
optimized "${RELEASE_DIR}itkv3p_netlib-4.8"
optimized "${RELEASE_DIR}itkvcl-4.8"
optimized "${RELEASE_DIR}ITKVideoCore-4.8"
optimized "${RELEASE_DIR}ITKVideoIO-4.8"
optimized "${RELEASE_DIR}itkvnl-4.8"
optimized "${RELEASE_DIR}ITKVNLInstantiation-4.8"
optimized "${RELEASE_DIR}itkvnl_algo-4.8"
optimized "${RELEASE_DIR}ITKVTK-4.8"
optimized "${RELEASE_DIR}ITKWatersheds-4.8"
optimized "${RELEASE_DIR}itkzlib-4.8"
optimized "${RELEASE_DIR}ITKznz-4.8"
optimized "${RELEASE_DIR}DeformableRegistration1"


)

这是我用来运行cmake的运行文件

cd build 
cmake -G "Visual Studio 11 2012 Win64" ..
cd ..

这是我的 cpp 文件,它是在(减去注释)中找到的示例的拷贝

#include "itkImage.h"
#include "itkImageFileReader.h"

int main( int , char * argv[])
{
typedef unsigned char PixelType;
const unsigned int Dimension = 3;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
const char * filename = argv[1];
reader->SetFileName( filename );
reader->Update();
ImageType::Pointer image = reader->GetOutput();
return EXIT_SUCCESS;
}

当我使用 cmake 运行该示例时,一切都会构建并运行良好,所以问题可能出在我的 cmakeLists 上。我已经尝试查看所有 itk cmake 文件,但我无法弄清楚我应该使用哪些配置。我尝试使用#define SCL_SECURE_NO_WARNINGS(根据 http://public.kitware.com/pipermail/insight-users/2010-September/037992.html ) 但这没有帮助。我想过使用 #define _SECURE_SCL 0 来允许检查迭代器,但是因为当我处于 RelWithDebInfo 模式时出现异常,我认为这不会有帮助。任何人都知道我还可以尝试什么/我有什么错误?

编辑:问题似乎与我的 cmakelists 无关,因为当我尝试构建“HelloWorldInsight”项目(它的 hello world 项目)时,我收到了相同的已检查迭代器警告。

最佳答案

尝试使用

使您的 CMakeLists.txt 文件保持简单
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

无论如何,移动构建版本的 ITK 并不是那么简单,您不应该移动构建目录,而是创建一个安装目录。简而言之,您应该:

  • 在 cmakegui 中,将 cmake_install 前缀设置为您有权写入的某个文件夹(不是默认的 C:/Program Files)
  • 在 cmake gui 中设置其他选项,在 Visual Studio 中打开 ITK.sln 并构建
  • 在 Visual Studio 中,选择 ITK.sln 中的项目 INSTALL 和“仅构建此项目”。在输出中你会看到一堆文件被复制您必须决定是要安装调试库还是发布库,不能将两者安装在同一文件夹中,因为它们具有相同的名称并且会被覆盖

有关漂亮的屏幕截图,请参阅 https://stackoverflow.com/a/26286268/1136458 的第一步

关于c++ - 使用 ITK 库的错误和警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31590720/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com