[vtkusers] Loosing first Compontent after SafeDownCast

Martin Ulken martinulken at googlemail.com
Tue Sep 21 04:13:12 EDT 2010


Hello

 

I am going to import an bmp image by using the vtkBMPReader which works
fine.

 

When I am going to access the pixels of the image using "
image2->GetScalarComponentAsFloat(x,y,0,0) " everything works fine.

When I display the first greyvalues in row y=0  I get the following:
21,36,58,63,. which is correct.

 

Now I want to have a faster access. so I create a pointer with the following
commands:

 

vtkUnsignedCharArray* test=
vtkUnsignedCharArray::SafeDownCast(image2->GetPointData()->GetScalars());

test2= test->GetPointer(VTK_UNSIGNED_CHAR);

 

Now the value of test[0] is 36. So I cannot access the first column of the
image.

 

Can someone explain this behavior?

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


More information about the vtkusers mailing list