How to integrate external libraries such as CGAL with slicer 3D?
If you work in Python then you can pip install cgal. If you work in C++ then you can create a superbuild-type extension (that downloads and builds its own dependent libraries, for example how SlicerRT extension builds Plastimatch library).
For C++, an example is OpenCV
I have already downloaded and build the 3D slicer from github, and its running. Now the question is I’m not under standing how add some external libraries from other opensource softwares like CGAL etc…
and how to remove the existing libraries from 3D slicer which I don’t want…
Kindly elaborate please.
That’s a big topic, but the basics are that Slicer is at the core a C++ application with a build system based on CMake, so you can add or remove libraries as needed using pretty standard methods.
Of course there are also lots of conventions, so you would do well to study the examples that @lassoan and @adamrankin pointed to already.
And you can review any of the developer documentation to learn how Slicer is built.