Registration with ITK not working - Unexplainable Erros

Hello everyone!

I have come here as a last resort as I am really struggling to get ITK to run. First of all, some information on my system:

OS: Windows 11
Visual Studio: 2017
Architecture: x64
C++ Standard: v141

Now to my problem: I have downloaded the ITK 5.3.0 source code. I have configured this using cmake-gui, as explained in the docs, setting the correct Visual Studio and architecture and even including modules that seemed related to registration. I configured everything until all red highlights are gone and then generated the build files.
Next, I opened the generated VS solution, made sure that everything is set to the correct C++ standard and x64 architecture, and then I built the ALL_BUILD. This completed successfully. Next, I built the INSTALL in the same way, which also finished successfully with no errors.
Finally, I started my own project and made sure to link and add all library and include directories in the VS Project Properties. Again, I made usre everything was set to the same C++ standard and x64 architecture. First, I tried building the HelloWorld program and this also worked.
Now I am getting to the problem: I wanted to start writing some code to work on a simple rigid registration problem and included the following libraries:

*#include <iostream>*
*#include <itkImage.h>*
*#include <itkImageFileReader.h>*
*#include <itkImageFileWriter.h>*
*#include <itkCenteredTransformInitializer.h>*
*#include <itkVersorRigid3DTransform.h>*
*#include <itkImageRegistrationMethod.h>*
*#include <itkMeanSquaresImageToImageMetric.h>*
*#include <itkRegularStepGradientDescentOptimizer.h>*

Originally I even had some of them withe v4 suffix which I removed. Now I am getting a series of errors. Some examples are listed below:

|Error (active)|E2512|the argument to a feature-test macro must be a simple identifier|bioconstraintregistration|C:\Program Files\ITK\include\ITK-5.3\itksys\Configure.hxx|37||

|Error|C2244|'itk::MatrixOffsetTransformBase<TParametersValueType,VInputDimension,VOutputDimension>::TransformDiffusionTensor3D': unable to match function definition to an existing declaration|bioconstraintregistration|c:\program files\itk\include\itk-5.3\itkmatrixoffsettransformbase.hxx|257||

|Error|C2244|'itk::AffineTransform<TParametersValueType,VDimension>::Metric': unable to match function definition to an existing declaration|bioconstraintregistration|c:\program files\itk\include\itk-5.3\itkaffinetransform.hxx|294||

|Error|C2244|'itk::BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>::EvaluateAtContinuousIndexInternal': unable to match function definition to an existing declaration|bioconstraintregistration|c:\program files\itk\include\itk-5.3\itkbsplineinterpolateimagefunction.hxx|460||

There are a few errors related to each class but at this point I have tried reinstalling, rebuilding with various modules, etc. and cannot remove these errors.

Can anyone help me out with this? Did I install ITK incorrectly? Am I including incorrect headers?

Thank you so much for the help ahead!

If you are not using CMake as your project’s build system, take a look at this discussion and old instructions.

1 Like

Thank you so much! I did not realize that building it with Visual Studio was the problem. I am now just regularly building with CMake and it works! Thank you so much for your quick response!

1 Like