[vtkusers] vtkImageWriter issue...

Hal Canary hal at cs.unc.edu
Mon May 21 10:52:21 EDT 2012


On 05/21/2012 06:54 AM, Ale wrote:
> Hello,
>
> I'd like to write an vtkImageData into a file (in order to check if a correctly made the import from ITK). I use VTK 5.10 under OSX and QT. I resort to this code (where vtkVolume is a vtkSmartPointer<vtkImageData>  correctly instatiated):
>
>     vtkSmartPointer<vtkImageWriter>  writer = vtkSmartPointer<vtkImageWriter>::New();
>     writer->SetInput(vtkVolume);
>     writer->SetFileName ("/mydir/filename.tif");
>     writer->Write();
>
> When the program is run I get the program exit unexpected with this (portion) error:
>
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   libvtkCommon.5.10.dylib       	0x0132a6f0 vtkObjectFactory::IsA(char const*) + 48 (vtkObjectFactory.h:113)
> 1   libvtkFiltering.5.10.dylib    	0x0177a88c vtkImageAlgorithm::SetInput(int, vtkDataObject*) + 44 (vtkImageAlgorithm.cxx:410)
> 2   libvtkFiltering.5.10.dylib    	0x0177a900 vtkImageAlgorithm::SetInput(vtkDataObject*) + 32 (vtkImageAlgorithm.cxx:403)
>
> Thanks,
> Ale

If you want to write a .tif file, why don't you call
vtkSmartPointer<vtkTIFFWriter>::New() ?


-- 
Hal Canary



More information about the vtkusers mailing list