Hi Jim,<br><br>When I try to output the image as a vector:<br><br>outputImageVector.put(pixelNum, pixelValue);<br><br>It gives me only the result processed by one thread. For example, my output image is 100 by 100, then the output will only got 10 by 100 results, and other pixels are zeros. <br>
<br>Also I found that the pixelNum is not loop from 0 to 9999 (because I've got 10000 pixels), it is only loop from something like 2000 to 3000. <br><br>May I ask how to gather all the results from different threads please?<br>
<br><br><br>Thanks,<br>Aaron<br><br><br><br><div class="gmail_quote">On Wed, Aug 11, 2010 at 2:22 AM, Jim Miller <span dir="ltr"><<a href="mailto:millerjv@gmail.com">millerjv@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Why do you think your iterator is not working?<br>
<br>
The codes looks like it is iterating over the pixels assigned to that thread.<br>
<div><div></div><div class="h5"><br>
<br>
<br>
On Aug 10, 2010, at 9:31 AM, Guang Yang <<a href="mailto:samggyy@gmail.com">samggyy@gmail.com</a>> wrote:<br>
<br>
> 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>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br>