Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check thisClass argument of GetNameOfClass macro calls, fix class name returned by GetNameOfClass() overrides #4378

Conversation

N-Dekker
Copy link
Contributor

@N-Dekker N-Dekker commented Dec 27, 2023

Added a compile-time check on the thisClass argument of both itkVirtualGetNameOfClassMacro and itkOverrideGetNameOfClassMacro. Fixed the class name returned by three GetNameOfClass() overrides, including BinaryImageToLevelSetImageAdaptor::GetNameOfClass()

`BinaryImageToLevelSetImageAdaptor::GetNameOfClass()` erroneously returned
"BinaryImageToLevelSetImageAdaptorBase", while it should just return
"BinaryImageToLevelSetImageAdaptor". Fixed by passing the correct class name to
`itkOverrideGetNameOfClassMacro`.

Bug introduced with commit ab469f5
"ENH: Refactor BinaryImageToLevelSetImageAdaptor classes", 2011-11-11.
Fixed the class names returned by the `GetNameOfClass()` member functions of
`amoebaTestF2` (from "itkAmoebaOptimizerTest") and `LBFGSCostFunction` (from
"itkLBFGSOptimizerTest"), by passing the correct class name to
`itkOverrideGetNameOfClassMacro`.
Asserted in both `itkVirtualGetNameOfClassMacro` and
`itkOverrideGetNameOfClassMacro` that `thisClass` is indeed the name of the
class that contains the macro call.

The assert helped finding three classes whose `GetNameOfClass()` member function
returned the wrong name.
@github-actions github-actions bot added type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Core Issues affecting the Core module area:Segmentation Issues affecting the Segmentation module area:Numerics Issues affecting the Numerics module labels Dec 27, 2023
@N-Dekker N-Dekker marked this pull request as ready for review December 27, 2023 20:40
@hjmjohnson hjmjohnson merged commit d45127b into InsightSoftwareConsortium:master Jan 2, 2024
12 checks passed
@issakomi
Copy link
Member

issakomi commented Jan 4, 2024

This line itkTypeMacro(Image, Object); here causes build failures, e.g. https://open.cdash.org/viewBuildError.php?buildid=9275586

@dzenanz
Copy link
Member

dzenanz commented Jan 4, 2024

PR open: InsightSoftwareConsortium/ITKMontage#224.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:Numerics Issues affecting the Numerics module area:Segmentation Issues affecting the Segmentation module type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants