[vtkusers] quick vtkImageData question

John Durkin jrd5084 at psu.edu
Mon Apr 26 14:27:54 EDT 2010


Hi vtk community,

I can't seem to remember how the data is represented in vtkImageData.  I
have a 720x720x1 3 component RGB image being represented by vtkImageData.  I
am using imageData->GetScalarPointer() to access the data.  I have another
image 480x640x1 3 component RGB that I want to place in the middle of the
new image.  Here is the code I have but its not lining up correctly.  Any
ideas?


thanks,

John


    ptr = (unsigned char*)imageData->GetScalarPointer();
        unsigned char *ptr2 = (unsigned char*)origData->GetScalarPointer();


        for(int i = 0; i < 720; i++)
        {
            for(int j = 0; j < 720; j++)
            {
                if(i <600 && i > 119 && j <680 && j > 39)
                {
                    *ptr = *ptr2;
                    *ptr++;
                    *ptr = *ptr2;
                    *ptr++;
                    *ptr = *ptr2;
                    *ptr++;


                }
                else
                {
                    *ptr++;
                    *ptr++;
                    *ptr++;


                }



            }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100426/4bc04db6/attachment.htm>


More information about the vtkusers mailing list