[vtkusers] access points quickly
Mark Roden
mmroden at gmail.com
Tue Nov 30 12:10:02 EST 2010
Hi Martin,
Thanks much, I'll give it a try!
Mark
On Mon, Nov 29, 2010 at 11:30 PM, Martn Ulken <martinulken at googlemail.com>wrote:
> Hi,
>
>
>
> I used a pointer to have a simple access using a standard C-array. Perhaps
> this piece of code helps:
>
>
>
> vtkUnsignedCharArray* test=
> vtkUnsignedCharArray::SafeDownCast(image2->GetPointData()->GetScalars());
>
> test2= test->GetPointer(0);
>
>
>
> Now you should be able to access the pixel data by using test2[i].
>
>
>
> Good Luck J
>
> Martin
>
>
>
>
>
> *Von:* vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] *Im
> Auftrag von *Mark Roden
> *Gesendet:* Dienstag, 30. November 2010 05:38
> *An:* VTK
> *Betreff:* [vtkusers] access points quickly
>
>
>
> Hi all,
>
>
>
> How can I access points in an image without bounds checking?
>
>
>
> Right now, there's GetScalarComponentAsDouble, but this is s-l-o-w when
> iterating through all the points in an image. Is there an iterator class
> similar to ITK? As I mentioned earlier, I'm trying to speed
> up vtkDijkstraImageGeodesicPath::BuildAdjacency. This method's major time
> sink is GetScalarComponentAsDouble. Can I just use vtkImageIterator and
> make the path templated to the image type? Is that the kosher VTK way of
> rewriting this method, or is it not OK to use an image iterator when I don't
> necessarily know the base type of the data?
>
>
>
> Thanks,
>
> Mark
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101130/b43b52ab/attachment.htm>
More information about the vtkusers
mailing list