[Insight-users] Accessing pixels value
Fran Serrano
sercha at gmail.com
Wed Nov 12 18:33:46 EST 2008
Dear all,
I'm starting in ITK and I've the following problem:
I don't know how can I access to the pixels of an image. The
example:"Examples/DataRepresentation/Image/Image3.cxx" implements how to
create a new image and how to change values of the image but I want to
change values of a read image. Do I have to create a region and then
allocated the data as I do in the following code? If this is the way, how
can I assingn the read data to the region?
* // Inizialize
const unsigned int Dimension = 2;
typedef itk::Image< unsigned char, Dimension > ImageType;
// Create image object
ImageType::Pointer image = ImageType::New();
// Create image region
ImageType::IndexType start;
ImageType::SizeType size;
size[0] = 200; // size of the read image along X
size[1] = 200; // size of the read image along Y
start[0] = 0; // first index on X
start[1] = 0; // first index on Y
ImageType::RegionType region;
region.SetSize( size );
region.SetIndex( start );
// Pixel data is allocated
image->SetRegions( region );
image->Allocate();
// Now, I want to assign the data from "reader->GetOutput()" to the image
image->??????????*
Thanks for any suggestion,
--
~~~~~~~~~~~~~~~~Fran~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081112/c19aa5a3/attachment.htm>
More information about the Insight-users
mailing list