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

BUG: Let elx::ConjugateGradientFRPR override ITK's FRPROptimizer #1118

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ class ITK_TEMPLATE_EXPORT ConjugateGradientFRPR
* This implementation calls the Superclass' implementation and caches
* the computed derivative's magnitude. Besides, it invokes the
* SelectNewSamples method. */
virtual void
GetValueAndDerivative(ParametersType p, double * val, ParametersType * xi);
void
GetValueAndDerivative(ParametersType & p, double * val, ParametersType * xi) override;
Comment on lines -170 to +171
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mstaring @stefanklein This might be a serious bug fix, at least if ConjugateGradientFRPR is still a relevant optimizer. Because of an ITK update back in 2008, ConjugateGradientFRPR did not properly override ITK's FRPROptimizer member functions anymore. (Note that this functionality is untested anyway.)


/** The LineBracket routine from NRC. Uses current origin and line direction
* (from SetLine) to find a triple of points (ax, bx, cx) that bracket the
Expand Down Expand Up @@ -206,8 +206,8 @@ class ITK_TEMPLATE_EXPORT ConjugateGradientFRPR
* store the line search direction's (xi) magnitude and call the superclass'
* implementation.
*/
virtual void
LineOptimize(ParametersType * p, ParametersType xi, double * val);
void
LineOptimize(ParametersType * p, ParametersType & xi, double * val) override;

private:
elxOverrideGetSelfMacro;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ ConjugateGradientFRPR<TElastix>::SetInitialPosition(const ParametersType & param

template <class TElastix>
void
ConjugateGradientFRPR<TElastix>::GetValueAndDerivative(ParametersType p, double * val, ParametersType * xi)
ConjugateGradientFRPR<TElastix>::GetValueAndDerivative(ParametersType & p, double * val, ParametersType * xi)
{
/** This implementation forces the metric to select new samples
* (if the user asked for this), calls the Superclass'
Expand Down Expand Up @@ -361,7 +361,7 @@ ConjugateGradientFRPR<TElastix>::BracketedLineOptimize(double ax,
*/
template <class TElastix>
void
ConjugateGradientFRPR<TElastix>::LineOptimize(ParametersType * p, ParametersType xi, double * val)
ConjugateGradientFRPR<TElastix>::LineOptimize(ParametersType * p, ParametersType & xi, double * val)
{
this->m_CurrentSearchDirectionMagnitude = xi.magnitude();
this->Superclass1::LineOptimize(p, xi, val);
Expand Down
Loading