Update examples following Image_3 IO changes

This commit is contained in:
Mael Rouxel-Labbé 2024-02-16 12:28:41 +01:00
parent 9841d9755c
commit 9a7c6b4573
1 changed files with 11 additions and 5 deletions

View File

@ -95,17 +95,23 @@ int main(int argc, char* argv[])
}
// convert image to a Cartesian grid
auto [grid, values] = IS::IO::read_Image_3<Kernel>(image);
Grid grid;
Values values { grid };
if(!IS::IO::read_Image_3(image, grid, values))
{
std::cerr << "Error: Cannot convert image to Cartesian grid" << std::endl;
return EXIT_FAILURE;
}
std::cout << "Bbox: " << grid.bbox() << std::endl;
std::cout << "Cell dimensions: " << grid.spacing()[0] << " " << grid.spacing()[1] << " " << grid.spacing()[2] << std::endl;
std::cout << "Cell #: " << grid.xdim() << ", " << grid.ydim() << ", " << grid.zdim() << std::endl;
for (std::size_t i=0; i<grid.xdim(); ++i)
for (std::size_t j=0; j<grid.ydim(); ++j)
for (std::size_t k=0; k<grid.zdim(); ++k)
values(i, j, k) = - values(i, j, k); // inside out
std::cout << "Bbox: " << grid.bbox() << std::endl;
std::cout << "Cell dimensions: " << grid.spacing()[0] << " " << grid.spacing()[1] << " " << grid.spacing()[2] << std::endl;
std::cout << "Cell #: " << grid.xdim() << ", " << grid.ydim() << ", " << grid.zdim() << std::endl;
run_marching_cubes(grid, isovalue, values);
run_dual_contouring(grid, isovalue, values);