Repository navigation
ENH: Wrap the Gaussian smoothing displacement field adaptors - #7143
hjmjohnson wants to merge 2 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
7af2c75 to
585b442
Compare
|
Second force-push (585b442 to 65747ca) is review fixes only, no rebase: the |
65747ca to
2964d26
Compare
2964d26 to
073840d
Compare
073840d to
3252cc1
Compare
3252cc1 to
0862dfb
Compare
|
Force-push |
|
@greptileai review |
dzenanz
left a comment
There was a problem hiding this comment.
Mostly looks good after a quick review.
gdevenyi
left a comment
There was a problem hiding this comment.
The wrapping looks correct to me. I read it against the wrapping macros, and CI is green.
WRAPPER_SUBMODULE_ORDERis needed.itk_auto_load_submodules.cmakeloads the.wrapfiles in sorted order, which would putitkTransformParametersAdaptorBaseafter the classes derived from it. The new Gaussian.wrapis appended after the three listed ones.ITKRegistrationCommonalready depends onITKDisplacementField, which wraps the transform.- The test's variances (2.0, 0.0) differ from the transform defaults (3.0, 0.5), so those checks are not vacuous. The
[2:-2]interior lies inside the coarse field (0 to 14 mm on a 0 to 15 mm grid).
Gap: the motivating use is not exercised. itkImageRegistrationMethodv4.wrap has no template with GaussianSmoothingOnUpdateDisplacementFieldTransform as the output transform; it has one for BSplineSmoothingOnUpdateDisplacementFieldTransform (BSOUDFT). From Python, the only route is an ImageRegistrationMethodv4 templated on DisplacementFieldTransform, given a Gaussian transform through SetInitialTransform. The adaptor's dynamic_cast in itkTransformParametersAdaptor.h:88 should then succeed. No test covers that path, or a Gaussian adaptor passing through itk.vector[AdaptorBase] and SetTransformParametersAdaptorsPerLevel. Could you either:
- add a few lines to the test that build that vector with
gaussian_adaptorand pass it to aDisplacementFieldTransformImageRegistrationMethodv4, or - add a
REGv4…GSOUDFTtemplate next to theBSOUDFTone?
Nit: GSOUDFT is mangled by hand in CMakeLists.txt. #6998 registered DFT with wrap_type in Wrapping/WrapITKTypes.cmake, though itkImageRegistrationMethodv4.wrap also hand-mangles BSOUDFT. Either is fine; wrap_type would match #6998.
|
@gdevenyi Thanks for the careful read. What the test checksIt runs a two-level The test sets its own optimizer, because the default optimizer's scales estimator keeps the default Mattes metric after |
d388b26 to
c6133b7
Compare
|
Force-push |
GaussianSmoothingOnUpdateDisplacementFieldTransform is optimized with ImageRegistrationMethodv4, which takes one parameter adaptor per level for a multi-resolution run, but its adaptors could not be built from Python. Add its templates to the displacement field and transform parameter adaptors, wrap its own adaptor, and load the adaptor base classes before the classes derived from them.
Run a two-level ImageRegistrationMethodv4 on a shifted blob with a GaussianSmoothingOnUpdateDisplacementFieldTransform as the initial transform and one Gaussian adaptor per level, passed through itk.vector[TransformParametersAdaptorBase]. The test checks that the adaptors set the update-field variance, that the final field is on the full-resolution grid, and that the blob center maps to the moving one.
c6133b7 to
8e40470
Compare
|
Force-push |
|
@greptileai review |
|
ARMBUILD-Python failed because the macOS linker crashed ( |
Wrap the adaptors for
GaussianSmoothingOnUpdateDisplacementFieldTransform, so a multi-resolutionImageRegistrationMethodv4run with that transform can take its per-level adaptors from Python.Builds on #6998 (@sdiebolt, merged), which wraps
TransformParametersAdaptor,DisplacementFieldTransformParametersAdaptor, and the adaptor vector.Follow-up, not in this PR:
BSplineSmoothingOnUpdateDisplacementFieldTransformParametersAdaptoris still unwrapped.Changes on top of #6998
TransformParametersAdaptorandDisplacementFieldTransformParametersAdaptorgainGaussianSmoothingOnUpdateDisplacementFieldTransform<double, D>templates.itkGaussianSmoothingOnUpdateDisplacementFieldTransformParametersAdaptor.wrap.WRAPPER_SUBMODULE_ORDERloads the adaptor base classes before the classes derived from them.itkDisplacementFieldTransformParametersAdaptorPythonTestadapts a plain and a Gaussian-smoothing displacement field to a finer grid.itkGaussianSmoothingDisplacementFieldRegistration{2,3}DPythonTestruns a two-levelImageRegistrationMethodv4with one Gaussian adaptor per level, and checks the final field size, the adaptor's variance, and the recovered shift.ImageRegistrationMethodv4is not wrapped for the Gaussian transform itself, so Python drives it through theDisplacementFieldTransforminstantiation withSetInPlace(True), as the registration test does.This PR first duplicated #6998's wrapping; it was rebuilt on top of #6998 and the duplicate parts were dropped, including a SyN registration test that #6998's multi-level SyN tests already cover.
AI assistance