<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">Hi,</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> </font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">I am trying to access the maximum and minimum pixel value of a 3D image with the following code, however, the result dose not look right (maximum 0, minimum 1000). Can anyone give me a hint why this code dose not work?</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> </font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">Thanks a lot,</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> </font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">Howard</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> </font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> typedef unsigned int InputPixelType;<br> const unsigned int Dimension = 3;<br> <br> typedef unsigned int OutputPixelType;<br>
<br> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><font face="Times New Roman" size="3"> typedef itk::Image< InputPixelType, Dimension > InputImageType;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><font face="Times New Roman" size="3"> typedef itk::ImageFileReader< InputImageType > ReaderType;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><font face="Times New Roman" size="3"> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileName( argv[1] );<br>
<br> typedef itk::ImageRegionIterator< InputImageType > IteratorType;<br> InputImageType::Pointer image = InputImageType::New();<br> image = reader->GetOutput();<br> IteratorType it( image, image->GetLargestPossibleRegion() );<br>
int max=0;<br> int min=10000;<br> <br> for (it.GoToBegin();!it.IsAtEnd();++it)<br> {<br> int temp = it.Get();<br> if (temp>max)<br> max=temp;<br> if (temp<min)<br> min=temp;<br> }<br> std::cout << "min=" << min <<std::endl;<br>
std::cout << "max=" << max <<std::endl;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> </font></p>