I would like to use the surface_mesher of the CGAL library.
I managed to successfully compile the example mesh_a_3d_gray_image.cpp.
But when I try to use it with my own data which are in NifTi format (.nii), I run into the problem that it is not supported by CGAL. It seems that the only supported format is .inr, which doesn't seem to be very commonly used.
I tried to convert my data to other formats which seemed to be supported by CGAL, as specified in ImageIO_impl.h, but none of them could be succesfully imported.
I didn't find any tool to convert from NifTi to .inr. I found this old post: Troubles understanding .inr file format
It describes the .inr format, but doesn't hint to tools which could do the conversion I am looking for.
So is there a simple tool which can convert from NifTi to .inr?
I'm not really answering the question as I will tell you how to directly use NifTi images in CGAL.
From here you can see that such files could be used with code like the following:
vtkNew<vtkNIFTIImageReader> reader;
reader->SetFileName(fileinfo.filePath().toUtf8());
reader->Update();
auto vtk_image = reader->GetOutput();
vtk_image->Print(std::cerr);
*image = CGAL::IO::read_vtk_image_data(vtk_image); // copy the image data