Hi,<div><br></div><div><br></div><div><br></div><div>Thanks a lot Vikas, Luis.</div><div><br></div><div>Yes Luis, your assumption was right, <span style>the norm that I wanted was the sum of norms of all the vectors in the array. </span></div>
<div><font color="#222222" face="arial, sans-serif">It worked out the way you suggested.</font></div><div><span style><br></span></div><div style><br></div><div style>:) </div><div style>Lisa</div><div><br></div><div><br>
<br><div class="gmail_quote">On 24 May 2012 06:23, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Lisa,<div><br></div><div><br></div><div>The only embarrassing questions </div><div>are those that are left unasked :-)<br><br><br>At this point we don't really have an ITK</div><div>class that encompasses the concept of</div>
<div>an "Array of Vectors", although you can</div><div>construct it with existing classes.<br><br>May I presume that the norm that you want</div><div>to compute for the Array of Vector is the </div><div>Sum of norms of all the Vectors in the array ?</div>
<div><br></div><div>If so, at this point the easy way to do this</div><div>would be to Instantiate an Array of Vectors,</div><div><br></div><div>and do a for loop visiting all the elements...</div><div><br></div><div>As Array classes you could use the:</div>
<div><br></div><div>typedef itk::Vectors< float, N > VectorType;</div><div><br></div><div>...</div><div><br></div><div>itk::Array< VectorType ></div><div><br></div><div>or</div><div><br></div><div>itk::VectorContainer< VectorType ><br>
<br>or simply one of the STL containers</div><div><br></div><div>std::list< VectorType ></div><div>std::vector< VectorType ><br><br>The code could look like:</div><div><br></div><div>typedef std::vector< VectorType > ArrayOfVectorType;</div>
<div><br></div><div>ArrayOfVectorType array = this->GetArraySomehow();<br><br>ArrayOfVectorType::const_iterator itr = array.begin();</div><div><br></div><div>double sum = 0.0;</div><div>while( itr != array.end() )</div>
<div> {</div><div> sum += itr->GetNorm();</div><div> ++itr;</div><div> }</div><div><br></div><div>std::cout << sum << std::endl;</div><div><br></div><div><a href="http://www.itk.org/Doxygen/html/classitk_1_1Vector.html#a0f103636ffc85fd3df1ae6c838d3e70e" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1Vector.html#a0f103636ffc85fd3df1ae6c838d3e70e</a> <br>
<br><br>Depending on your definition of norm</div><div>for an array of vectors, the code above</div><div>may need some retouching.<br><br><br> HTH</div><div><br></div><div><br></div><div> Luis<br><br><br>------------------------------------------------------<br>
<div class="gmail_quote"><div><div class="h5">On Tue, May 22, 2012 at 2:06 AM, Lisa Dean <span dir="ltr"><<a href="mailto:lisadean.leo@gmail.com" target="_blank">lisadean.leo@gmail.com</a>></span> wrote:<br></div></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br><div><br></div><div>Hi Users,</div><div><br></div><div><br></div><div>Forgive the embarrassingly basic question, but how do I find the squared norm of an itk array of vectors?</div><div><br></div><div><br></div><div>
<br>
</div><div>Thanks for the help</div><span><font color="#888888"><div><br></div><div>Lisa</div>
</font></span><br></div></div><div class="im">_____________________________________<br>
Powered by <a href="http://www.kitware.com" 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" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/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" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div><br></div>