<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="+1"><tt><br>
Well, on closer inspection there is a difference between what I did and
what you suggested.<br>
I am not inheriting the class from vcl_numeric_limits. I made this
class after looking at other similar classes in the ITK source files.<br>
<br>
Also, when defining the Zero and One for complex numbers we should
probably give two arguments, for the real and imaginary parts, instead
of one. So perhaps the files I sent you contain this bug.<br>
<br>
Best regards,<br>
Suyash.<br>
</tt></font><br>
<br>
Suyash P. Awate wrote:
<blockquote cite="mid4280DFDA.8040607@cs.utah.edu" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
<font size="+1"><tt><br>
Hello Jim,<br>
<br>
Yes, this is exactly what I did.<br>
I am attaching the .h and .cxx files for this class in this email.<br>
It would be great if these can be included in the ITK source.<br>
<br>
Thanks.<br>
<br>
Best regards,<br>
Suyash.<br>
<br>
</tt></font><br>
Miller, James V (Research) wrote:
<blockquote
cite="midFA26BEF1EA775E4584FB34B91E14A1C4B41941@SCHMLVEM01.e2k.ad.ge.com"
type="cite">
<pre wrap="">Suyash,
I am guessing your solution was to provide a specialization for
NumericTraits<std::complex<double> >. Something like...
template <>
class NumericTraits<std::complex<double> > : public vcl_numeric_limits<std::complex<double> > {
public:
typedef long std::complex<double> ValueType;
typedef long std::complex<double> PrintType;
...
};
If this was your solution, then if you send us your specialization code, we'll check it into
itk::NumericTraits
Jim
-----Original Message-----
From: <a class="moz-txt-link-abbreviated"
href="mailto:insight-users-bounces+millerjv=crd.ge.com@itk.org">insight-users-bounces+millerjv=crd.ge.com@itk.org</a>
[<a class="moz-txt-link-freetext"
href="mailto:insight-users-bounces+millerjv=crd.ge.com@itk.org">mailto:insight-users-bounces+millerjv=crd.ge.com@itk.org</a>]On Behalf Of
Suyash P. Awate
Sent: Monday, May 09, 2005 3:39 PM
To: <a class="moz-txt-link-abbreviated"
href="mailto:insight-users@public.kitware.com">insight-users@public.kitware.com</a>
Subject: [Insight-users] numeric traits for the std::complex < >
Hello,
I needed to use a vector of std::complex<double> in ITK and had some
compilation errors, i.e.
---
no type named `RealType' in `class
itk::NumericTraits<std::complex<double> >'
---
I solved the problem by writing my own NumericTraits class for this
datatype and my program compiles now. However, I was wondering if this
was the right way to solve the problem. Also, was there something
already existing in ITK that I could was used to obtain a more elegant
solution ?
I would appreciate any help with this. Thanks.
Best regards,
Suyash.
_______________________________________________
Insight-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Insight-users@itk.org">Insight-users@itk.org</a>
<a class="moz-txt-link-freetext"
href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>
</pre>
</blockquote>
<pre wrap="">
<hr size="4" width="90%">
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkNumericTraitsComplex.cxx,v $
Language: C++
Date: $Date: 2005/01/09 15:58:08 $
Version: $Revision: 1.3 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or <a class="moz-txt-link-freetext" href="http://www.itk.org/HTML/Copyright.htm">http://www.itk.org/HTML/Copyright.htm</a> for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "itkNumericTraitsComplex.h"
namespace itk
{
const std::complex<double> NumericTraits<std::complex<double> >::Zero = std::complex<double>( NumericTraits<double>::Zero );
const std::complex<double> NumericTraits<std::complex<double> >::One = std::complex<double>( NumericTraits<double>::One );
} // end namespace itk
</pre>
<pre wrap="">
<hr size="4" width="90%">
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkNumericTraitsComplex.h,v $
Language: C++
Date: $Date: 2005/01/09 15:58:08 $
Version: $Revision: 1.6 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or <a class="moz-txt-link-freetext" href="http://www.itk.org/HTML/Copyright.htm">http://www.itk.org/HTML/Copyright.htm</a> for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkNumericTraitsComplex_h
#define __itkNumericTraitsComplex_h
#include "itkNumericTraits.h"
#include <complex>
namespace itk
{
/** \class NumericTraits<std::complex<double> >
* \brief Define traits for type std::complex<double>.
* \ingroup DataRepresentation
*/
template <>
class NumericTraits<std::complex<double> > {
public:
typedef std::complex<double> ValueType;
typedef std::complex<double> PrintType;
typedef std::complex<double> AbsType;
typedef std::complex<double> AccumulateType;
typedef std::complex<double> RealType;
static const std::complex<double> ITKCommon_EXPORT Zero;
static const std::complex<double> ITKCommon_EXPORT One;
};
} // end namespace itk
#endif // __itkNumericTraitscomplex_h
</pre>
</blockquote>
</body>
</html>