Building ElastiX source code for 32-bit binary for C++ project

142 views
Skip to first unread message

Kunal Yadav

unread,
Jan 17, 2023, 6:03:35 AM1/17/23
to elastix-imageregistration
Hi ,
   My project is a 32-Bit application written in C++. We are planning to use Elastix library in our code to calculate the coarse edge and Fine Edge of images. 
But I have got to know that there is no 32-Bit built-in library  available. 
so has anyone tried building the library for 32-bit in C++?
Can someone guide me to achieve this task?
Regards
Kunal 

Niels Dekker

unread,
Feb 2, 2023, 11:45:23 AM2/2/23
to elastix-imageregistration
Thanks for your question Kunal. We don't really test elastix on 32-bit anymore. Would it be possible for you to upgrade you application to 64-bit? Or is there a specific reason why 32-bit is preferable to you? Which platform are you running on?

Kind regards, Niels

----
Niels Dekker
LKEB, Leiden University Medical Center

Kunal Yadav

unread,
Feb 2, 2023, 8:07:42 PM2/2/23
to elastix-imag...@googlegroups.com
Hi Niels,
  Thanks for your response. I am working on a 32-bit c++ project running on a Windows platform. It is a legacy project and tightly coupled . We are planning to upgrade the process/project in future but currently chances are very low. but we have to use elastix library API for image registration and to find out coarse edge. That's why i am doing POC to build elastix in 32-bit .
could you please list out the steps to build the elasti library with 32-bit c++ compiler?  i would like to try and fix if any API does work in 32-bit.
Also you said 64-bit library(.lib or.so) for c++ is available, i did not find it anywhere in github, can you share me the link of c++ 64-bit library?

Regards
Kunal


--
You received this message because you are subscribed to the Google Groups "elastix-imageregistration" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elastix-imageregis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elastix-imageregistration/307dc05d-a3d6-4df3-84c8-bafcf962924fn%40googlegroups.com.

Niels Dekker

unread,
Feb 3, 2023, 4:36:36 AM2/3/23
to elastix-imageregistration
Hi Kunal,

Thanks for your explanation. We do not include lib files with the downloads of our elastix releases, because we think they would be very specific to whatever configuration or compiler version is being used. So we think it would be better for users to build the lib files themselves.

The elastix lib files can be built by CMake. Before doing so, you must then also build ITK. During the CMake configuration step of elastix, specify ITK_DIR as the location of your local ITK build or install directory. After building elastix (using Visual Studio), the library files should be in <elastix-build>\bin\Debug and/or  <elastix-build>\bin\Release.

Kind regards, Niels

Kunal Yadav

unread,
Feb 22, 2023, 12:47:21 AM2/22/23
to elastix-imageregistration
Hi Niels,
 Thank you for your support and responses. I have successfully compiled ITK 5.3.0 and elastix 5.1.0 using cMake command(cmake -S <source Dir> -B <build_fodelr> -G "Visual Studio 15 2017" -A x64) and then using x64 native tool of vs 2017.  the created many static libraries(e.g. elastix-5.1.lib).. 
Then i tried one sample CPP code(https://github.com/rcorredorj/elastix-cpp-test/blob/main/src/main.cpp)which does registration using elastixFilter->RegisterImages() API.
but i am getting lining errors :
itkgdcmcharls-5.3.lib(jpegls.obj) : error LNK2001: unresolved external symbol _purecall
2>itkgdcmcharls-5.3.lib(jpegstreamwriter.obj) : error LNK2001: unresolved external symbol _purecall
2>itkgdcmcharls-5.3.lib(jpegmarkersegment.obj) : error LNK2001: unresolved external symbol _purecall
2>itkhdf5_cpp-static-5.3.lib(H5AbstractDs.obj) : error LNK2001: unresolved external symbol _purecall
2>itkhdf5_cpp-static-5.3.lib(H5IdComponent.obj) : error LNK2001: unresolved external symbol _purecall
2>itkhdf5_cpp-static-5.3.lib(H5CommonFG.obj) : error LNK2001: unresolved external symbol _purecall
2>itkgdcmDSED-5.3.lib(gdcmPrivateTag.obj) : error LNK2001: unresolved external symbol _purecall
2>itkgdcmMSFF-5.3.lib(gdcmJPEG2000Codec.obj) : error LNK2001: unresolved external symbol _purecall
2>itkgdcmMSFF-5.3.lib(gdcmRLECodec.obj) : error LNK2001: unresolved external symbol _purecall
2>itkhdf5_cpp-static-5.3.lib(H5Location.obj) : error LNK2001: unresolved external symbol _purecall

please assist me in fixing these errors
Regards
Kunal

Niels Dekker

unread,
Feb 22, 2023, 9:51:50 AM2/22/23
to elastix-imageregistration
Thanks for asking, Kunal,  but honestly I do not know if https://github.com/rcorredorj/elastix-cpp-test is still compatible with the latest version (elastix 5.1.0 + ITK 5.3.0), as it was originally developed with ITK 4.11.0.

There is another example at https://github.com/SuperElastix/elastix/tree/5.1.0/dox/externalproject (" dox\externalproject" in your local elastix source tree), which is still tested regularly by our elastix CI.  Can you possibly try that one as well?

  Kind regards, Niels

BTW, Please note: our discussion forum is in the process of moving to https://github.com/SuperElastix/elastix/discussions

Kunal Yadav

unread,
Mar 23, 2023, 8:43:39 AM3/23/23
to elastix-imageregistration
Hi Niels,
  I did tried executing  the sample example code "ElastixTranslationExample.cxx", but i am getting many linking error.  Can you help me resolving that? what specific .lib libraries files of elastix and ITK i need to add to my c++ visual studio 2017 project.
How did i build elastix(5.1.0) and ITK(5.3.0):
1. downloaded the source code .
2.excuted the command cmake -s <sourcecode_directory -B <build folder>>
3. go to build directory.
4.open x74 native tool command window of vs2017.
5. executed command go to build directory."msbuild ALL_BUILD.vcxproj /p:Configuration=Release."

sample error:
ElastixITk.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl vnl_matrix<double>::~vnl_matrix<double>(void)" (??1?$vnl_matrix@N@@UEAA@XZ)
1>elastix-5.1.lib(elxComponentLoader.obj) : error LNK2001: unresolved external symbol "public: virtual __cdecl vnl_matrix<double>::~vnl_matrix<double>(void)" (??1?$vnl_matrix@N@@UEAA@XZ)
1>elxCommon-5.1.lib(elxTransformFactoryRegistration.obj) : error LNK2001: unresolved external symbol "public: virtual __cdecl vnl_matrix<double>::~vnl_matrix<double>(void)" (??1?$vnl_matrix@N@@UEAA@XZ)
1>elxCommon-5.1.lib(elxTransformFactoryRegistration.obj) : error LNK2001: unresolved external symbol "public: virtual __cdecl vnl_vector<double>::~vnl_vector<double>(void)" (??1


Thanks for your response,
Regards
Kunal
Reply all
Reply to author
Forward
0 new messages