[Insight-users] Set LBFGSB bounds by GetOptimizer()

Seth Gilchrist seth at mech.ubc.ca
Thu Oct 13 12:49:14 EDT 2011


Hello all,
I got this code to compile and run using a reinterpret_cast

reinterpret_cast<itk::LBFGSBOptimizer
*>(this->m_Registration->GetOptimizer())->SetBoundSelection( boundSelect );
reinterpret_cast<itk::LBFGSBOptimizer
*>(this->m_Registration->GetOptimizer())->SetUpperBound( upperBound );
reinterpret_cast<itk::LBFGSBOptimizer
*>(this->m_Registration->GetOptimizer())->SetLowerBound( lowerBound );

If there is a better way, I'm open to suggestions!

Thanks,
Seth



On Thu, Oct 13, 2011 at 8:55 AM, Seth Gilchrist <seth at mech.ubc.ca> wrote:

> Hello,
> I'm trying to set the bounds of my optmiziation using:
>
> this->m_Registration->GetOptimizer()->SetBoundSelection( boundSelection );
> this->m_Registration->GetOptimizer()->SetUpperBound( upperBound );
> this->m_Registration->GetOptimizer()->SetLowerBound( lowerBound );
>
> The compiler returns:
> error: ‘class itk::SingleValuedNonLinearOptimizer’ has no member named
> ‘SetBoundSelection’
> error: ‘class itk::SingleValuedNonLinearOptimizer’ has no member named
> ‘SetUpperBound’
> error: ‘class itk::SingleValuedNonLinearOptimizer’ has no member named
> ‘SetLowerBound’
>
> m_Registration is a private image registration method to my class and
> boundSelction, upperBound and lowerBound are all of type itk::Array< long >
> because I couldn't use:
>
> typename ImageRegistrationType::OptimizerType::BoundSelectionType
> boundSelect, etc without getting the compiler error:
>
> error: no type named ‘BoundsSelectionType’ in ‘class
> itk::SingleValuedNonLinearOptimizer’
>
> I see that OptimizerType in the ImageRegistrationMethod
> is itk::SingleValuedNonLinearOptimizer, but is there a way I can do this
> without having to explicitly define each optimizer that my class might need?
>  I would like to keep the class simple, and just have switching of
> registration setup using detection of the optimizer and metric types (I plan
> to use a strcmp of GetNameOfClass() and the optimizer class name to do
> this).
>
> Thanks for your help,
> Seth
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111013/094afded/attachment.htm>


More information about the Insight-users mailing list