[vtkusers] Errorwriting out image file
David Brayford
dbrayford at gmail.com
Wed Oct 5 15:58:28 EDT 2011
When I run the following code. I get the following error output in the
terminal window on a 64bit Linux system.
typedef itk::VTKImageToImageFilter<InputImageType> VTKToITKConnector;
VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();
// pass the VTK volume data into ITK
VTK_to_ITK_filter->SetInput(vol);
VTK_to_ITK_filter->Update();
imagePtr = VTK_to_ITK_filter->GetOutput();
typedef itk::ResampleImageFilter<InputImageType, InputImageType > FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput( imagePtr );
filter->SetDefaultPixelValue( 0 );
// perform some image processing within ITK
// write out image file
writer->SetFileName( str );
writer->SetInput( rescaler->GetOutput() );
try
{
std::cout << "Writing image: " << str << std::endl;
writer->Update();
}
catch( itk::ExceptionObject & err )
{
std::cerr << "ERROR: ExceptionObject caught ! " << str << std::endl;
std::cerr << err << std::endl;
}
filter->Update();
Writing image: output_1.png
ERROR: ExceptionObject caught ! output_1.png
Writing image: _output_1.png
ERROR: ExceptionObject caught ! output_1.png
itk::ExceptionObject (0xc40640)
Location: "void itk::ImageFileWriter<TInputImage>::Write() [with
TInputImage = itk::Image<unsigned char, 3u>]"
File: /usr/local/include/InsightToolkit/IO/itkImageFileWriter.txx
Line: 271
Description: itk::ERROR: ImageFileWriter(0xc768d0): Largest possible
region does not fully contain requested paste IO regionPaste IO
region: ImageIORegion (0x7fffffffd470)
Dimension: 3
Index: 0 0 0
Size: 521143585 18446744072883491688 1
Largest possible region: ImageRegion (0x7fffffffd530)
Dimension: 3
Index: [0, 0, 0]
Size: [521143585, 18446744072883491688, 1]
ERROR: ExceptionObject caught ! When update is called after file
output_1.pngis being written
itk::ExceptionObject (0x7fffd4000bf0)
Location: "TElement* itk::ImportImageContainer<TElementIdentifier,
TElement>::AllocateElements(TElementIdentifier) const [with
TElementIdentifier = long unsigned int, TElement = short unsigned
int]"
File: /usr/local/include/InsightToolkit/Common/itkImportImageContainer.txx
Line: 188
Description: Failed to allocate memory for image.
More information about the vtkusers
mailing list