<div dir="ltr"><div><div><div><div>Hi all,<br><br></div>   I am trying to use vtkImageData::GetScalarPointer inside the loop through all the voxels in a huge 3D image (512x512x300). But it seems this function is pretty slow. A code sample is like this:<br>
<br>   int* dims = aImage-&gt;GetDimensions();<br>   int dim[3];<br>   for(dim[2] = 0; dim[2] &lt; dims[2]; dim[2]++)<br>    {<br>        for(dim[1] = 0; dim[1] &lt; dims[1]; dim[1]++)<br>        {<br>            for(dim[0] = 0; dim[0] &lt; dims[0]; dim[0]++)<br>
            {<br>                double* curr = static_cast&lt;double*&gt;(aImage-&gt;GetScalarPointer(dim));<br>                *currhist = 1.0;<br>                }<br>            }<br>        }<br>    }<br><br></div>   I mean should I just get the pointer of the first vosel and compute the poitner addresses for the rest of voxels myself? Should it be faster? Does vtkImageData store all voxels continuously? What about if I have multiple components per voxel?<br>
<br></div>Thanks,<br></div>Mengda<br><div><div><div>  <br></div></div></div></div>