Hi there,<br><br>I've got a requirement to loop all the pixels within the itk multithreaded framework:<br><br> template<float><br> void<br> CreateImage<float>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId)<br>
{<br> <br> outputIterator = ImageRegionIterator<OutputImageType>(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>