0

I am trying to use ITK within QT (New to QT and rusty in ITK) I was finally able to define the include paths and .lib but I am still not able to run my code. It is a simple dicom reader:

typedef signed short InputPixelType;
const unsigned int InputDimension = 2;

typedef itk::Image< InputPixelType, InputDimension > InputImageType;

typedef itk::ImageFileReader< InputImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();

reader->SetFileName( "C:\Users\dmilford\Desktop\PvMRIm1" );

typedef itk::GDCMImageIO        ImageIOType;
ImageIOType::Pointer gdcmImageIO = ImageIOType::New();

The error comes at the last line and I get the following error

ITKIOGDCM-4.2.lib(itkGDCMImageIO.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall gdcm::Rescaler::SetPixelFormat(class gdcm::PixelFormat const &)" (__imp_?SetPixelFormat@Rescaler@gdcm@@QAEXABVPixelFormat@2@@Z) referenced in function "public: virtual void __thiscall itk::GDCMImageIO::Read(void *)" (?Read@GDCMImageIO@itk@@UAEXPAX@Z)

100 odd times over.

Does anyone know how to solve this linker error or know were I might get a hint to the answer?

AShelly
  • 34,686
  • 15
  • 91
  • 152
Dave
  • 85
  • 1
  • 1
  • 6

2 Answers2

1

This link error probably is from the inconsistent compiled version between ITK and your Qt compiler. Make sure your ITK is built with the MSVC2010, for example, while your Qt SDK default compiler is the same.

colddie
  • 1,029
  • 1
  • 15
  • 28
  • Hi and thanks for the reply. ITK is built with MSVC2010 and QT is running with the same compiler. In fact I did the same program directly with MSVC2010 with the same include paths and Lib and I get almost the same error: ITKIOGDCM-4.2.lib(itkGDCMImageIO.obj) : warning LNK4217. Any other thoughts? – Dave Jan 23 '13 at 12:34
  • 1
    If it's former, uncheck the ITK_USE_SYSTEM_GDCM; Or later one, you may not need to build ITK static libs. – colddie Jan 24 '13 at 10:28
1

Please try using CMake to generate the build files. It takes much less time, and all your issues will go away.

Matt McCormick
  • 314
  • 2
  • 3