Build Light Weight Robot IGT module

Operating system:Win 7
Slicer version: build slicer V. 4.11
Expected behavior:
Actual behavior:

Hello everybody,

I tried to build the Light Weight Robot IGT module after building the Slicer on my system. After fixing all the compilation errors, I faced with error LNK 2005 as follows which i have no idea how to fix.


Error LNK2005 “public: static class vtkIGTLToMRMLString * __cdecl vtkIGTLToMRMLString::New(void)” (?New@vtkIGTLToMRMLString@@SAPEAV1@XZ) already defined in vtkIGTLToMRMLString.obj

project: vtkSlicerLightWeightRobotIGTModuleMRML

file:vtkSlicerOpenIGTLinkIFModuleMRML.lib(vtkSlicerOpenIGTLinkIFModuleMRML.dll)


This error is appeared when i add the “vtkSlicerOpenIGTLinkIFModuleMRML.lib” to the linker of the “vtkSlicerLightWeightRobotIGTModuleMRML” project in configuration properties in visual studio.

I would be so appreciated if anyone could help me to fix the error.

Support for STRING message type is now part of OpenIGTLinkIF. You can remove vtkIGTLToMRMLString class from LightWeightRobotIGT.

vtkIGTLToMRMLString in LightWeightRobotIGT saved text data to vtkMRMLAnnotationTextNode, while OpenIGTLinkIF uses vtkMRMLTextNode, so LightWeightRobotIGT need to be updated accordingly.

1 Like

Thanks Mr. Lasso,
I can fix the errors and build the module based on your suggestion.

But another problem is how to use and install the module in Slicer. I add the path containing the following folder to the “edit—application settings—modules—additional module paths” and then restart the Slicer.
**
the path is:
E:\LightWeightRobotIGT\B\lib\Slicer-4.11\qt-loadable-modules
**
But it seems that there is no changes after restarting the Slicer and even there is no additional module in all modules.

I am waiting for your guidance…

You need to add SlicerOpenIGTLink extension paths to additional module paths. Third-party DLLs need to be added to the same folder where module DLLs are or you need to use the generated additional launcher settings .ini file (that should take care of both the additional module paths and third-party library paths).

Once things are working, please send a pull request with your changes so that we can review, give feedback, merge them. Thank you!

Dear Mr. Lasso,

you mean that the OpenIGTLink is the third party for the LightWeightRobotIGT?
I built the OpenIGTLink but unfortunately there is no .dll file in OpenIGTLink library folder, there exist just .lib and .exp files.

Besides, how can i use the additional launcher settings .ini file?

I am so interesting to use this module and Slicer and i would be so appreciated if you could help me through.

@Sunderlandkyl could you help @Mary7291 with details steps? Thanks!

Note that the path for a module should look like the following:
E:\d\s\SlicerOpenIGTLinkD\inner-build\lib\Slicer-4.11\qt-loadable-modules\Debug
If your extension includes Python modules, then you also need to add:
E:\d\s\SlicerOpenIGTLinkD\inner-build\lib\Slicer-4.11\qt-scripted-modules

You need to specify the additional-module-paths for SlicerOpenIGTLink, as well as one of the following:

  1. Within SlicerOpenIGTLink build, third-party DLLs are in the folder:
    E:\d\s\SlicerOpenIGTLinkD/bin/Release or E:\d\s\SlicerOpenIGTLinkD/bin/Debug
    and
    Copy the DLLs from the folder above to:
    E:\d\s\SlicerOpenIGTLinkD\inner-build\lib\Slicer-4.11\qt-loadable-modules\Release or E:\d\s\SlicerOpenIGTLinkD\inner-build\lib\Slicer-4.11\qt-loadable-modules\Debug

  2. You can start Slicer with the following option:
    Slicer.exe --launcher-additional-settings E:\d\s\SlicerOpenIGTLinkD\inner-build\AdditionalLauncherSettings.ini

1 Like

Thanks Mr. Sunderland,

The SlicerOpenIGTLink is now added to Slicer modules based on your guidance.

I want to use the LightWeightRobotIGT module which it’s source code can be found here:
https://github.com/SNRLab/LightWeightRobotIGT .
The qt loadable modules are built after building the module in VS2015. The path to the lib folder is as follows:
E:\LightWeightRobotIGT\B\lib\Slicer-4.11\qt-loadable-modules\Release.

Would you please guide me through the installing the module in Slicer?

Can you upload your changes to the LightWeightRobotIGT to a GitHub branch somewhere?

If everything compiles correctly, you should only need to add E:\LightWeightRobotIGT\B\lib\Slicer-4.11\qt-loadable-modules\Release to the additional-module-paths.

(Scenario 1) I was built the LightWeightRobotIGT (LWRIGT) module based on the OpenIGTLink and OpenIGTLinkIF which can be found from:
https://github.com/openigtlink/OpenIGTLink,
and
https://github.com/openigtlink/OpenIGTLinkIF.
This way and after building the above two modules, the LWRIGT was compiled in VS2015 and the errors were fixed step by step by adding the header and library files to the corresponding project in VS.

(Scenario 2) But now and based on your guidance i found another url as: https://github.com/openigtlink/SlicerOpenIGTLink, which i could load the OpenIGTLink Extension to the module paths after building this extension.

Please let me know if there is any difference in building the LWRIGT module based on these two scenarios…

OpenIGTLink and OpenIGTLinkIF are compiled as part of the SlicerOpenIGTLink extension.

What you will need to do is add SlicerOpenIGTLink as a dependency of LightWeightRobotIGT.
For example, the SlicerIGSIO extension depends on the Sequences extension:(https://github.com/IGSIO/SlicerIGSIO/blob/master/CMakeLists.txt)

You will then need to get LightWeightRobotIGT to compile using SlicerOpenIGTLink instead of using openigtlink/OpenIGTLinkIF.

I am trying to build the module based on your suggestion by adding these two lines to the CMake:


set(EXTENSION_DEPENDS “SlicerOpenIGTLink”)
and
find_package(SlicerOpenIGTLink REQUIRED


But after compiling the project in VS, the error which says that it can not open the ‘vtkIGTLTOMRMLBASE.h’ file is appeared. On the other hand there is no such file in any of the ‘Slicer OpenIGTLink’ folders to add to the VC/VC++ configuration properties.

would you please help me to substitute the file or please let me know that if something wrong will happen by adding the ‘vtkIGTLTOMRMLBASE.h’ file from ‘OpenIGTLinkIF’ folder??
@lassoan @Sunderlandkyl

What is vtkIGTLTOMRMLBASE used for?

The process to convert IGTL messages to MRML nodes is already done by SlicerOpenIGTLink.