[vtkusers] Rapid access to scalar data in vtkImageData
Martijn Steenwijk
martijnsteenwijk at gmail.com
Mon Oct 10 11:41:50 EDT 2011
You might be looking for an iterator, something like this:
reader->Update();
ImagePointer img = reader->GetOutput();
ImageIteratorType img_it(img, img->GetLargestPossibleRegion() );
for(img_it.GoToBegin(); !img_it.IsAtEnd(); ++img_it){
double value = img_it.Get();
}
Best,
Martijn
On Mon, Oct 10, 2011 at 4:00 PM, Jothy <jothybasu at gmail.com> wrote:
> Hi all,
>
> I need to access the scalar values in a vtkImageData at a huge list of
> (random) points.
>
> Currentlt I ma using imgData->GetScalarComponentAsDouble(x,y,z,0).
>
> But it is slow. This is the key step in the function I will be using. Is
> there any other way to access it rapidly, may be with the pointer to scalar
> values?
>
> I need to copy the values to a std::vector.
>
> Any suggestions?
>
> Thanks
>
> Jothy
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111010/410ae245/attachment.htm>
More information about the vtkusers
mailing list