<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hello Bill, <br></span></div><div><br><span></span></div><div><span>Thank you very much for your reply. <br></span></div><div><span>Now it worked quite well. <br></span></div><div><br><span></span></div><div><span>Best regards,</span></div><div><span>Abayiz<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> Bill Lorensen <bill.lorensen@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Abayiz <abayiz@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> itk <insight-users@itk.org> <br> <b><span style="font-weight:
bold;">Sent:</span></b> Monday, November 21, 2011 3:08 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Insight-users] Image File Writing Error<br> </font> <br>
Place<br>reader->Update();<br>before<br>size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();<br><br>Until the reader is executed, it's output will be empty.<br><br>On Mon, Nov 21, 2011 at 4:04 AM, Abayiz <<a ymailto="mailto:abayiz@yahoo.com" href="mailto:abayiz@yahoo.com">abayiz@yahoo.com</a>> wrote:<br>> Really sorry, there is an error while I was pasting my code, and here it<br>> should be look like:<br>> --------------------------------------------------------<br>> ImageType::SizeType size;<br>> ImageType::RegionType inputRegion;<br>><br>> size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();<br>> inputRegion.SetSize(size);<br>><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(),<br>> someFilter->GetOutput()->GetRequestedRegion());<br>> IteratorType iterator2(image, image->GetRequestedRegion());<br>> ...<br>> anotherFilter->SetInput(image);<br>> ...<br>> writer->SetInput(anotherFilter->GetOutput());<br>> 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>><br>><br>><br>> ________________________________<br>> From: Abayiz <<a ymailto="mailto:abayiz@yahoo.com"
href="mailto:abayiz@yahoo.com">abayiz@yahoo.com</a>><br>> To: itk <<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>><br>> Sent: Monday, November 21, 2011 10:59 AM<br>> Subject: Image File Writing Error<br>><br>> Dear all,<br>> I am trying to use region iterator to just copy one image content to<br>> another, and save it. My partial code for this is as follows:<br>> -----------------------<br>> mageType::SizeType size;<br>> ImageType::RegionType inputRegion;<br>><br>> size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();<br>> inputRegion.SetSize(size);<br>><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(),<br>> gradientMagnitude->GetOutput()->GetRequestedRegion());<br>> IteratorType iterator2(image, image->GetRequestedRegion());<br>> ...<br>> anotherFilter->SetInput(image);<br>> ...<br>> writer->SetInput(anotherFilter->GetOutput());<br>> 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>><br>> -----------------------<br>> And, it gives out the following error:<br>> ----------------------<br>> Description: itk::ERROR:
ImageFileWriter(0x26d6df0): Largest possible region<br>> does not fully contain requested paste IO regionPaste IO region:<br>> 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]<br>> -----------------------<br>> I've searched the internet, but couldn't solve it yet. Could anyone give any<br>> suggestions?<br>> Thanks in advance.<br>> Abayiz<br>><br>><br>><br>> _____________________________________<br>> Powered by <a target="_blank" href="http://www.kitware.com">www.kitware.com</a><br>><br>> Visit other Kitware open-source projects at<br>> http://www.kitware.com/opensource/opensource.html<br>><br>> Kitware offers ITK Training Courses, for more information visit:<br>>
http://www.kitware.com/products/protraining.html<br>><br>> Please keep messages on-topic and check the ITK FAQ at:<br>> http://www.itk.org/Wiki/ITK_FAQ<br>><br>> Follow this link to subscribe/unsubscribe:<br>> http://www.itk.org/mailman/listinfo/insight-users<br>><br>><br><br><br><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br><br> </div> </div> </div></body></html>