<div dir="ltr">Try writer->Write()<br><br>Jothy<br><br><div class="gmail_quote">On Wed, Oct 5, 2011 at 8:58 PM, David Brayford <span dir="ltr"><<a href="mailto:dbrayford@gmail.com">dbrayford@gmail.com</a>></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<InputImageType> VTKToITKConnector;<br>
VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();<br>
<br>
// pass the VTK volume data into ITK<br>
VTK_to_ITK_filter->SetInput(vol);<br>
VTK_to_ITK_filter->Update();<br>
<br>
imagePtr = VTK_to_ITK_filter->GetOutput();<br>
<br>
typedef itk::ResampleImageFilter<InputImageType, InputImageType > FilterType;<br>
FilterType::Pointer filter = FilterType::New();<br>
filter->SetInput( imagePtr );<br>
filter->SetDefaultPixelValue( 0 );<br>
<br>
// perform some image processing within ITK<br>
<br>
// write out image file<br>
writer->SetFileName( str );<br>
writer->SetInput( rescaler->GetOutput() );<br>
<br>
try<br>
{<br>
std::cout << "Writing image: " << str << std::endl;<br>
writer->Update();<br>
}<br>
catch( itk::ExceptionObject & err )<br>
{<br>
std::cerr << "ERROR: ExceptionObject caught ! " << str << std::endl;<br>
std::cerr << err << std::endl;<br>
}<br>
<br>
filter->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: "void itk::ImageFileWriter<TInputImage>::Write() [with<br>
TInputImage = itk::Image<unsigned char, 3u>]"<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: "TElement* itk::ImportImageContainer<TElementIdentifier,<br>
TElement>::AllocateElements(TElementIdentifier) const [with<br>
TElementIdentifier = long unsigned int, TElement = short unsigned<br>
int]"<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>