[Insight-users] Image File Writing Error

Abayiz abayiz at yahoo.com
Mon Nov 21 11:03:14 EST 2011


Hello Bill, 


Thank you very much for your reply. 

Now it worked quite well. 


Best regards,
Abayiz



________________________________
 From: Bill Lorensen <bill.lorensen at gmail.com>
To: Abayiz <abayiz at yahoo.com> 
Cc: itk <insight-users at itk.org> 
Sent: Monday, November 21, 2011 3:08 PM
Subject: Re: [Insight-users] Image File Writing Error
 
Place
reader->Update();
before
size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();

Until the reader is executed, it's output will be empty.

On Mon, Nov 21, 2011 at 4:04 AM, Abayiz <abayiz at yahoo.com> wrote:
> Really sorry, there is an error while I was pasting my code, and here it
> should be look like:
> --------------------------------------------------------
>  ImageType::SizeType  size;
>   ImageType::RegionType inputRegion;
>
>   size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();
>   inputRegion.SetSize(size);
>
> inputRegion.SetIndex(someFilter->GetOutput()->GetLargestPossibleRegion().GetIndex());
>
>   ImageType::Pointer image = ImageType::New();
>   image->SetRegions(inputRegion);
>   image->Allocate();
>
>   VectorIteratorType iterator(someFilter->GetOutput(),
> someFilter->GetOutput()->GetRequestedRegion());
>   IteratorType iterator2(image, image->GetRequestedRegion());
> ...
>    anotherFilter->SetInput(image);
> ...
>   writer->SetInput(anotherFilter->GetOutput());
>  try
>     {
>      writer->Update();
>      }
>   catch( itk::ExceptionObject & excep )
>     {
>     std::cerr << "Exception caught !" << std::endl;
>     std::cerr << excep << std::endl;
>     }
>
>
>
> ________________________________
> From: Abayiz <abayiz at yahoo.com>
> To: itk <insight-users at itk.org>
> Sent: Monday, November 21, 2011 10:59 AM
> Subject: Image File Writing Error
>
> Dear all,
> 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:
> -----------------------
> mageType::SizeType  size;
>   ImageType::RegionType inputRegion;
>
>   size=reader->GetOutput()->GetLargestPossibleRegion().GetSize();
>   inputRegion.SetSize(size);
>
> inputRegion.SetIndex(someFilter->GetOutput()->GetLargestPossibleRegion().GetIndex());
>
>   ImageType::Pointer image = ImageType::New();
>   image->SetRegions(inputRegion);
>   image->Allocate();
>
>   VectorIteratorType iterator(someFilter->GetOutput(),
> gradientMagnitude->GetOutput()->GetRequestedRegion());
>   IteratorType iterator2(image, image->GetRequestedRegion());
> ...
>    anotherFilter->SetInput(image);
> ...
>   writer->SetInput(anotherFilter->GetOutput());
>  try
>     {
>      writer->Update();
>      }
>   catch( itk::ExceptionObject & excep )
>     {
>     std::cerr << "Exception caught !" << std::endl;
>     std::cerr << excep << std::endl;
>     }
>
> -----------------------
> And, it gives out the following error:
> ----------------------
> Description: itk::ERROR: ImageFileWriter(0x26d6df0): Largest possible region
> does not fully contain requested paste IO regionPaste IO region:
> ImageIORegion (0x7fff8ddb7c90)
>   Dimension: 3
>   Index: 0 0 0
>   Size: 0 0 0
> Largest possible region: ImageRegion (0x7fff8ddb7d90)
>   Dimension: 3
>   Index: [0, 0, 0]
>   Size: [0, 0, 0]
> -----------------------
> I've searched the internet, but couldn't solve it yet. Could anyone give any
> suggestions?
> Thanks in advance.
> Abayiz
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>



-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111121/3f9faa1b/attachment.htm>


More information about the Insight-users mailing list