<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Dear all,</div><div><br></div><div>I am trying to use region iterator to just copy one image content to another, and save it. My partial code for this is as follows:</div><div>-----------------------</div><div>mageType::SizeType&nbsp; size;<br>&nbsp; ImageType::RegionType inputRegion;<br><br>&nbsp; size=reader-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetSize();<br>&nbsp; inputRegion.SetSize(size);<br>&nbsp; inputRegion.SetIndex(someFilter-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetIndex());<br><br>&nbsp; ImageType::Pointer image = ImageType::New();<br>&nbsp; image-&gt;SetRegions(inputRegion);<br>&nbsp; image-&gt;Allocate();<br><br>&nbsp; VectorIteratorType iterator(someFilter-&gt;GetOutput(), gradientMagnitude-&gt;GetOutput()-&gt;GetRequestedRegion());<br>&nbsp; IteratorType iterator2(image,
 image-&gt;GetRequestedRegion());</div>...<div>&nbsp;&nbsp; anotherFilter-&gt;SetInput(image);</div><div>...</div><div>&nbsp; writer-&gt;SetInput(anotherFilter-&gt;GetOutput());</div><div>&nbsp;try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;Update();<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; excep )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception caught !" &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; }<br></div><div><br></div><div>-----------------------</div><div>And, it gives out the following error:</div><div>----------------------<br></div><div>Description: itk::ERROR: ImageFileWriter(0x26d6df0): Largest possible region does not fully contain requested paste IO regionPaste IO region: ImageIORegion (0x7fff8ddb7c90)<br>&nbsp; Dimension: 3<br>&nbsp; Index: 0 0 0 <br>&nbsp; Size: 0 0 0 <br>Largest possible
 region: ImageRegion (0x7fff8ddb7d90)<br>&nbsp; Dimension: 3<br>&nbsp; Index: [0, 0, 0]<br>&nbsp; Size: [0, 0, 0]</div><div>-----------------------</div><div>I've searched the internet, but couldn't solve it yet. Could anyone give any suggestions? <br></div><div>Thanks in advance.</div><div>Abayiz<br></div><div></div></div></body></html>