<div dir="ltr">Try writer-&gt;Write()<br><br>Jothy<br><br><div class="gmail_quote">On Wed, Oct 5, 2011 at 8:58 PM, David Brayford <span dir="ltr">&lt;<a href="mailto:dbrayford@gmail.com">dbrayford@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">When I run the following code. I get the following error output in the<br>
terminal window on a 64bit Linux system.<br>
<br>
        typedef itk::VTKImageToImageFilter&lt;InputImageType&gt; VTKToITKConnector;<br>
        VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();<br>
<br>
       // pass the VTK volume data into ITK<br>
        VTK_to_ITK_filter-&gt;SetInput(vol);<br>
        VTK_to_ITK_filter-&gt;Update();<br>
<br>
        imagePtr = VTK_to_ITK_filter-&gt;GetOutput();<br>
<br>
        typedef itk::ResampleImageFilter&lt;InputImageType, InputImageType &gt; FilterType;<br>
        FilterType::Pointer filter = FilterType::New();<br>
        filter-&gt;SetInput( imagePtr );<br>
        filter-&gt;SetDefaultPixelValue( 0 );<br>
<br>
// perform some image processing within ITK<br>
<br>
        // write out image file<br>
        writer-&gt;SetFileName( str );<br>
        writer-&gt;SetInput( rescaler-&gt;GetOutput() );<br>
<br>
        try<br>
        {<br>
          std::cout &lt;&lt; &quot;Writing image: &quot; &lt;&lt; str &lt;&lt; std::endl;<br>
          writer-&gt;Update();<br>
        }<br>
        catch( itk::ExceptionObject &amp; err )<br>
        {<br>
          std::cerr &lt;&lt; &quot;ERROR: ExceptionObject caught ! &quot; &lt;&lt; str &lt;&lt; std::endl;<br>
          std::cerr &lt;&lt; err &lt;&lt; std::endl;<br>
        }<br>
<br>
            filter-&gt;Update();<br>
<br>
<br>
<br>
Writing  image: output_1.png<br>
ERROR: ExceptionObject caught ! output_1.png<br>
<br>
Writing  image: _output_1.png<br>
ERROR: ExceptionObject caught ! output_1.png<br>
<br>
itk::ExceptionObject (0xc40640)<br>
Location: &quot;void itk::ImageFileWriter&lt;TInputImage&gt;::Write() [with<br>
TInputImage = itk::Image&lt;unsigned char, 3u&gt;]&quot;<br>
File: /usr/local/include/InsightToolkit/IO/itkImageFileWriter.txx<br>
Line: 271<br>
Description: itk::ERROR: ImageFileWriter(0xc768d0): Largest possible<br>
region does not fully contain requested paste IO regionPaste IO<br>
region: ImageIORegion (0x7fffffffd470)<br>
  Dimension: 3<br>
  Index: 0 0 0<br>
  Size: 521143585 18446744072883491688 1<br>
Largest possible region: ImageRegion (0x7fffffffd530)<br>
  Dimension: 3<br>
  Index: [0, 0, 0]<br>
  Size: [521143585, 18446744072883491688, 1]<br>
<br>
ERROR: ExceptionObject caught ! When update is called after file<br>
output_1.pngis being written<br>
<br>
itk::ExceptionObject (0x7fffd4000bf0)<br>
Location: &quot;TElement* itk::ImportImageContainer&lt;TElementIdentifier,<br>
TElement&gt;::AllocateElements(TElementIdentifier) const [with<br>
TElementIdentifier = long unsigned int, TElement = short unsigned<br>
int]&quot;<br>
File: /usr/local/include/InsightToolkit/Common/itkImportImageContainer.txx<br>
Line: 188<br>
Description: Failed to allocate memory for image.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothybasu K Selvaraj<br>PhD Student<br>University of Liverpool<br>Liverpool,UK<br></div><br>
</div>