Hi everyone:<div><br></div><div>I'm trying to get a specific slice of the volume:</div><div><br></div><div><div> index[0]=sliceNum;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>ImageType::RegionType regionImg;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>ImageType::IndexType start;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>start[0]=0;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>start[1]=0;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>ImageType::SizeType sizeImg;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>sizeImg[0]=size[1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>sizeImg[1]=size[2];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>regionImg.SetIndex(start);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>regionImg.SetSize(sizeImg););</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>image->SetRegions(regionImg);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>image->Allocate();</div><div>Then I use getPixel and setPixel to read the pixel value of volume and set the value of corresponding position.</div><div>
This method worked, but when I tried to write it as a function, the problem came.</div><div>The program broke at image->SetRegions(regionImg)</div><div><br></div><div>Could you help me with this problem? If I write it in the main function, the whole program would be very long</div>
<div><br></div><div>Thanks a lot!!</div><div><br></div><div>Best,</div><div>Yili</div></div>