XML + raw image IO streaming
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
When a vtkImageReader2 reading raw data is connected to a vtkXMLImageDataWriter writing in certain numbers of streamed pieces, the file produced can not be read with a vtkXMLImageDataReader. The attached code demonstrates the bug. I've observed the behavior on x86 linux with a mpiCC wrapped icpc 8.0 and a x86_64 with g++ 4.1.1. Both with recent VTK from CVS. Under certain conditions the program segfaults during the streamed XML IO, but under conditions it produces errors similar to the following with the extent and piece varying.
[kevin@gargon huge_streamed_test]$ ./huge_streamed_test 500 500 500 10 Now we have a big raw image. Now we have a big VTI image. ERROR: In /home/kevin/kitware/VTK/IO/vtkXMLStructuredDataReader.cxx, line 314 vtkXMLImageDataReader (0x51c740): Error reading extent 166 166 199 499 249 249 from piece 2
ERROR: In /home/kevin/kitware/VTK/IO/vtkXMLDataReader.cxx, line 481 vtkXMLImageDataReader (0x51c740): Cannot read point data array "ImageFile" from PointData in piece 2. The data array in the element may be too short.
Now we have a 2nd big VTI image.
I've run the program with many different image sizes and numbers of pieces with different results:
x y z pieces
10 10 10 1 // works
100 100 100 1 // works
100 100 100 2 // works
100 100 100 4 // works
100 100 100 8 // works
100 100 100 9 // works
100 100 100 10 // produces errors reading extents
100 100 100 100 // produces a backtrace
200 200 200 1 // works
200 200 200 8 // works
200 200 200 10 // produces errors reading extents
200 200 200 100 // segfaults