Skip to content

Commit 1025c0b

Browse files
committed
BUG: Recompute Yvv GPU coefficients against actual input spacing
SetSigmaArray() reads spacing from GetOutput()->GetSpacing() at user-config time, where the output DataObject still carries the default unit spacing (1.0 in every dimension). The CPU sibling RecursiveLineYvvGaussianImageFilter recomputes the b-coefficients and M-matrix in BeforeThreadedGenerateData() using the actual input spacing. Add the equivalent recomputation at the entry of GPUGenerateData() so non-unit-spacing images (e.g. CT with 0.5 mm voxels) produce correct Gaussian kernels on the GPU path.
1 parent 192f846 commit 1025c0b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Modules/Filtering/SmoothingRecursiveYvvGaussianFilter/include/itkGPUSmoothingRecursiveYvvGaussianImageFilter.hxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ GPUSmoothingRecursiveYvvGaussianImageFilter<TInputImage, TOutputImage>::GPUGener
292292
this->BuildKernel();
293293
}
294294

295+
// Recompute the b-coefficients and M-matrix against the actual input spacing.
296+
// SetSigmaArray() reads GetOutput()->GetSpacing() before Update(), where the
297+
// output DataObject still carries the default unit spacing; the CPU sibling
298+
// recomputes per-call in BeforeThreadedGenerateData (see #6243).
299+
const typename InputImageType::SpacingType & inputSpacing = this->GetInput()->GetSpacing();
300+
if (inputSpacing[0] != 0)
301+
{
302+
this->SetUp(inputSpacing[0]);
303+
}
304+
295305
constexpr unsigned int X = 0;
296306
constexpr unsigned int Y = 1;
297307
constexpr unsigned int Z = 2;

0 commit comments

Comments
 (0)