acil-bwh / ChestImagingPlatform

Chest Imaging Platform (CIP)
Other
55 stars 34 forks source link

CommandLineTools/RegisterCT.cxx compile error in SlicerCIP superbuild #8

Closed atisman89 closed 9 years ago

atisman89 commented 9 years ago

When CIP is built as a part of SlicerCIP superbuild, we get the following compile error (in OS X but similar in Windows as well):

/Users/jinho/Github/SlicerCIP-build/CIP/CommandLineTools/RegisterCT/RegisterCT.cxx:765:40: error: 
      no viable conversion from 'SmartPointer<class
      itk::MatrixOffsetTransformBase<double, 3, 3>>' to 'SmartPointer<class
      itk::Rigid3DTransform<double>>'
  ...RigidTransformType::Pointer rigidTransform = RigidTransformType::New();

After tracing it down, it turned out that CIP superbuild uses the following compiler flag to build ITK, while Slicer superbuild does not, which CIP in SlicerCIP uses for ITK.

-DITKV3_COMPATIBILITY:BOOL=ON (defined in External_ITKv4.cmake)

This flag is used in an ITK header file (itkv4/Modules/Core/Transform/include/itkRigid3DTransform.h) as following:

#ifdef ITKV3_COMPATIBILITY
  /** Run-time type information (and related methods).   */
  itkNewMacro(Self);
#endif

where the New() method is not included without this flag defined.

And, CIP CommandLineTools/RegisterCT.cxx uses the New() method that requires this flag (on line 765)

typename RigidTransformType::Pointer rigidTransform = RigidTransformType::New();

There may be other ways to resolve this error but a recommendation is to remove the dependency on the ITKV3_COMPATIBILITY in the CIP code (if feasible).

rjosest commented 9 years ago

The issue has been resolved. I've also set -DITKV3_COMPATIBILITY:BOOLEAN=OFF in External_ITKv4.cmake