[vtkusers] XML format: base64 or raw
fred
fredmfp at gmail.com
Sat Feb 24 08:10:38 EST 2007
Mathieu Malaterre wrote:
> Fixed in VTK CVS.
Ok, it works quite fine.
However, a little question ;-)
Say I have a VTK binary file.
-rw-r--r-- 1 fred users 203M 2007-02-22 21:35 E.vtk
I can use vtk2xml.py to convert it to XML binary or XML base64:
-rw-r--r-- 1 fred users 128M 2007-02-24 13:46 Ebase64.vtu
-rw-r--r-- 1 fred users 96M 2007-02-24 13:48 Ebin.vtu
Ebin.vtu is much smaller than Ebase64.vtu. Good.
Now, I use my own code. I get this:
-rw-r--r-- 1 fred users 128M 2007-02-24 13:27 Ebase64.vtu
-rw-r--r-- 1 fred users 128M 2007-02-24 13:50 Ebin.vtu
Here, the two files have the same size.
Ok, you think I missed something in my code ;-)
I used:
...
vtkXMLWriterC_SetDataObjectType(writer, VTK_UNSTRUCTURED_GRID);
vtkXMLWriterC_SetDataModeType(writer, VTK_XML_DATAMODE);
...
where VTK_XML_DATAMODE equals 1 or 2.
But:
cat Ebase64.vtu
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataComp
ressor">
<UnstructuredGrid>
<Piece NumberOfPoints="2684385"
NumberOfCells="2626560" >
<PointData Scalars="Ev" Vectors="E_vect">
<DataArray type="Float32" Name="E_vect" NumberOfComponents="3"
format="appended" RangeMin="0
" RangeMax="46.0918"
offset="0" />
<DataArray type="Float32" Name="Ev" format="appended"
RangeMin="0" RangeM
ax="46.0918" offset="37368952" />
<DataArray type="Float32" Name="Ex" format="appended"
RangeMin="0" RangeM
ax="26.6113" offset="49806368" />
<DataArray type="Float32" Name="Ey" format="appended"
RangeMin="0" RangeM
ax="26.6108" offset="62213160" />
<DataArray type="Float32" Name="Ez" format="appended"
RangeMin="0" RangeM
ax="26.6113" offset="74689940" />
</PointData>
<CellData>
</CellData>
<Points>
<DataArray type="Float32" Name="Array 0xc06f380"
NumberOfComponents="3" format="appended" Ra
ngeMin="0" RangeMax="4.82659"
offset="87103988" />
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="appended"
RangeMin=""
RangeMax="" offset="96797032" />
<DataArray type="Int32" Name="offsets" format="appended"
RangeMin="" Ran
geMax="" offset="130440408" />
<DataArray type="UInt8" Name="types" format="appended"
RangeMin="" Range
Max="" offset="134155548" />
</Cells>
</Piece>
</UnstructuredGrid>
<AppendedData encoding="base64">
That sounds good.
cat Ebin.vtu:
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataComp
ressor">
<UnstructuredGrid>
<Piece NumberOfPoints="2684385" NumberOfCells="2626560">
<PointData Scalars="Ev" Vectors="E_vect">
<DataArray type="Float32" Name="E_vect" NumberOfComponents="3"
format="binary" RangeMin="0"
RangeMax="46.0918">
whereas Ebin.vtu created by vtk2xml.py looks like:
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataComp
ressor">
<UnstructuredGrid>
<Piece NumberOfPoints="2684385"
NumberOfCells="2626560" >
<PointData Scalars="Ez" Vectors="E_vect">
<DataArray type="Float32" Name="E_vect" NumberOfComponents="3"
format="appended" RangeMin="0
" RangeMax="46.0918"
offset="0" />
<DataArray type="Float32" Name="Ez" format="appended"
RangeMin="0" RangeM
ax="26.6113" offset="28026714" />
<DataArray type="Float32" Name="Ev" format="appended"
RangeMin="0" RangeM
ax="46.0918" offset="37337247" />
<DataArray type="Float32" Name="Ex" format="appended"
RangeMin="0" RangeM
ax="26.6113" offset="46665306" />
<DataArray type="Float32" Name="Ey" format="appended"
RangeMin="0" RangeM
ax="26.6108" offset="55970398" />
</PointData>
<CellData>
</CellData>
<Points>
<DataArray type="Float32" Name="Array 0x82d4a50"
NumberOfComponents="3" format="appended" Ra
ngeMin="0" RangeMax="4.82659"
offset="65327981" />
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="appended"
RangeMin=""
RangeMax="" offset="72597763" />
<DataArray type="Int32" Name="offsets" format="appended"
RangeMin="" Ran
geMax="" offset="97830293" />
<DataArray type="UInt8" Name="types" format="appended"
RangeMin="" Range
Max="" offset="100616647" />
</Cells>
</Piece>
</UnstructuredGrid>
<AppendedData encoding="raw">
which looks like better, no ?
What's the problem ?
Cheers,
--
/F
More information about the vtkusers
mailing list