vtkXMLImageDataWriter/Reader with 2d images and cell data does not work properly
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Here is how to reproduce this VTK bug from ParaView:
- Open a 3d image data (for instance ParaView/Data/Data/chombo3d/chombo3d_0.vti, which has cell data only)
- If your 3d image has point data, apply PointDataToCellData without checking "pass point data¨
- At this point you have a 3D image with only cell data.
- Save it with extension .vti
- Load it: no error=> vtkXMLImageDataWriter/Reader works fine for 3d images with cell data
- Use ExtractGrid filter and set k min and max indices to 0, you get a 2d image with cell data.
- save this 2d image with extension .vti
- load it: you get an error message like
Error or warning: There was a VTK Error in file: ParaView/VTK/Filtering/vtkDataSet.cxx (405)
Cell array phi with 1 components, has only 0 tuples but there are 64 cells ErrorMessage end
So, the vtkXMLImageDataWriter/Reader has trouble with 2d images with celldata only.
Of course, I don't know if the error is in the reader or the writer. If I write a small c++ test that save a 2d image and activate writer->SetDataModeToAscii() on it, I can see that the output file contents some celldata, but I still get the same error when I try to load it in ParaView.