MantisBT - ITK
View Issue Details
0010124ITKpublic2010-01-12 10:072010-10-21 12:31
Bradley Lowekamp 
Bradley Lowekamp 
normalminorhave not tried
closedfixed 
 
ITK-3-18 
0010124: ImageIO methods ReadBufferAsASCII and WriteBufferAsASCII do not handle signed and unsigned chars correctly
These methods read or write the character as a single character and not as a number. That is if a pixel has the value 48 then "0" is written instead of "48".

This is different then what is needed for the VTK file format.
Proposed solution:
template <class TComponent>
void WriteBuffer(std::ostream& os, const TComponent *buffer, ImageIOBase::SizeType num)
{
  const TComponent *ptr = buffer;
  typedef typename itk::NumericTraits<TComponent>::PrintType PrintType;
  for (ImageIOBase::SizeType i=0; i < num; i++)
    {
    if ( !(i%6) && i )
      os << "\n";
    os << PrintType(*ptr++) << " ";
    }
}
No tags attached.
Issue History
2010-01-12 10:07Bradley LowekampNew Issue
2010-01-12 10:17Bradley LowekampAdditional Information Updated
2010-02-24 09:35Bradley LowekampStatusnew => assigned
2010-02-24 09:35Bradley LowekampAssigned To => Bradley Lowekamp
2010-02-24 09:41Bradley LowekampNote Added: 0019605
2010-06-22 15:23Bradley LowekampNote Added: 0021134
2010-06-22 15:23Bradley LowekampStatusassigned => resolved
2010-06-22 15:23Bradley LowekampFixed in Version => ITK-3-18
2010-06-22 15:23Bradley LowekampResolutionopen => fixed
2010-10-21 12:31Gabe HartStatusresolved => closed

Notes
(0019605)
Bradley Lowekamp   
2010-02-24 09:41   
The solution was committed:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageIOBase.cxx?root=Insight&r1=1.88&r2=1.89&sortby=date [^]
(0021134)
Bradley Lowekamp   
2010-06-22 15:23   
The patch appears to be working and VTK file format is working correctly.