[Insight-users] Norm in ITK
Lisa Dean
lisadean.leo at gmail.com
Fri May 25 06:45:05 EDT 2012
Hi,
Thanks a lot Vikas, Luis.
Yes Luis, your assumption was right, the norm that I wanted was the sum of
norms of all the vectors in the array.
It worked out the way you suggested.
:)
Lisa
On 24 May 2012 06:23, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Lisa,
>
>
> The only embarrassing questions
> are those that are left unasked :-)
>
>
> At this point we don't really have an ITK
> class that encompasses the concept of
> an "Array of Vectors", although you can
> construct it with existing classes.
>
> May I presume that the norm that you want
> to compute for the Array of Vector is the
> Sum of norms of all the Vectors in the array ?
>
> If so, at this point the easy way to do this
> would be to Instantiate an Array of Vectors,
>
> and do a for loop visiting all the elements...
>
> As Array classes you could use the:
>
> typedef itk::Vectors< float, N > VectorType;
>
> ...
>
> itk::Array< VectorType >
>
> or
>
> itk::VectorContainer< VectorType >
>
> or simply one of the STL containers
>
> std::list< VectorType >
> std::vector< VectorType >
>
> The code could look like:
>
> typedef std::vector< VectorType > ArrayOfVectorType;
>
> ArrayOfVectorType array = this->GetArraySomehow();
>
> ArrayOfVectorType::const_iterator itr = array.begin();
>
> double sum = 0.0;
> while( itr != array.end() )
> {
> sum += itr->GetNorm();
> ++itr;
> }
>
> std::cout << sum << std::endl;
>
>
> http://www.itk.org/Doxygen/html/classitk_1_1Vector.html#a0f103636ffc85fd3df1ae6c838d3e70e
>
>
>
> Depending on your definition of norm
> for an array of vectors, the code above
> may need some retouching.
>
>
> HTH
>
>
> Luis
>
>
> ------------------------------------------------------
> On Tue, May 22, 2012 at 2:06 AM, Lisa Dean <lisadean.leo at gmail.com> wrote:
>
>>
>>
>> Hi Users,
>>
>>
>> Forgive the embarrassingly basic question, but how do I find the squared
>> norm of an itk array of vectors?
>>
>>
>>
>> Thanks for the help
>>
>> Lisa
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120525/e469c0b8/attachment-0001.htm>
More information about the Insight-users
mailing list