[Insight-users] access to vnl_conjugate_gradient methods from Python

Parra, Nestor NParra at med.miami.edu
Fri May 14 11:24:17 EDT 2010


Dear ITK geniuses:

I am using the ITK library for image registration in Python.

I am successfully creating the following optimizer object and its VNL implementation:

optimizer = itk.ConjugateGradientOptimizer.New()
vnlOptimizer = optimizer.GetOptimizer()

and I need to call:
vnlOptimizer.set_max_function_evals( Max_Iterations )

but vnlOptimizer seems to be a (SWIG??) pointer represented as a string:

>>> vnlOptimizer.__class__
<type 'str'>
>>> str(vnlOptimizer)
'_584aa110_p_vnl_conjugate_gradient'
>>> optimizer.__class__
<class 'ITKOptimizers.itkConjugateGradientOptimizer_PointerPtr'>
>>> str(optimizer)
'<C itk::SmartPointer<(itk::ConjugateGradientOptimizer)> instance at _b8157206_p_itk__SmartPointerTitk__ConjugateGradientOptimizer_t>'

My question is:

How do I dereference the string representation to get back the vnl_conjugate_gradient object itself, so I can call its methods?

Thank you so much,
Andres

Nestor Andres Parra
Intermediate Programmer
Department of Radiology
Miller School of Medicine, University of Miami
1150 N.W. 14th St., Suite 713
Miami, FL 33136


More information about the Insight-users mailing list