[Insight-developers] GetNorm()

Marius Staring marius at isi.uu.nl
Mon Jan 14 07:40:33 EST 2008


Hi developers,

I think the itk::VariableLengthVector is missing a function GetNorm(), 
similar to itk::Vector

This can be fixed by adding

  /** Returns vector's Euclidean Norm  */
  RealValueType GetNorm() const;

to the header file, and

/**
 * Returns vector's Euclidean Norm
 */
template < typename TValueType >
typename VariableLengthVector< TValueType >::RealValueType
VariableLengthVector<TValueType >
::GetNorm( void ) const
{
  return RealValueType( vcl_sqrt(double(this->GetSquaredNorm()) ));
}

to the txx. I tested this code under windows xp and visual c++ 2003.

The function GetNorm() is for example used in the 
GradientToMagnitudeImageFilter, so currently this filter won't work with 
images of VariableLengthVector pixel type.

Regards,

Marius

-- 
Marius Staring
Image Sciences Institute
University Medical Centre Utrecht
Heidelberglaan 100, 3584 CX Utrecht, The Netherlands
phone: +31 (0)88 75 53186, fax: +31 (0)30 251 3399
marius at isi.uu.nl, http://www.isi.uu.nl/People/Marius



More information about the Insight-developers mailing list