[vtkusers] Loosing first Compontent after SafeDownCast
Karthik Krishnan
karthik.krishnan at kitware.com
Tue Sep 21 05:22:28 EDT 2010
On Tue, Sep 21, 2010 at 1:43 PM, Martin Ulken <martinulken at googlemail.com>wrote:
> 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);
>
What do you mean by test->GetPointer(VTK_UNSIGNED_CHAR) ? The value to be
passed in is simply the offset. Perhaps you meant to write
test->GetPointer(0);
>
>
> Now the value of test[0] is 36. So I cannot access the first column of the
> image.
>
You mean test2[0] ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100921/b0a9d9c1/attachment.htm>
More information about the vtkusers
mailing list