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>
</div><div> </div><div> </div><div> 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't work (and sincerly I
<br>don'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> * in the header file:<br><br>typedef float PixelTypeF;
<br>typedef itk::Image<PixelTypeF, Dimension> ImageTypeF;<br>typedef itk::ImageFileReader<ImageType<div>C> ReaderTypeJPEG;<br>typedef itk::RescaleIntensityImageFilter<ImageTypeC, ImageTypeF><br>RescalerTypeCtoF;
<br>typedef itk::RescaleIntensityImageFilter<ImageTypeF, ImageTypeC><br>RescalerTypeFtoC;<br>typedef itk::RescaleIntensityImageFilter<ImageTypeF, ImageTypeF><br>RescalerTypeFtoF;<br>typedef itk::DiscreteGaussianImageFilter<ImageTypeC, ImageTypeC >
<br>FilterType; typedef itk::DiscreteGaussianImageFilter<ImageTypeF,<br>ImageTypeF > FilterTypeFF;<br>typedef itk::ImageLinearIteratorWithIndex< ImageTypeF > IteratorType;<br> typedef itk::ImageLinearIteratorWithIndex< ImageTypeC >
<br>IteratorTypeC;<br>typedef itk::ImageLinearConstIteratorWithIndex< ImageTypeF > ConstIterType;<br><br><br> * in the functions file:<br><br>/* Step 1 - Reading the image */<br> ReaderTypeJPEG::Pointer reader = ReaderTypeJPEG::New();
<br> reader->SetFileName(temp);<br><br> RescalerTypeCtoF::Pointer ctof = RescalerTypeCtoF::New();<br> ctof->SetInput(reader->GetOutput());<br> ctof->SetOutputMaximum(255);<br> ctof->SetOutputMinimum(0);
<br><br> /* Step 2 - Filtering 50GLPF10 */<br> FilterTypeFF::Pointer filter1 = FilterTypeFF::New();<br> filter1->SetInput(ctof->GetOutput());<br> filter1->SetVariance(3.1);<br> /* Step 3 and 4 - Maximums and minimum*/
<br> ImageTypeF::Pointer imageF = filter1->GetOutput();<br><br> try<br> {<br> filter1->Update();<br> }<br> catch( itk::ExceptionObject & err)<br> {<br> cerr << "ExceptionObject caught !" << endl;
<br> cerr << err << endl;<br> system("pause");<br> exit(1) ;<br> }<br><br> ConstIterType iter( imageF, imageF->GetLargestPossibleRegion() );<br>iter.SetDirection(1);<br> for(
iter.Begin(); !iter.IsAtEnd(); iter.NextLine())<br> { j=0;<br> for(iter.GoToBeginOfLine(); !iter.IsAtEndOfLine(); ++iter)<br> {<br> v[j]=iter.Get();<br> cout << "Valore pixel: " << v[j] << endl;
<br> cout << "Dati: " << iter.GetRegion() << endl;<br> cout << "Indice: " << iter.GetIndex() << "\n\n\n" << endl;<br> j++;
<br> }<br> }<br><br>Where is the mistake?<br>Thanks again.<br><br>
</div></div></blockquote></div>