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->SetRegions(region);<br> image_norm->Allocate();<br> image_norm->FillBuffer(255);<br><br> int max=0;<br> for(unsigned int i = 0; i < size_x; i++)<br>
{<br> for(unsigned int j = 0; j < size_y; j++)<br> {<br> for(unsigned int k = 0; j < 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->GetPixel(pixelIndex);<br>
if (value>max){max=value;}<br> }<br><br> }<br> }<br>ui->label_61->setText(QString("max:%1").arg( max ));<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>