You might be looking for an iterator, something like this: <div><br></div><div>reader->Update();</div><div><br></div><div><div>ImagePointer img = reader->GetOutput();</div><div><div>ImageIteratorType img_it(img, img->GetLargestPossibleRegion() );</div>
<div>for(img_it.GoToBegin(); !img_it.IsAtEnd(); ++img_it){</div><div> double value = img_it.Get();</div><div>}</div></div><div><br></div><div>Best,</div><div>Martijn</div><div><br></div><div><br></div><div><br></div><br>
<div class="gmail_quote">On Mon, Oct 10, 2011 at 4:00 PM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr">Hi all,<br><br>I need to access the scalar values in a vtkImageData at a huge list of (random) points.<br><br>Currentlt I ma using imgData->GetScalarComponentAsDouble(x,y,z,0).<br><br>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?<br>
<br>I need to copy the values to a std::vector.<br><br>Any suggestions?<br><br>Thanks<br><font color="#888888"><br>Jothy<br clear="all"><br><br>
</font></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>