[Insight-users] funny char garbage

Lorensen, William E (Research) lorensen at crd.ge.com
Thu Aug 11 10:35:10 EDT 2005



Let's say you have something like:

typedef PixelType char;

then:

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

Bill

-----Original Message-----
From: insight-users-bounces+lorensen=crd.ge.com at itk.org
[mailto:insight-users-bounces+lorensen=crd.ge.com at itk.org]On Behalf Of
Kevin H. Hobbs
Sent: Wednesday, August 10, 2005 3:47 PM
To: Insight Users List
Subject: [Insight-users] funny char garbage


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


More information about the Insight-users mailing list