[Insight-users] Create an image

David Doria daviddoria at gmail.com
Wed Mar 2 10:14:09 EST 2011


On Wed, Mar 2, 2011 at 10:06 AM, john smith <mkitkinsightuser at gmail.com>wrote:

> Hello,
>
> I am trying to create an image 20x20. Every pixel will have the value 0.
> Then, I have created an other function called OutputImage, with which I
> trying to see all the pixel's value on my window command prompt. The project
> is built correctly, but when I run it from the command window prompt I do
> not take any value. Could anybody find the problem?
>
> Thanks in advance
>
>
You should probably use a region iterator for your output function:
http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionConstIterator

Also, you'll need to cast the unsigned char to an int to view the value "0":

std::cout << static_cast<int>(image->GetPixel(pixelIndex));

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110302/159b9a6b/attachment.htm>


More information about the Insight-users mailing list