COMP: Migrate deprecated itkTypeMacro/itkNewMacro for ITK 6 (release-5.4 compatible)#47
Open
hjmjohnson wants to merge 6 commits into
Open
Conversation
…acro ITK 6 built with ITK_FUTURE_LEGACY_REMOVE turns itkTypeMacro(thisClass, superclass) into a static_assert(false, ...) that instructs callers to use itkOverrideGetNameOfClassMacro(thisClass) instead. Migrate all call sites. itkOverrideGetNameOfClassMacro has existed since ITK 5.4.0, so this remains compatible with the release-5.4 series.
…fClassMacro Under ITK_FUTURE_LEGACY_REMOVE, itkTypeMacroNoParent(thisClass) becomes a static_assert(false, ...) directing callers to itkVirtualGetNameOfClassMacro. Available since ITK 5.4.0, so release-5.4 compatibility is preserved.
ITK 6's itkNewMacro ends in ITK_MACROEND_NOOP_STATEMENT (a static_assert enforcing a trailing semicolon), so bare itkNewMacro(Self) fails to parse. Add the semicolons; harmless (empty declaration) under release-5.4.
Author
|
@pyushkevich Preparing for ITKv6 compatibility. These changes are all ITK 5.4 compatible as well. |
The VXL 2026-06-09 sync removed vnl/vnl_file_matrix.h. GeneralLinearModel read its design and contrast matrices via vnl_file_matrix<double>; replace that with a small whitespace-delimited ASCII reader producing a vnl_matrix<double>, which builds against both the release-5.4 VNL (header still present) and ITK 6 VNL (header removed). VoxelwiseRegression only carried a stale include; drop it.
…cros ITK 6 defines ITK_MACROEND_NOOP_STATEMENT as static_assert(true, ""), so every itk data-access macro (itkGetMacro, itkSetMacro, itkOverrideGetNameOfClassMacro) must be terminated with a semicolon; bare invocations fail with "expected ';' after 'static_assert'". Add the semicolons; harmless (empty declaration) under release-5.4 where the noop statement expands to nothing.
The VXL 2026-06-09 sync removed vnl/vnl_finite.h. WrapDimension only carried a stale include of it (no vnl_finite_int usage), so remove the include. Builds against both release-5.4 and ITK 6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make c3d build against ITK 6 — including builds configured with
ITK_FUTURE_LEGACY_REMOVEand with the VXL 2026-06-09 VNL — while remaining compatible with the ITK release-5.4 series.Verified: full c3d source compiles and links against both ITK 6 (all executables produced) and ITK v5.4.6 (zero errors).
Root cause
Three independent ITK 6 breakages:
ITK_FUTURE_LEGACY_REMOVE,itkTypeMacro/itkTypeMacroNoParentbecomestatic_assert(false, …)directing callers toitkOverrideGetNameOfClassMacro/itkVirtualGetNameOfClassMacro.ITK_NOOP_STATEMENTasstatic_assert(true, "")unconditionally, and every itk macro ends in it — so bareitkGetMacro/itkSetMacro/itkNewMacro/itkOverrideGetNameOfClassMacroinvocations (no trailing;) fail withexpected ';' after 'static_assert'. (ITK 5.4 left this expansion empty, so the same code built there.)vnl/vnl_file_matrix.handvnl/vnl_finite.h.Changes (six commits)
itkTypeMacro(X, Super)→itkOverrideGetNameOfClassMacro(X)itkTypeMacroNoParent(X)→itkVirtualGetNameOfClassMacro(X);onitkNewMacroinvocationsvnl_file_matrix<double>with a small ASCII matrix reader (GeneralLinearModel); drop a stale include inVoxelwiseRegression;onitkGetMacro/itkSetMacro/itkOverrideGetNameOfClassMacroinvocationsvnl/vnl_finite.hinclude inWrapDimensionReplacement macros exist since ITK 5.4.0; added semicolons are empty declarations under 5.4; the ASCII reader depends only on
vnl_matrix+<fstream>. All six changes build against both series.Verification
MorphologicalContourInterpolationremote module): full source compiles (91/91), linksc3d,c2d,c4d,c3d_affine_tool;c3d -versionruns.configure rc=0,build rc=0, zero errors.