refactor(io): make vtk and itk optional
Description
For some projects, it can be desirable to have as little as possible SOUP to monitor. ITK and VTK are big software pieces, but they are not always mandatory. Being able to get rid of them can be useful, but we would need a sage option to be sure they are not included by mistake, for instance by implicit dependencies.
Functional specifications
- We should be able to disable ITK and VTK-dependent libraries and modules at build time.
- In our sessions, we currently use VTK to store meshes and images. This was a simple solution for us, but this is not the most spread format and anyway, we would like to get rid of it most of the time.
- For images, we should use DICOM by default, and optionally NIFTI (through ITK, if enabled).
- For meshes, we should use the .PLY format, through our own implementation (or Assimp).
Technical specifications
- Add two CMake options
SIGHT_ENABLE_ITK
,SIGHT_ENABLE_VTK
,ON
by default- Add them in the shared
build.yml
job script of sight-gitlab, so that they can be switched off on demand
- Add them in the shared
- In
io_session
:- For images:
- Use
io_dicom
to read/write images. For unsupported pixel formats, simply throw. - Optionally, make it possible to configure the reader/writer in XML to switch to NIFTI (thus we would have all supported pixel formats available)
- Use
- For meshes:
- Implement a PLY reader/writer OR simply integrate assimp. We could use another 3rd part library but that should be dead simple to code and easier to maintain in the long-term... (Maybe get inspiration from https://github.com/assimp/assimp/blob/master/code/AssetLib/Ply/PlyLoader.cpp)
- For images:
- Extract
image_extruder
related code fromsight::filter::image
andsight::module::filter::image
into new a library and a new module,sight::filter::viz
andsight::module::filter::viz
. They are widely used because of the volume rendering extrusion code, thus implying a dependency on ITK for every software using it although it does not use it.
Test plan
- In child projects, try the new options with some apps...