[vtkusers] Errorwriting out image file

Jothy jothybasu at gmail.com
Thu Oct 6 04:41:16 EDT 2011


Try writer->Write()

Jothy

On Wed, Oct 5, 2011 at 8:58 PM, David Brayford <dbrayford at gmail.com> wrote:

> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Jothybasu K Selvaraj
PhD Student
University of Liverpool
Liverpool,UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111006/1d24433a/attachment.htm>


More information about the vtkusers mailing list