<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7000.0"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px" 
id=MailContainerBody leftMargin=0 topMargin=0 bgColor=#ffffff text=#000000 
CanvasTabStop="true" name="Compose message area">
<DIV>Hi Thorsten,<BR><BR>That's really helpful. I don't quite know how to write 
out the number of bits as a char? If you could explain a way of how to do that 
it would be greatly appreciated. <BR><BR>Also, how do I calculate what value 
goes in for the offset? I had a look at a couple of output files from paraview 
and it wasnt obvious how it was calculated.<BR><BR>Thanks<BR>David</DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=th@tp1.rub.de 
href="mailto:th@tp1.rub.de">Thorsten Hater</A> </DIV>
<DIV><B>Sent:</B> Tuesday, March 31, 2009 2:23 PM</DIV>
<DIV><B>To:</B> <A title=d.t.mulholland@googlemail.com 
href="mailto:d.t.mulholland@googlemail.com">David Mulholland</A> </DIV>
<DIV><B>Cc:</B> <A title=paraview@paraview.org 
href="mailto:paraview@paraview.org">paraview@paraview.org</A> </DIV>
<DIV><B>Subject:</B> Re: [Paraview] VTK XML Binary Output</DIV></DIV></DIV>
<DIV><BR></DIV>Hello,<BR><BR>the solution might be to append your data 
as<BR><BR>&lt; DataArray ... format="appended"&gt;<BR>&lt;/DataArray&gt;<BR>&lt; 
AppendedData encoding="raw"&gt;<BR>_NNNNData <BR>&lt;/AppendedData&gt;<BR>where 
you should replace NNNN with a four <BR>byte integer containing the number of 
bytes <BR>in the data array as 4 chars.<BR>Setting the encoding to "raw" tells 
ParaView, that<BR>the data is simply a stream of bytes rather than <BR>base64 
encoded.<BR>If you want to write Image I can supply a small<BR>writer project 
for 2D data.<BR><BR>&nbsp;&nbsp;&nbsp; Thorsten<BR>&nbsp;<BR>David Mulholland 
schrieb: 
<BLOCKQUOTE cite=mid:94F73CF1F23B43C096CCE910A36EC616@dm105 type="cite">
  <META name=GENERATOR content="MSHTML 8.00.7000.0">
  <DIV>Hello,<BR><BR>I am currently trying to write my own quick output routine 
  to generate a <BR>binary file using C++. I am currently trying to avoid having 
  to use the vtk <BR>libraries because I only need a very basic output that 
  doesn't change much. <BR>I so far have the ASCII output working no problem but 
  I can't get the binary <BR>working.<BR><BR>I am using file.write() function to 
  output the binary data and that seems to <BR>be working no problem and when 
  used in a legacy format application it works <BR>perfectly except that the 
  data is LittleEndian instead of BigEndian. That's <BR>why I have moved to 
  BigEndian because I don't want to have to make the <BR>output routine for the 
  data anymore complicated that file.write.<BR><BR>I started using the xml 
  format and considering my output is raw binary and <BR>not base64 I changed it 
  to be in the AppendedData section instead of <BR>DataArray. It still isn't 
  working right, I get the following error when I <BR>try to load in 
  ParaView:<BR><BR>ERROR: In 
  ..\..\..\ParaView3\VTK\IO\vtkXMLStructuredDataReader.cxx, line 
  349<BR>vtkXMLImageDataReader (0ADEC7F8): Error reading extent 0 422 0 242 0 1 
  from <BR>piece 0<BR><BR><BR>ERROR: In 
  ..\..\..\ParaView3\VTK\IO\vtkXMLDataReader.cxx, line 
  537<BR>vtkXMLImageDataReader (0ADEC7F8): Cannot read cell data array 
  "pressure" <BR>from PointData in piece 0.&nbsp; The data array in the element 
  may be too short.<BR><BR>The format of my output file is as 
  follows:<BR><BR>&lt;?xml version="1.0"?&gt;<BR>&lt;VTKFile type="ImageData" 
  version="0.1" byte_order="LittleEndian"&gt;<BR>&lt;ImageData WholeExtent="0 
  422 0 242 0 1" Origin="0 0 0" Spacing="1 1 1"&gt;<BR>&lt;Piece Extent="0 422 0 
  242 0 1"&gt;<BR>&lt;PointData&gt;<BR>&lt;/PointData&gt;<BR>&lt;CellData 
  Scalars="pressure"&gt;<BR>&lt;DataArray type="Float32" Name="pressure" 
  format="appended" 
  offset="0"/&gt;<BR>&lt;/CellData&gt;<BR>&lt;/Piece&gt;<BR>&lt;/ImageData&gt;<BR>&lt;AppendedData 
  encoding="raw"&gt;<BR>_BINARYDATA<BR>&lt;/AppendedData&gt;<BR>&lt;/VTKFile&gt;<BR><BR>Note 
  following an error message I have added an _ at the start of the binary 
  <BR>data. Is this required?<BR><BR>One final thing, when using appended data, 
  how do you calculate what the <BR>offset should 
  be?<BR><BR>Thanks<BR>David</DIV><PRE wrap=""><HR SIZE=4 width="90%">
_______________________________________________
Powered by <A class=moz-txt-link-abbreviated href="http://www.kitware.com">www.kitware.com</A>

Visit other Kitware open-source projects at <A class=moz-txt-link-freetext href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</A>

Please keep messages on-topic and check the ParaView Wiki at: <A class=moz-txt-link-freetext href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</A>

Follow this link to subscribe/unsubscribe:
<A class=moz-txt-link-freetext href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</A>
  </PRE></BLOCKQUOTE><BR></BODY></HTML>