Thank you for your quick answer.<div>but the problem is not solved, because still the iterator won't start. It is still saying that it is at the end before even starting the while loop.</div><div><br></div><div>
<div><em>Wyke Huizinga</em></div>
<div> </div>
<div>M: <a href="tel:06%2040524703" value="+31640524703" target="_blank">06 40524703</a></div>
<div>E: <a href="mailto:wykehuizinga@gmail.com" target="_blank">wykehuizinga@gmail.com</a></div><br>
<br><br><div class="gmail_quote">2012/11/2 alex Dowson <span dir="ltr"><<a href="mailto:alexdowson@hotmail.com" target="_blank">alexdowson@hotmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div dir="ltr">
<div style="font-size:12pt;font-family:'Calibri'">
<div>Hi</div>
<div> </div>
<div>I think iterator code is wrong. It should be output iterator also. Try this
way.</div>
<div> </div>
<div><br> </div>
<div>typedef ImageRegionConstIterator<TInputImage>
InputRegionIterator;</div>
<div>InputRegionIterator itIn(this->GetInput(), outputRegionForThread);</div>
<div>typedef ImageRegionIteratorWithIndex<TOutputImage>
OutputRegionIterator;</div>
<div>OutputRegionIterator itOut(this->GetOutput(),
outputRegionForThread);</div>
<div> </div>
<div> </div>
<div>// Go over each voxel</div>
<div>itIn.GoToBegin();</div>
<div>itOut.GoToBegin();</div>
<div>while(!itIn.IsAtEnd() )</div>
<div> {</div>
<div> </div>
<div> itOut.Set( itOut.Get() *
Calculated_Value );</div>
<div> </div>
<div> ++itIn;</div>
<div> ++itOut;</div>
<div>}</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div style="font-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal">
<div style="FONT:10pt tahoma">
<div> </div>
<div style="BACKGROUND:#f5f5f5">
<div><b>From:</b> <a title="wykehuizinga@gmail.com" href="mailto:wykehuizinga@gmail.com" target="_blank">Wyke Huizinga</a> </div>
<div><b>Sent:</b> Friday, November 02, 2012 3:01 PM</div>
<div><b>To:</b> <a title="insight-users@itk.org" href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a> </div>
<div><b>Subject:</b> Re: [Insight-users] image region iterator</div></div></div>
<div> </div></div>
<div style="font-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal"><div><div>Hi,<br>
<div class="gmail_quote">
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div> </div>
<div>I'm having a problem with the image iterator. </div>
<div>I want to iterate over a specific volume in a 4D image.</div>
<div>What I do is the following:</div>
<div> </div>
<div>I loop over the volumes in the 4D image. Each new loop the region for the
image iterator changes.</div>
<div>The region is put into a function which should iterate then over the
specific volume.</div>
<div> </div>
<div>The region size is set to the size of a volume and the size of the 4th
dimension is set to 0 (in this case: [79 107 60 0])</div>
<div>The region index is set to [0 0 0 loopindex]. </div>
<div> </div>
<div>Both the region and the image are passed in correctly into the
function.</div>
<div> </div>
<div>However, the iterator says it is at its end before even starting the
loop.</div>
<div>The code can be found here: <a href="http://pastebin.com/PArvffSq" target="_blank">http://pastebin.com/PArvffSq</a></div>
<div>It goes wrong at line 55. </div>
<div> </div>
<div>I'm a bit of a newby in both ITK and C++, so forgive me if the code looks
bad.</div>
<div> </div>
<div>Thanks for your help,</div>
<div> </div>
<div>
<div> </div>
<div><em>Wyke Huizinga</em></div>
<div> </div>
<div> </div></div></blockquote></div><br>
</div></div><p>
</p><hr>
_____________________________________<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.php" target="_blank">http://www.kitware.com/products/protraining.php</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><p></p></div></div></div></div>
</blockquote></div><br></div>