MantisBT - VTK
View Issue Details
0003917VTK(No Category)public2006-10-10 17:002013-04-05 20:34
Cory Quammen 
Andinet 
normalmajoralways
closedfixed 
 
 
0003917: vtkTIFFWriter crashes when saving image sequence
When trying to save a vtkImageData object as a set of TIFF images, vtkTIFFWriter crashes. This example (in Java) will cause the crash:

--

vtkTIFFWriter writer = new vtkTIFFWriter();
writer.SetCompressionToNoCompression();
writer.SetFilePrefix(fileName);
writer.SetFilePattern("%s%04d.tif");
writer.SetFileDimensionality(2);

// Gets 3D volume of unsigned shorts
vtkImageData stack = generateStack();
writer.SetInput(stack);
writer.Write();

--

The problem is that the TIFF writer always tries to use the file name passed through SetFileName() when opening the file for writing. If you don't specify a name through SetFileName(), then the file name is a null pointer, causing a crash. If you do call SetFileName("file.tif"), then you will wind up with on saved file with the name "file.tif", so that is not a solution.

I fixed the crash by modifying the file vtkTIFFWriter.cxx on line 124. It uses the member variable InternalFileName as the source of the file name instead of calling GetFileName() and works correctly. This is the same way vtkPNGWriter and vtkJPGWriter get the file name. The modified file is attached.
No tags attached.
cxx vtkTIFFWriter.cxx (9,105) 1969-12-31 19:00
https://www.vtk.org/Bug/file/5688/vtkTIFFWriter.cxx
Issue History
2008-02-06 10:44Jeff BaumesAssigned ToMathieu Malaterre => Andinet
2008-04-10 12:14AndinetStatustabled => @80@
2008-04-10 12:14AndinetResolutionopen => fixed
2008-04-10 12:14AndinetNote Added: 0011260
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2012-06-11 23:14Cory QuammenNote Added: 0028688
2013-04-05 20:34Berk GeveciStatuscustomer review => closed

Notes
(0011260)
Andinet   
2008-04-10 12:14   
The fix is committed to CVS.
(0028688)
Cory Quammen   
2012-06-11 23:14   
This can be marked closed as the fix has been in the repository for a long time now.