<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Really sorry, there is an error while I was pasting my code, and here it should be look like:</span></div><div>--------------------------------------------------------<br><span></span></div><div> ImageType::SizeType size;<br> ImageType::RegionType inputRegion;<br><br> size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();<br> inputRegion.SetSize(size);<br> inputRegion.SetIndex(someFilter->GetOutput()->GetLargestPossibleRegion().GetIndex());<br><br> ImageType::Pointer image = ImageType::New();<br> image->SetRegions(inputRegion);<br> image->Allocate();<br><br> VectorIteratorType iterator(someFilter->GetOutput(), someFilter->GetOutput()->GetRequestedRegion());<br> IteratorType iterator2(image,
image->GetRequestedRegion());</div>...<div> anotherFilter->SetInput(image);</div><div>...</div><div> writer->SetInput(anotherFilter->GetOutput());</div><div> try<br> {<br> writer->Update();<br> }<br> catch( itk::ExceptionObject & excep )<br> {<br> std::cerr << "Exception caught !" << std::endl;<br> std::cerr << excep << std::endl;<br> }<br></div><div><br></div><div><span><br></span></div><div><br></div> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight: bold;">From:</span></b> Abayiz <abayiz@yahoo.com><br> <b><span style="font-weight: bold;">To:</span></b>
itk <insight-users@itk.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, November 21, 2011 10:59 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Image File Writing Error<br> </font> <br>
<div id="yiv1614810326"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); 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 size;<br> ImageType::RegionType inputRegion;<br><br> size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();<br> inputRegion.SetSize(size);<br> inputRegion.SetIndex(someFilter->GetOutput()->GetLargestPossibleRegion().GetIndex());<br><br> ImageType::Pointer image = ImageType::New();<br> image->SetRegions(inputRegion);<br> image->Allocate();<br><br> VectorIteratorType iterator(someFilter->GetOutput(), gradientMagnitude->GetOutput()->GetRequestedRegion());<br>
IteratorType iterator2(image,
image->GetRequestedRegion());</div>...<div> anotherFilter->SetInput(image);</div><div>...</div><div> writer->SetInput(anotherFilter->GetOutput());</div><div> try<br> {<br> writer->Update();<br> }<br> catch( itk::ExceptionObject & excep )<br> {<br> std::cerr << "Exception caught !" << std::endl;<br> std::cerr << excep << std::endl;<br> }<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> Dimension: 3<br> Index: 0 0 0 <br> Size: 0 0 0 <br>Largest possible
region: ImageRegion (0x7fff8ddb7d90)<br> Dimension: 3<br> Index: [0, 0, 0]<br> 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></div></div><br><br> </div> </div> </div></body></html>