From 2724451a32c3d77a9e94e49914a808530e49fc57 Mon Sep 17 00:00:00 2001 From: Valentin Boussot Date: Sat, 3 Oct 2026 20:11:16 +0200 Subject: [PATCH] BUG: Keep the real-CT test on the grid it shrinks to The test shrinks its lung CT pair by 3 to stay light on a CPU, and asked for features at a voxel size of 1 mm. That voxel size is honoured since the fine stage resamples the images itself, so the model saw the pair at 1 mm again, over a hundred times the voxels. The test went from 7 s to 40 s on Linux and Windows and from 4 s to 1400-1500 s on macOS, where it timed out on main two runs out of three. A voxel size of 0 takes the grid as it is, the workload the test had before. --- test/itkImpactBackendGTest.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/itkImpactBackendGTest.cxx b/test/itkImpactBackendGTest.cxx index 1dbf42e..a122eee 100644 --- a/test/itkImpactBackendGTest.cxx +++ b/test/itkImpactBackendGTest.cxx @@ -4569,14 +4569,16 @@ TEST(ImpactConvexAdam, RealLungCTCoarseInitThenAdamRefines) coarse->SetDisplacementHalfWidth(5); coarse->Update(); - // Fine stage: Adam refinement on the full-resolution 32-channel M258 feature layer. + // Fine stage: Adam refinement on the 32-channel M258 feature layer, extracted on the shrunk grid as it is + // (voxel size 0). A voxel size of 1 mm is honoured now: it resampled the shrunk pair, some 4 x 4 x 7.5 mm, to + // over a hundred times the voxels, and the test went from 4 s to 25 minutes on macOS. auto fine = TorchAdamFilterType::New(); fine->SetFixedImage(fixed); fine->SetMovingImage(moving); fine->SetDevice(device); fine->SetInitialDisplacementField(coarse->GetDisplacementField()); itk::ImpactModelConfiguration cfg( - modelPath, 3, 1, { 0, 0, 0 }, { 1.f, 1.f, 1.f }, { 0, 0, 0 }, { true, false }, false); + modelPath, 3, 1, { 0, 0, 0 }, { 0.f, 0.f, 0.f }, { 0, 0, 0 }, { true, false }, false); fine->AddModelConfiguration(cfg); fine->SetDistance({ "L2" }); fine->SetLayersWeight({ 1.f });