[Insight-users] funny char garbage

Luis Ibanez luis.ibanez at kitware.com
Wed Aug 10 19:53:36 EDT 2005


Hi Kevin,

Thanks for sharing :-)


Note that itk::NumericTraits<> provide a type for printing.

This was motivated because we fell too many times in the
same  problem that you just found.


You want to use it as:

  typedef itk::NumericTraits<PixelType>::PrintType PrintType;
  std::cout << static_cast<PrintType>( inputIt.Get() ) << std::endl;



Regards,


     Luis


--------------------
Kevin H. Hobbs wrote:
> I just spent WAY too long figuring out something really stupid.  I bet
> somebody else has, or will do this so here it is.
> 
> I was printing out pixel values with:
> 	pointsFile << inputIt.Get() << std::endl;
> 
> I kept getting junk.  All sorts of wacky symbols.  Then I realized, IT'S
> A CHAR!
> 
> What I meant was:
> 	pointsFile << (unsigned int)inputIt.Get() << std::endl;
> 
> Grr.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list