[Insight-users] Image File Writing Error

Abayiz abayiz at yahoo.com
Mon Nov 21 04:04:05 EST 2011


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


More information about the Insight-users mailing list