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&#39;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">&lt;<a href="mailto:millerjv@gmail.com">millerjv@gmail.com</a>&gt;</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 &lt;<a href="mailto:samggyy@gmail.com">samggyy@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hi there,<br>
&gt;<br>
&gt; I&#39;ve got a requirement to loop all the pixels within the itk multithreaded framework:<br>
&gt;<br>
&gt;     template&lt;float&gt;<br>
&gt;     void<br>
&gt;     CreateImage&lt;float&gt;::ThreadedGenerateData(const OutputImageRegionType&amp; outputRegionForThread, int threadId)<br>
&gt;     {<br>
&gt;<br>
&gt;       outputIterator = ImageRegionIterator&lt;OutputImageType&gt;(outImage, outputRegionForThread); // Output is a 2D image<br>
&gt;<br>
&gt;       pixelNum = 0;<br>
&gt;       for ( outputIterator.GoToBegin(); !outputIterator.IsAtEnd(); ++outputIterator)<br>
&gt;       {<br>
&gt;       // Some manipulations<br>
&gt;<br>
&gt;       // Loop over all the pixels<br>
&gt;       pixelNum++;<br>
&gt;<br>
&gt;      }<br>
&gt;   }<br>
&gt;<br>
&gt; It is only working for single threaded program,<br>
&gt;<br>
&gt; Then I try to use:<br>
&gt;<br>
&gt; outIndex = outputIterator.GetIndex();<br>
&gt; int pixel2D = sizeOfOutputImage[1]*outIndex[1] + outIndex[0]; // Change 2D array to 1D index in order to loop all the pixels<br>
&gt;<br>
&gt; inside the for loop above, but still not working properly. Any suggestions would be appreciated. Thanks a lot.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Aaron<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <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>