No subject


Wed May 9 12:08:04 EDT 2012


swapped =3D ((num>>24)&0xff) | // move byte 3 to byte 0=0A=
                    ((num<<8)&0xff0000) | // move byte 1 to byte 2=0A=
                    ((num>>8)&0xff00) | // move byte 2 to byte 1=0A=
                    ((num<<24)&0xff000000 // byte 0 to byte 3=0A=
=0A=
Call something like this on each word in your buffer before or while=0A=
you write it to switch endians.=0A=
=0A=
David E DeMarle=0A=
Kitware, Inc.=0A=
R&D Engineer=0A=
21 Corporate Drive=0A=
Clifton Park, NY 12065-8662=0A=
Phone: 518-881-4909=0A=
=0A=
=0A=
On Fri, Aug 17, 2012 at 12:16 PM, Hal Canary <hal at cs.unc.edu> wrote:=0A=
> The legacy VTK formats are agnostic with respect to endinaness, which is =
one=0A=
> reason why I almost never use the binary versions of them.=0A=
>=0A=
> If you can't link to VTK and use vtkXMLImageDataWriter, as David suggeste=
d,=0A=
> then another option is to write a small C++ or Python program to convert=
=0A=
> from legacy ASCII to XML binary.  For example:=0A=
>   http://www.paraview.org/Wiki/Convert_a_File_from_LegacyVTK_to_VTI=0A=
>=0A=
>=0A=
>=0A=
> On 08/17/2012 10:45 AM, Kharche, Sanjay wrote:=0A=
>>=0A=
>>=0A=
>> Thanks for the suggestion. However, I cannot incorporate any=0A=
>> dependencies into my code. Since posting my message, I have=0A=
>> discovered that I can put a text header (similar to VTK ASCII) and=0A=
>> then the data in binary into the output files. The problem (if there=0A=
>> a problem!) has now evolved to getting the binary fwrite to be big=0A=
>> endian - or is there another way?=0A=
>>=0A=
>>=0A=
>> On 17 August 2012 14:02, David Doria wrote:=0A=
>=0A=
>>=0A=
>>=0A=
>> > Why don't you construct VTK objects and use a VTK writer to write=0A=
>> > the file?=0A=
>> >=0A=
>> > Something like this:=0A=
>> > http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/XMLStructuredGridWriter=0A=
>> >=0A=
>> >  It seems like you are reinventing the wheel a little bit by=0A=
>> > actually formatting the file to VTK file format specifications=0A=
>> > manually.=0A=
>=0A=
>=0A=
> _______________________________________________=0A=
> Powered by www.kitware.com=0A=
>=0A=
> Visit other Kitware open-source projects at=0A=
> http://www.kitware.com/opensource/opensource.html=0A=
>=0A=
> Please keep messages on-topic and check the ParaView Wiki at:=0A=
> http://paraview.org/Wiki/ParaView=0A=
>=0A=
> Follow this link to subscribe/unsubscribe:=0A=
> http://www.paraview.org/mailman/listinfo/paraview=0A=
_______________________________________________=0A=
Powered by www.kitware.com=0A=
=0A=
Visit other Kitware open-source projects at http://www.kitware.com/opensour=
ce/opensource.html=0A=
=0A=
Please keep messages on-topic and check the ParaView Wiki at: http://paravi=
ew.org/Wiki/ParaView=0A=
=0A=
Follow this link to subscribe/unsubscribe:=0A=
http://www.paraview.org/mailman/listinfo/paraview=0A=


More information about the ParaView mailing list