0

我已经根据本教程https://simpleitk.readthedocs.io/en/master/Documentation/docs/source/building.html#building-simpleitk安装了 simpleITK 库。为此,我使用了 SuperBuild 部分,基本上是以下命令:

git clone  https://itk.org/SimpleITK.git
mkdir SimpleITK-build
cd SimpleITK-build
cmake ../SimpleITK/SuperBuild

make -j2

我在 UBUNTU 16.04 上使用 qt creator 作为这个项目的 IDE。我还包含了 ITK(ITK-prefix)和 SimpleITK(SimpleITK-Build)的包含路径。我还包含了与包含文件相关的库,但是我的编译器返回了“未定义的引用”,这些函数位于 ITK 部分(GaussianSource 和 Image)中(在问题的最后,我放置了消息)。

那么,我缺少什么?

这是我的.pro:

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt

INCLUDEPATH += /home/felippe/SimpleITK-build/include/SimpleITK-1.3
INCLUDEPATH += /home/felippe/SimpleITK-build/ITK-prefix/include/ITK-4.13

#SimpleITK LIB files
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libgtest.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKBasicFilters0-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKCommon-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKBasicFilters1-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKExplicit-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKIO-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKAnisotropicSmoothing-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKAntiAlias-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKBiasCorrection-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKBinaryMathematicalMorphology-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKClassifiers-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKColormap-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKCommon-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKConnectedComponents-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKConvolution-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKCurvatureFlow-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDeconvolution-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDenoising-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDisplacementField-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDistanceMap-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKFastMarching-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKFFT-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageCompare-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageCompose-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFeature-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFilterBase-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFunction-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFusion-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageGradient-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageGrid-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageIntensity-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageLabel-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageNoise-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageSources-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageStatistics-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKLabelMap-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKLabelVoting-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKLevelSets-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKMathematicalMorphology-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKPDEDeformableRegistration-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKRegionGrowing-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKRegistrationCommon-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKReview-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKSmoothing-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKThresholding-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKTransform-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKWatersheds-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKRegistration-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_SimpleITKFilters-1.3.a"
LIBS += -L"/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKUnitTestBase.a"

#ITK Lib Files
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKBiasCorrection-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKBioCell-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKCommon-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKDICOMParser-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkdouble-conversion-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKEXPAT-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKFEM-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmcharls-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmCommon-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmDICT-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmDSED-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmIOD-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmjpeg8-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmjpeg12-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmjpeg16-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmMEXD-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmMSFF-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmopenjp2-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmsocketxx-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmuuid-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKgiftiio-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkhdf5.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkhdf5_cpp.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOBMP-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOBruker-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOCSV-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOGDCM-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOGE-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOGIPL-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOHDF5-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOImageBase-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOIPL-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOJPEG-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOLSM-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMesh-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMeta-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMINC-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMRC-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIONIFTI-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIONRRD-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOPNG-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOSiemens-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOSpatialObjects-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOStimulate-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTIFF-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformBase-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformHDF5-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformInsightLegacy-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformMatlab-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOXML-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkjpeg-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKKLMRegionGrowing-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKLabelMap-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitklbfgs-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKMesh-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKMetaIO-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkminc2-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitknetlib-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkNetlibSlatec-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKniftiio-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKNrrdIO-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkopenjpeg-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKOptimizers-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKOptimizersv4-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKPath-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkpng-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKPolynomials-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKQuadEdgeMesh-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKReview-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKSpatialObjects-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKStatistics-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitksys-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitktestlib-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitktiff-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKTransform-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKTransformFactory-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkv3p_netlib-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkvcl-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKVideoCore-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKVideoIO-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkvnl-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkvnl_algo-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKVNLInstantiation-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKVTK-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKWatersheds-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkzlib-4.13.a"
LIBS += -L"/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKznz-4.13.a"

SOURCES += \
        main.cpp

这是我的代码:

// This one header will include all SimpleITK filters and external
// objects.
#include "SimpleITK.h"
#include "sitkImageOperators.h"
#include "sitkImage.h"
#include <iostream>
#include <stdlib.h>


// create convenient namespace alias
namespace sitk = itk::simple;

int main () {

  sitk::PixelIDValueEnum pixelType = sitk::sitkUInt8;
  std::vector<unsigned int> imageSize ( 2, 128 );

  // Create an image
  itk::simple::Image image( imageSize, pixelType );

  // Create a face image
  std::vector<double> faceSize ( 2, 64.0 );
  std::vector<double> faceCenter ( 2, 64.0 );;
  sitk::Image face = sitk::GaussianSource( pixelType, imageSize, faceSize, faceCenter );

  // Create eye images
  std::vector<double> eyeSize ( 2, 5.0 );
  std::vector<double> eye1Center ( 2, 48.0 );
  std::vector<double> eye2Center;
  eye2Center.push_back( 80.0 );
  eye2Center.push_back( 48.0 );
  sitk::Image eye1 = sitk::GaussianSource( pixelType, imageSize, eyeSize, eye1Center, 150 );
  sitk::Image eye2 = sitk::GaussianSource( pixelType, imageSize, eyeSize, eye2Center, 150 );

  // Apply the eyes to the face
  face = face - eye1 - eye2;
  face = sitk::BinaryThreshold( face, 200, 255, 255 );

  // Create the mouth
  std::vector<double> mouthRadii;
  mouthRadii.push_back( 30.0 );
  mouthRadii.push_back( 20.0 );
  std::vector<double> mouthCenter;
  mouthCenter.push_back( 64.0 );
  mouthCenter.push_back( 76.0 );
  sitk::Image mouth = 255 - sitk::BinaryThreshold(
                              sitk::GaussianSource(pixelType, imageSize, mouthRadii, mouthCenter),
                              200, 255, 255 );

  // Paste the mouth onto the face
  std::vector<unsigned int> mouthSize;
  mouthSize.push_back( 64 );
  mouthSize.push_back( 18 );
  std::vector<int> mouthLoc;
  mouthLoc.push_back( 32 );
  mouthLoc.push_back( 76 );
  face = sitk::Paste( face, mouth, mouthSize, mouthLoc, mouthLoc );

  // Apply the face to the original image
  image = image + face;

  // Display the results
  sitk::Show( image, "Hello World: C++", true );

}

这是错误消息:

/home/felippe/Área de Trabalho/Felippe/Mestrado/C_plus_plus/Codigos/RegistrationITK/main.cpp:33: error: undefined reference to `itk::simple::GaussianSource(itk::simple::PixelIDValueEnum, std::vector<unsigned int, std::allocator<unsigned int> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, double, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> >, bool)'

/home/felippe/Área de Trabalho/Felippe/Mestrado/C_plus_plus/Codigos/RegistrationITK/main.cpp:36: error: undefined reference to `itk::simple::Image::operator=(itk::simple::Image const&)'

/home/felippe/Área de Trabalho/Felippe/Mestrado/C_plus_plus/Codigos/RegistrationITK/main.cpp:63: error: undefined reference to `itk::simple::Show(itk::simple::Image const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'

谢谢。

4

0 回答 0