<div dir="ltr"><div><div>Hello Fabio,<br><br></div>The itk::OptimizerParameter class is derived from the class vnl_vector, which allows you to get the different component of the transform it contains using the "get( <nth_component>)" method.<br>The way to use it is as follow:<br>a=itk.AffineTransform.New()<br>b=a.GetParameters()<br>b.get(0)<br><br>If you want to have direct access to the element of the array in Python without the use of the "get()" method, you need to download and compile one of the latest commits of ITK (more recent than commit 991f67ee0c377d59acdedf40382b28<wbr>04f068b47b merged on December 13th, 2016)<br>and compile ITK with the CMake option Module_BridgeNumPy set to ON to compile the remote module NumpyBridge. Then you can simply do:<br><br>a=itk.AffineTransform.New()<br>b_array=itk.GetArrayFromVnlVector(a.GetParameters())<br><br></div><div>Hope this helps,<br><br></div><div>Francois<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 31, 2016 at 5:13 AM, D'Isidoro Fabio <span dir="ltr"><<a href="mailto:fisidoro@ethz.ch" target="_blank">fisidoro@ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="DE-CH">
<div class="gmail-m_-3220705611253368730m_-1580206043541524819WordSection1">
<p class="MsoNormal">Hallo,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-US">within the context of exploring the domain of an image metric (MeanSquaresImageMetric1.cxx), I want to check the current parameters used for the translation transform:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US">parameters = transform.GetParameters()</span><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US">parameters[0] = dx<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US">parameters[1] = dy<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US">metric.SetParameters( parameters )<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal">If I then code:<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black">print(metric.GetParameters())<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I get the proxy of Swig Object, from which I can’t see the parameters.</span><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black"><img style="width: 10.0312in; height: 0.3541in;" id="gmail-m_-3220705611253368730m_-1580206043541524819Picture_x0020_1" src="cid:image001.png@01D26356.608C9950" width="963" height="34"></span><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I have tried in many ways:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black">print(metric.GetParameters()[0<wbr>])<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black">print(metric.GetParameters()[1<wbr>])<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:green" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black">print(metric.GetTransform().Ge<wbr>tParameters())<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:consolas;color:black" lang="EN-US">print(metric.GetTransform().Ge<wbr>tParameters().GetElement(0))<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">but none of them works.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">How can I get the elements from the Swig Object?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thank you!<span class="gmail-m_-3220705611253368730HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p><span class="gmail-m_-3220705611253368730HOEnZb"><font color="#888888">
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Fabio</span><span><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</font></span></div>
</div>
<br>______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/product<wbr>s/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FA<wbr>Q</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a><br>
<br></blockquote></div><br></div></div>