Well I have fixed the copy paste bug but still I get an exception.I have done the same think using the iterator, but still I want to solve the problem in that way if somebody could help me. When I debug my program the breakpoint is stucked to this point of itkImage.h<br>
<br>  void SetRegions(RegionType region)<br>    {<br>   <span style="background-color: rgb(255, 255, 102);"> this-&gt;SetLargestPossibleRegion(region);</span><br>    this-&gt;SetBufferedRegion(region);<br>    this-&gt;SetRequestedRegion(region);<br>
    };<br><br>I hope someone could help<br><br><div class="gmail_quote">2011/6/16 robert tamburo <span dir="ltr">&lt;<a href="mailto:robert.tamburo@gmail.com">robert.tamburo@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Looks like a case of the copy/paste bug:<div class="im"><div><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px">&quot;for(unsigned int k = 0; j &lt; size_z; j++)&quot;</span></div>
<div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">P.S. Use an image iterator :)<br>
</span></font><br><div class="gmail_quote"><div><div></div><div class="h5">On Wed, Jun 15, 2011 at 6:20 PM, john smith <span dir="ltr">&lt;<a href="mailto:mkitkinsightuser@gmail.com" target="_blank">mkitkinsightuser@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
Hello to all,<br><br>I am trying to do a simple task.Well, I am trying to create a 3D image.Fill all the vosels with value 255 and then get the max value (just to see if my program works fine).But every time it is running I get an exception which has to do with the area allocated in the memory.What am I doing wrong. ihope that someone could help me<br>


<br>Thanks<br><br>  InputImageType::Pointer image_norm;<br><br>  InputImageType::IndexType start;<br>  start.Fill(0);<br> <br>  InputImageType::SizeType size;<br>  size[0]=size_x;<br>  size[1]=size_y;<br>  size[2]=size_z;<br>


<br> <br>  InputImageType::RegionType region(start, size);<br>  image_norm-&gt;SetRegions(region);<br>  image_norm-&gt;Allocate();<br>  image_norm-&gt;FillBuffer(255);<br><br>  int max=0;<br>     for(unsigned int i = 0; i &lt; size_x; i++)<br>


      {<br>      for(unsigned int j = 0; j &lt; size_y; j++)<br>                {<br>        for(unsigned int k = 0; j &lt; size_z; j++)<br>                        {<br>                                InputImageType::IndexType pixelIndex;<br>


                                pixelIndex[0] = i;<br>                                pixelIndex[1] = j;<br>                                pixelIndex[2] = k;<br>  <br>                            int value= image_norm-&gt;GetPixel(pixelIndex);<br>


                            if (value&gt;max){max=value;}<br>                        }<br><br>                }<br>      }<br>ui-&gt;label_61-&gt;setText(QString(&quot;max:%1&quot;).arg( max ));<br><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">


</div>
<br></div></div><div class="im">_____________________________________<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.html" target="_blank">http://www.kitware.com/products/protraining.html</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>
<br></div></blockquote></div><br></div>
</blockquote></div><br><div style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>