The line<br> for(iter.Begin(); !iter.IsAtEnd(); iter.NextLine())<br>
<br>
might be<br>
<br>
for(iter.GoToBegin(); !iter.IsAtEnd(); iter.NextLine())<br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;Hi to everyone,<br><br>I have a little problem with iterator. After the reading anf the<br>filtering of a JPEG image (called Temp.jpg), I want to access it reading<br>the pixels value, but the constant iterator doesn&#39;t work (and sincerly I
<br>don&#39;t understand why) because it stops at the 35th pixel....<br>Could you help me?<br><br>Thanks!!<br><br>Stefano<br><br>ps: I put below the code...<br><br> &nbsp; * in the header file:<br><br>typedef float PixelTypeF;
<br>typedef itk::Image&lt;PixelTypeF, Dimension&gt; ImageTypeF;<br>typedef itk::ImageFileReader&lt;ImageType<div>C&gt; ReaderTypeJPEG;<br>typedef itk::RescaleIntensityImageFilter&lt;ImageTypeC, ImageTypeF&gt;<br>RescalerTypeCtoF;
<br>typedef itk::RescaleIntensityImageFilter&lt;ImageTypeF, ImageTypeC&gt;<br>RescalerTypeFtoC;<br>typedef itk::RescaleIntensityImageFilter&lt;ImageTypeF, ImageTypeF&gt;<br>RescalerTypeFtoF;<br>typedef itk::DiscreteGaussianImageFilter&lt;ImageTypeC, ImageTypeC &gt;
<br>FilterType; typedef itk::DiscreteGaussianImageFilter&lt;ImageTypeF,<br>ImageTypeF &gt; FilterTypeFF;<br>typedef itk::ImageLinearIteratorWithIndex&lt; ImageTypeF &gt; IteratorType;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;typedef itk::ImageLinearIteratorWithIndex&lt; ImageTypeC &gt;
<br>IteratorTypeC;<br>typedef itk::ImageLinearConstIteratorWithIndex&lt; ImageTypeF &gt; ConstIterType;<br><br><br> &nbsp; * in the functions file:<br><br>/* &nbsp; &nbsp;Step 1 &nbsp;- Reading the image */<br> &nbsp; ReaderTypeJPEG::Pointer reader = ReaderTypeJPEG::New();
<br> &nbsp; reader-&gt;SetFileName(temp);<br><br> &nbsp; RescalerTypeCtoF::Pointer ctof = RescalerTypeCtoF::New();<br> &nbsp; ctof-&gt;SetInput(reader-&gt;GetOutput());<br> &nbsp; ctof-&gt;SetOutputMaximum(255);<br> &nbsp; ctof-&gt;SetOutputMinimum(0);
<br><br> &nbsp; /* &nbsp; &nbsp;Step 2 - Filtering 50GLPF10 */<br> &nbsp; FilterTypeFF::Pointer filter1 = FilterTypeFF::New();<br> &nbsp; filter1-&gt;SetInput(ctof-&gt;GetOutput());<br> &nbsp; filter1-&gt;SetVariance(3.1);<br> &nbsp; &nbsp; /* &nbsp; &nbsp;Step 3 and 4 - Maximums and minimum*/
<br> &nbsp; ImageTypeF::Pointer imageF = filter1-&gt;GetOutput();<br><br> &nbsp; try<br> &nbsp; {<br> &nbsp; &nbsp; &nbsp; filter1-&gt;Update();<br> &nbsp; }<br> &nbsp; catch( itk::ExceptionObject &amp; err)<br> &nbsp; {<br> &nbsp; &nbsp; &nbsp; cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; endl;
<br> &nbsp; &nbsp; &nbsp; cerr &lt;&lt; err &lt;&lt; endl;<br> &nbsp; &nbsp; &nbsp; system(&quot;pause&quot;);<br> &nbsp; &nbsp; &nbsp; exit(1) ;<br> &nbsp; }<br><br> &nbsp;ConstIterType iter( imageF, imageF-&gt;GetLargestPossibleRegion() );<br>iter.SetDirection(1);<br> &nbsp; &nbsp; for(
iter.Begin(); !iter.IsAtEnd(); iter.NextLine())<br> &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;j=0;<br> &nbsp; &nbsp; &nbsp; for(iter.GoToBeginOfLine(); !iter.IsAtEndOfLine(); ++iter)<br> &nbsp; &nbsp; &nbsp; {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v[j]=iter.Get();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Valore pixel: &quot; &lt;&lt; v[j] &lt;&lt; endl;
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Dati: &quot; &lt;&lt; iter.GetRegion() &lt;&lt; endl;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Indice: &quot; &lt;&lt; iter.GetIndex() &lt;&lt; &quot;\n\n\n&quot; &lt;&lt; endl;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j++;
<br> &nbsp; &nbsp; &nbsp; }<br> &nbsp; }<br><br>Where is the mistake?<br>Thanks again.<br><br>
</div></div></blockquote></div>