Failed to build the ConeCalibrationPlugin

Dear ImFusion team,

I tried to build the ConeCalibrationPlugin ( ImFusionGmbH/PRO-TIP-Automatic-Ultrasound-Calibration (github.com)) using ImFusion SDK v2.42 on Windows 10.

It looks like that the PRO-TIP code only supports the SDK v2.41. For example, some header files structures in SDK v2.42 are different from that in SDK v2.41, which are used by the PRO-TIP code. In addition, after modifying the header file, I still got the following error.

I suspect that some DLL files are different in SDK v2.41 and v2.42.

Could you please provide some help how to fix it? Or if possible, where I can download the SDK v2.41. I could not find it myself in the forum.

Thanks in advance for your help and have a nice day!
Luohong

Hi Luohong, thanks for trying our plugin!

I tried compiling the plugin on my machine (I have a newer version than 2.42) and it worked without problems. Can you give me more details about which headers you had to change? If you could also copy and paste all the error messages it would be very helpful.

Thanks,
Matteo

Hi Matteo,

Thanks for your fast reply!

I am using the academic version SDK v2.42.4 from this link: Latest Academic Installers including Labels 2.42 - Academic - ImFusion Support Forum. This is the latest version available for academic user.

If I compiled the initial git code, I got the following error

’ Cannot open include file: ‘ImFusion/ML/Operations.h’: No such file or directory’

I checked the headers in my ImFusion Suite v2.42. Now there is no ‘Operations.h’ anymore. Instead, there is folder named ‘Operations’, and there are many .h files in it. For example,

‘operations/ReplaceLabelsValuesOperation.h’.

I checked the PRO-TIP code, the used operation is the ‘ReplaceLabelsValuesOperation’. So I modified the code from

#include <ImFusion/ML/Operations.h>’

to

#include <ImFusion/ML/Operations/ReplaceLabelsValuesOperation.h>’

, then I got the following error

D:\code\PRO-TIP-Automatic-Ultrasound-Calibration\ConeCalibrationPlugin\out\build\x64-Debug\ConeCalibrationAlgorithm.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl ImFusion::ML::MachineLearningModel::MachineLearningModel(class std::basic_string<char,struct std::char_traits,class std::allocator >,enum ImFusion::ML::PredictionOutput,bool)” (_imp??0MachineLearningModel@ML@ImFusion@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4PredictionOutput@12@_N@Z) referenced in function “public: int __cdecl ImFusion::ConeCalibrationAlgorithm::detectTips(int)” (?detectTips@ConeCalibrationAlgorithm@ImFusion@@QEAAHH@Z)
D:\code\PRO-TIP-Automatic-Ultrasound-Calibration\ConeCalibrationPlugin\out\build\x64-Debug\ConeCalibrationAlgorithm.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl ImFusion::Segmentation::Line2DReferenceShape::Line2DReferenceShape(class std::vector<class Eigen::Matrix<double,2,1,0,2,1>,class std::allocator<class Eigen::Matrix<double,2,1,0,2,1> > > const &)” (_imp??0Line2DReferenceShape@Segmentation@ImFusion@@QEAA@AEBV?$vector@V?$Matrix@N$01$00$0A@$01$00@Eigen@@V?$allocator@V?$Matrix@N$01$00$0A@$01$00@Eigen@@@std@@@std@@@Z) referenced in function “public: class std::vector<class ImFusion::ConeCalibrationAlgorithm::TrackedCone,class std::allocator > __cdecl ImFusion::ConeCalibrationAlgorithm::detectCones(class ImFusion::SharedImageSet *,int)” (?detectCones@ConeCalibrationAlgorithm@ImFusion@@QEAA?AV?$vector@VTrackedCone@ConeCalibrationAlgorithm@ImFusion@@V?$allocator@VTrackedCone@ConeCalibrationAlgorithm@ImFusion@@@std@@@std@@PEAVSharedImageSet@2@H@Z)

I hope that this is clear, otherwise please let me know and I will update.

Hi Luohong,

The second linker error indicates that you are missing to link against the ImFusionSeg plugin. This seems to be missing in the CMakeLists.txt of the ConCalibrationPlugin that is currently in our Github repository.
Could you please add it, i.e. change the target_link_libraries() call to this:

target_link_libraries(ConeCalibrationPlugin PRIVATE ImFusionLib ImFusionML ImFusionUS ImFusionSeg)

I’m unsure about the first linker warning though. Maybe my colleague @matteo_ronchetti has more ideas where this is coming from.

Cheers,
Christian

Hi Christian,

Indeed, you solution fixes the second linking error. Thanks a lot for your help!

Hi Matteo,

The second linking error was fixed. Could you please have a look at the first linking error? Thanks in advance and have a nice day!

I have 2.42.4 installed on my computer and the header of ML::MachineLearningModel does not seem compatible with the code of this plugin.
Now models are supposed to be instantiated via the helper function std::unique_ptr<MachineLearningModel> create(std::string configPath).
I am a bit skeptical though, because this should have triggered a compilation error rather than a linker error, but just to be sure: can you try to replace the lines here with something like

auto model = ML::MachineLearningModel::create(p_modelPath);
model->setProgress(m_progress);
std::unique_ptr<SharedImageSet> segmentation = model->predict(*us);

Hi Raphael,

Thanks for your help! It works now. : )