[vtk-developers] vtkXMLCompositeDataWriter does not write vtkPolyData

Robert Maynard robert.maynard at kitware.com
Mon Dec 6 15:14:35 EST 2010


Hi Pierre,

This fixes has been merged into VTK. Thank you for fixing this bug.

On Mon, Dec 6, 2010 at 8:35 AM, Pierre Fillard <pierre.fillard at gmail.com>wrote:

> Hello,
>
>
> I was trying to write a vtkMultiBlockDataSet using *
> vtkXMLMultiBlockDataWriter*.
>
>
> My vtkMultiBlockDataSet is composed with multiple vtkPolyData by calling:
>
> *vtkMultiBlockDataSet *dataset = vtkMultiBlockDataSet::New();
> dataset->SetBlock( id, some_vtk_polydata);*
>
>
> Using the vtkXMLMultiBlockDataWriter to save it creates the xml file, but
> the <DataSet> tag remains empty (and the vtkPolyData is not saved).
>
>
> I tracked this problem down to the method:
>
> *vtkStdString vtkXMLCompositeDataWriter::CreatePieceFileName(int piece)*
>
> whose role is to return a valid filename given the block number to be
> written. However, I noticed that the method starts by this check:
>
> *if(this->Internal->DataTypes[piece] <= 0)
>     {
>     return fname;
>     }
> *
>
> The array DataTypes is filled in the method:
>
> *void vtkXMLCompositeDataWriter::FillDataTypes(vtkCompositeDataSet*
> hdInput)*
>
> and contains the vtk type of each block dataset (e.g., VTK_POLY_DATA,
> VTK_UNSTRUCTED_GRID, etc.) such that the writer knows what extension to use,
> and which writer to instanciate. If the vtkDataSet is not recognized, *-1*is passed to the array.
>
>
> Now, going back to *vtkXMLCompositeDataWriter::CreatePieceFileName()*, the
> check: *if(this->Internal->DataTypes[piece] <= 0)* invalidates data whose
> type is 0 (and less than 0 of course). It appears that VTK_POLY_DATA is
> defined as 0! So with this check, it becomes impossible to write vtkPolyData
> using vtkXMLMultiBlockDataWriter.
>
>
> Changing the check to:
> *
> if(this->Internal->DataTypes[piece] < 0)*
>
> solved the problem.
>
>
> Maybe I am missing something obvious, but in case this is a bug, I attached
> a patch to this mail (file IO/vtkXMLCompositeDataWriter.cxx).
>
>
> Hope this will be useful.
>
> Pierre.
>
>
>
> --
> Pierre Fillard, Ph.D.,
> Research Scientist
> INRIA Parietal - Neurospin
> Bât 145, Point Courrier 156
> 91191 Gif/Yvette, France
> tel: +33 1 69 08 79 92
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>


-- 
Robert Maynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20101206/f9d996ab/attachment.html>


More information about the vtk-developers mailing list