[Insight-users] Image File Writing Error

Abayiz abayiz at yahoo.com
Mon Nov 21 03:59:54 EST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111121/0fa04649/attachment.htm>


More information about the Insight-users mailing list