-
-
Notifications
You must be signed in to change notification settings - Fork 663
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
ENH: Improve Thresholding module filters' coverage. #511
ENH: Improve Thresholding module filters' coverage. #511
Conversation
I still did not study @richardbeare 's last comment at the time the topic was being reviewed in gerrit. That will take some time. And there will be a few tests whose baseline needs to be updated. But this is a starting point as a refactoring and code coverage improvement. |
3233630
to
50e23cb
Compare
Just as a follow-up, generating all baselines and updating/adding them will take me quite some time. |
50e23cb
to
be4985e
Compare
Rebased on master to fix the merge conflicts. Have not yet reproduced the test results. |
be4985e
to
58582ad
Compare
58582ad
to
9eb112d
Compare
Rebased on master to avoid further conflicts when I find the time to review the topic. |
9eb112d
to
a6b148f
Compare
a6b148f rebased on master and addressed KWStyle warnings. Working on the baselines. |
a6b148f
to
484290c
Compare
A few comments about 484290c:
|
484290c
to
09dd192
Compare
The remaining errors are due to the causes explained above, which dot not look evident, so it will take some time to find the appropriate fixes. |
Did a quick first pass review. Looks good. I will do a more in-depth review when the tests pass. |
@fbudin69500 thanks for having a look. I started to have another look at the Well, it seems to be trickier than what it looks like. I'd dare to say that there is some sort of inheritance mess involved. When running the If I reimplement the So there is some sort of inheritance issue: the To be honest, I've spent some time trying to find an accurate explanation in order to propose a solution, but the best explanation I've come up to is the above, and still have not found a fix. |
09dd192
to
b9f31f7
Compare
Rebased on master after #999 has been merged. |
a7b9d73
to
a95d5f6
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
…shold Fix the threshold calculator inheritance issue in `itk::IntermodesThresholdImageFilter` by having a single histogram threshold calculator variable. The class was declaring a histogram threshold calculator under the `m_IntermodesCalculator` ivar, which was of type `itk::IntermodesThresholdCalculator` type. At the same time, the class was inheriting from `itk::HistogramThresholdImageFilter`, which was declaring its own histogram threshod calculator `m_Calculator`, which was of type `itk::HistogramThredholdCalculator`. This was making the `itk::IntermodesThresholdImageFilter` objects to have two histogram calculator instances, and given that the `GenerateData` method was implemented in the parent class (`itk::HistogramThresholdImageFilter`) and making use of the `m_Calculator` ivar, this was yielding a runtime error. Fixes the runtime exception error mentioned in [this comment](InsightSoftwareConsortium#511 (comment)).
163fa27
to
891898d
Compare
Folks, we are getting closer. A few comments:
I had a look at both issues without success. To be honest, if nobody has the bandwidth to address them in the following days (I personally don't) I'd comment both tests and open two issues so that the PR can be merged (if the rest of the tests pass).
TLDR: If only Sorry for the length of the message. |
891898d
to
632d5de
Compare
CI results are as anticipated in this comment. Please consider reading it and comment as appropriate. Thanks ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with those two tests commented in CMakeLists.txt, this is a big improvement. Hopefully it will nudge somebody to look into those two tests too.
Improve the ITKThresholding module filters' coverage: - Exercise basic object methods. Remove redundant calls to print the filter. - Exercise the Set/Get methods using the TEST_SET_GET_VALUE and On/Off methods using the TEST_SET_GET_BOOLEAN macro. - Use the TRY_EXPECT_NO_EXCEPTION macro for all filter update calls to save typing try/catch blocks. - Use TRY_EXPECT_EXCEPTION to try/catch expected exceptions when possible/appropriate. - Refactor the tests to accept (more) input parameters to check the classes under a broader range of conditions. In many cases, the parameters accepted belong to inherited propertis (e.g. itk::HistogramThresholdImageFilter: m_NumberOfHistogramBins, m_AutoMinimumMaximum, m_MaskOutput, m_MaskValue). Keep the default values of the class for existing tests. - Make the tests quantitative: compare the compute threshold to the expected one. - Add the hash code to compare to the baseline for new tests. - Remove unnecessary print messages. - Style changes: define the image dimension as a constant; use a typedef for the pixel type; use a variable to set the output's inside/outside value so that its Set/Get methods can be clearly tested; try to use the same sequence of sentences across all tests; change '\n' to std::endl. - Improve the messages in the threshold regression tests to make the consistent across the tests/the entire toolkit, and to provide rich information. - Finished the tests with a "Test finished" message; helps telling in the the dashboard whether the failure has happened in the test or the comparison to the baseline. - In itkBinaryThresholdImageFilterTest.cxx, set the functor before updating the filter. - Correct the arguments passed to SetSigmaFactor and SetNumberOfIterations in itkKappaSigmaThresholdImageFilterTest.cxx (the expected sigmaFactor as defined by the order in the CMakeLists command/usage explanation was being set to the number of iterations of the filter and vice-versa). Update the corresponding baselines accordingly. Take advantage of the commit to use C++11 features. Recovered from gerrit: Change-Id: I9d6050d9e474b17fe3639faa7a5b16c052440e21 https://review.source.kitware.com/%23/c/22134/
632d5de
to
e450780
Compare
So I commented the two failing tests and push-forced. If CIs still pass, this will be ready to be merged. I will open the related issues once it gets merged. Thanks. |
Not sure why Azure builds have not been reported. Anybody with the appropriate permissions to trigger those? Thanks. |
Occasionally they don't report. A force push with updated time should trigger them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this improvement!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, Jon Haitz!
Thank you all your bearing with the multiple unsuccessful commits and my intermittent dedication. This was team work. |
Improve the ITKThresholding module filters' coverage:
filter.
methods using the TEST_SET_GET_BOOLEAN macro.
save typing try/catch blocks.
possible/appropriate.
classes under a broader range of conditions. In many cases, the
parameters accepted belong to inherited propertis (e.g.
itk::HistogramThresholdImageFilter: m_NumberOfHistogramBins,
m_AutoMinimumMaximum, m_MaskOutput, m_MaskValue). Keep the default
values of the class for existing tests.
expected one.
for the pixel type; use a variable to set the output's inside/outside
value so that its Set/Get methods can be clearly tested; try to use the
same sequence of sentences across all tests; change '\n' to std::endl.
consistent across the tests/the entire toolkit, and to provide rich
information.
the dashboard whether the failure has happened in the test or the
comparison to the baseline.
updating the filter.
in itkKappaSigmaThresholdImageFilterTest.cxx (the expected sigmaFactor
as defined by the order in the CMakeLists command/usage explanation was
being set to the number of iterations of the filter and vice-versa).
Update the corresponding baselines accordingly.
Take advantage of the commit to use C++11 features.
Recovered from gerrit:
Change-Id: I9d6050d9e474b17fe3639faa7a5b16c052440e21
https://review.source.kitware.com/%23/c/22134/