From e3db18c5aaddd13c8d8c1a5913bcf2600526abed Mon Sep 17 00:00:00 2001 From: Valentin Boussot Date: Tue, 25 Aug 2026 01:39:06 +0200 Subject: [PATCH] fix(itk-wasm): spell TimeVaryingVelocityField parameterizations with the y The TransformParameterizations table spelled two entries TimeVaringVelocityField and GaussianSmoothingOnUpdateTimeVaringVelocityField, both as key and as value. Everywhere else the name carries the y: the JSONTransformParameterizationEnum in itkTransformJSON.h, the C++ class names the serializer matches on, and the Python itkwasm TransformParameterizations enum. A TypeScript consumer comparing transformParameterization against any of those never matched these two entries. Correct the four spellings and add a test that every value is its own key and that the two time-varying entries match the ITK class names. Closes #1591 --- .../transform-parameterizations.ts | 6 +++--- .../transform-parameterizations-test.js | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 packages/core/typescript/itk-wasm/test/node/interface-types/transform-parameterizations-test.js diff --git a/packages/core/typescript/itk-wasm/src/interface-types/transform-parameterizations.ts b/packages/core/typescript/itk-wasm/src/interface-types/transform-parameterizations.ts index 5c059073d..b3c876a83 100644 --- a/packages/core/typescript/itk-wasm/src/interface-types/transform-parameterizations.ts +++ b/packages/core/typescript/itk-wasm/src/interface-types/transform-parameterizations.ts @@ -27,9 +27,9 @@ const TransformParameterizations = { 'GaussianSmoothingOnUpdateDisplacementField', GaussianExponentialDiffeomorphic: 'GaussianExponentialDiffeomorphic', VelocityField: 'VelocityField', - TimeVaringVelocityField: 'TimeVaringVelocityField', - GaussianSmoothingOnUpdateTimeVaringVelocityField: - 'GaussianSmoothingOnUpdateTimeVaringVelocityField' + TimeVaryingVelocityField: 'TimeVaryingVelocityField', + GaussianSmoothingOnUpdateTimeVaryingVelocityField: + 'GaussianSmoothingOnUpdateTimeVaryingVelocityField' } as const export default TransformParameterizations diff --git a/packages/core/typescript/itk-wasm/test/node/interface-types/transform-parameterizations-test.js b/packages/core/typescript/itk-wasm/test/node/interface-types/transform-parameterizations-test.js new file mode 100644 index 000000000..da182168c --- /dev/null +++ b/packages/core/typescript/itk-wasm/test/node/interface-types/transform-parameterizations-test.js @@ -0,0 +1,20 @@ +import test from 'ava' + +import { TransformParameterizations } from '../../../dist/index-node.js' + +test('every parameterization value is its own key', (t) => { + for (const [key, value] of Object.entries(TransformParameterizations)) { + t.is(value, key) + } +}) + +test('time-varying velocity field parameterizations match the ITK class names', (t) => { + t.is(TransformParameterizations.TimeVaryingVelocityField, 'TimeVaryingVelocityField') + t.is( + TransformParameterizations.GaussianSmoothingOnUpdateTimeVaryingVelocityField, + 'GaussianSmoothingOnUpdateTimeVaryingVelocityField' + ) + for (const key of Object.keys(TransformParameterizations)) { + t.false(key.includes('Varing')) + } +})