View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005006ITKpublic2007-05-09 18:302007-09-17 12:09
ReporterDan Mueller 
Assigned ToLuis Ibanez 
PrioritylowSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005006: Incorrect NumericTraits for RGBPixel
DescriptionIn Code/Common/itkNumericTraitsRGBPixel.h the ValueType, PrintType, and AbsType for unsigned short is incorrect (it has unsigned char, not unsigned short).

It currently reads:
/** \class NumericTraits<RGBPixel<unsigned short> >
 * \brief Define traits for type RGBPixel<unsigned char>.
 * \ingroup DataRepresentation
 */
template <>
class NumericTraits<RGBPixel<unsigned short> > {
public:
  typedef RGBPixel<unsigned char> ValueType; //<<
  typedef RGBPixel<unsigned char> PrintType; //<<
  typedef RGBPixel<unsigned char> AbsType; //<<
  typedef RGBPixel<unsigned short> AccumulateType;
  typedef RGBPixel<double> RealType;
  typedef double ScalarRealType;
  typedef RGBPixel<float> FloatType;
  static const RGBPixel<unsigned short> ITKCommon_EXPORT Zero;
  static const RGBPixel<unsigned short> ITKCommon_EXPORT One;
  static ValueType ZeroValue() { return Zero; }
  
};

but should read:
/** \class NumericTraits<RGBPixel<unsigned short> >
 * \brief Define traits for type RGBPixel<unsigned short>.
 * \ingroup DataRepresentation
 */
template <>
class NumericTraits<RGBPixel<unsigned short> > {
public:
  typedef RGBPixel<unsigned short> ValueType; //<<
  typedef RGBPixel<unsigned short> PrintType; //<<
  typedef RGBPixel<unsigned short> AbsType; //<<
  typedef RGBPixel<unsigned short> AccumulateType;
  typedef RGBPixel<double> RealType;
  typedef double ScalarRealType;
  typedef RGBPixel<float> FloatType;
  static const RGBPixel<unsigned short> ITKCommon_EXPORT Zero;
  static const RGBPixel<unsigned short> ITKCommon_EXPORT One;
  static ValueType ZeroValue() { return Zero; }
  
};

The comment is also wrong (has char instead of short).

I have attached a file with the correction.
TagsNo tags attached.
Resolution Date
Sprint
Sprint Status
Attached Files? file icon itkNumericTraitsRGBPixel.h [^] (2,381 bytes) 1969-12-31 19:00

 Relationships

  Notes
(0007608)
Dan Mueller (reporter)
2007-05-09 18:34

Just thinking, the AccumulateType should probably also be changed from <unsigned short> to <unsigned long>...
(0009013)
Luis Ibanez (manager)
2007-09-17 09:07

The report is correct,
the RGB traits of "unsigned short" are not defined correctly.

The AccumulateType is also missing to use a larger capacity type.
In order to be consistent with the NumericTraits<unsigned short>
the AccumulateType should use "int".

(0009014)
Luis Ibanez (manager)
2007-09-17 09:12

The Fix has been committed:
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkNumericTraitsRGBPixel.h?root=Insight&sortby=date&r2=1.10&r1=1.9 [^]
(0009026)
Luis Ibanez (manager)
2007-09-17 12:09

The Experimental submission from zion passed all the tests.

 Issue History
Date Modified Username Field Change
2007-09-17 09:07 Luis Ibanez Note Added: 0009013
2007-09-17 09:07 Luis Ibanez Status assigned => acknowledged
2007-09-17 09:12 Luis Ibanez Note Added: 0009014
2007-09-17 12:09 Luis Ibanez Status acknowledged => closed
2007-09-17 12:09 Luis Ibanez Note Added: 0009026
2007-09-17 12:09 Luis Ibanez Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team