<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<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-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=wykehuizinga@gmail.com
href="mailto:wykehuizinga@gmail.com">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">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-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">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>
<P>
<HR>
_____________________________________<BR>Powered by www.kitware.com<BR><BR>Visit
other Kitware open-source projects
at<BR>http://www.kitware.com/opensource/opensource.html<BR><BR>Kitware offers
ITK Training Courses, for more information
visit:<BR>http://www.kitware.com/products/protraining.php<BR><BR>Please keep
messages on-topic and check the ITK FAQ
at:<BR>http://www.itk.org/Wiki/ITK_FAQ<BR><BR>Follow this link to
subscribe/unsubscribe:<BR>http://www.itk.org/mailman/listinfo/insight-users<BR></DIV></DIV></DIV></BODY></HTML>