KCL-BMEIS / niftyreg

This project contains command line tools to perform rigid, affine and non-linear registration of nifti or analyse images as well as utilities
BSD 3-Clause "New" or "Revised" License
141 stars 42 forks source link

distributed Nifti library is out-of-date and can conflict with more recent versions #117

Open KrisThielemans opened 1 month ago

KrisThielemans commented 1 month ago

I have ITK 5.4 installed via conda, which installs a more recent version of the nifti library, see e.g. https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/NIFTI/src/nifti/niftilib/nifti1.h and https://github.com/NIFTI-Imaging/nifti_clib/commits/master/niftilib/nifti1.h vs https://github.com/KCL-BMEIS/niftyreg/blob/master/reg-io/nifti/nifti1.h.

This causes problems when building our SIRF software that depends on both ITK and NiftyReg such as

/home/kris/devel/install/include/nifti1_io.h:255:10: error: conflicting declaration of C function 'char* nifti_intent_string(int)'
  255 |    char *nifti_intent_string     ( int ii ) ;
      |          ^~~~~~~~~~~~~~~~~~~
/home/kris/miniconda3/envs/cilsirfbuildGTROOT/include/ITK-5.4/nifti1_io.h:249:13: note: previous declaration 'const char* nifti_intent_string(int)'
  249 | char const *nifti_intent_string     ( int ii ) ;

There are a few ways to avoid version conflicts like this:

I suppose the 2nd option is the least painful.

KrisThielemans commented 1 month ago

Actually, the 2nd option wouldn't help in my case. ITK distributes nifti include files with the original names, but the libraries are renamed to avoid conflicts (e.g. libITKniftiio-5.4.so).

KrisThielemans commented 1 month ago

Looks like ITK updated its nifti version here https://github.com/InsightSoftwareConsortium/ITK/commit/9c2c9fa9b8e8c83fd60fc09f7695990b33df4bb6, which was first incorporated in ITK 5.3 (released Nov 24, 2022), which is why we didn't see this before.