Hi there,<br><br>I&#39;ve got a requirement to loop all the pixels within the itk multithreaded framework:<br><br>    template&lt;float&gt;<br>    void<br>    CreateImage&lt;float&gt;::ThreadedGenerateData(const OutputImageRegionType&amp; outputRegionForThread, int threadId)<br>

    {<br>      <br>      outputIterator = ImageRegionIterator&lt;OutputImageType&gt;(outImage, outputRegionForThread); // Output is a 2D image<br><br>      pixelNum = 0;<br>      for ( outputIterator.GoToBegin(); !outputIterator.IsAtEnd(); ++outputIterator)<br>

      {<br>      // Some manipulations<br><br>      // Loop over all the pixels<br>      pixelNum++;<br><br>     }<br>  }<br><br>It is only working for single threaded program,<br><br>Then I try to use:<br><br>outIndex = outputIterator.GetIndex();  <br>

int pixel2D = sizeOfOutputImage[1]*outIndex[1] + outIndex[0]; // Change 2D array to 1D index in order to loop all the pixels<br><br>inside the for loop above, but still not working properly. Any suggestions would be appreciated. Thanks a lot.<br>

<br><br><br>Aaron<br><br>         <br>