[vtkusers] Writing other XML properties in paraview

Chiranjib Sur sur.chiranjib at gmail.com
Fri Mar 20 05:31:16 EDT 2015


Hi Seb,
I tried the method you suggested.

The typical vtp structure is something like the following :


<?xml version="1.0"?>
<VTKFile type="PolyData" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataCompressor">
  <PolyData>
 .....


When I use the method you suggested, I can generate field data under
<polydata> which looks like the following ;

<?xml version="1.0"?>
<VTKFile type="PolyData" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataCompressor">
  <PolyData>
    <FieldData>
      <DataArray type="Float64" Name="MYString" NumberOfTuples="0"
format="appended" RangeMin= .......... />
    </FieldData>



I understand how I get this since, my polydata writer is set as the
following :


vtkSmartPointer<vtkXMLPolyDataWriter> w =
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
vtkSmartPointer<vtkPolyData> p = vtkSmartPointer<vtkPolyData>::New();

vtkSmartPointer<vtkDoubleArray> s = vtkSmartPointer<vtkDoubleArray>::New();
s->SetName ("MyString");
...
p->GetFieldData()->AddArray(s);
...

w-> SetInputData(p);
w->Write();




But what is want is the following (new lines marked in Red) and not related
to the polydata at all.

<?xml version="1.0"?>

<VTKFile type="PolyData" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataCompressor">



<MyParameters>

    <Parameter1>Integer Value </Parameter1>

    <Parameter2>Double Value </Parameter2>

    <Parameter3>String Value </Parameter3>

</MyParameters>


<PolyData>

......



What would be your suggestion about doing this ? I need to write my own
writer class or can I use something which exists ?

Thanks in advance,
Chiranjib


On Thu, Mar 19, 2015 at 8:59 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:

> polydata->GetFieldData()->AddArray( anyArrayYouWant )
>
> anyArrayYouWant can be a String array with only one value that contain
> your XML text.
>
> On Thu, Mar 19, 2015 at 9:19 AM, Chiranjib Sur <sur.chiranjib at gmail.com>
> wrote:
>
>> HI Seb,
>> Thanks for your answer. My issue is to write the data into the vtp file
>> along with other information like pointdata etc. I am able to generate the
>> data but i have no clue how to write in the format I want to. I am using
>> vtkPolyDataWeiter class to write the .vtp file but in between how can I
>> insert few XML tags with some values ?
>>
>> If you can point towards some examples which you are referring to as the
>> fields data, that might help.
>>
>> Thanks,
>> Chiranjib
>>
>> On Thu, Mar 19, 2015 at 8:43 PM, Sebastien Jourdain <
>> sebastien.jourdain at kitware.com> wrote:
>>
>>> You can use fields data to store any random information regarding your
>>> dataset.
>>>
>>> I'm not sure that's what you ask, but at least that's what it seems.
>>>
>>> Seb
>>>
>>> On Thu, Mar 19, 2015 at 8:06 AM, Chiranjib Sur <sur.chiranjib at gmail.com>
>>> wrote:
>>>
>>>> Hello Experts,
>>>> When I generate my polydata and write the information in a .vtp file, I
>>>> want to write few addition information like the following in the same file
>>>> along with the polydata information:
>>>>
>>>> <MyParameters>
>>>>     <Parameter1>Integer Value </Parameter1>
>>>>     <Parameter2>Double Value </Parameter2>
>>>>     <Parameter3>String Value </Parameter3>
>>>> </MyParameters>
>>>>
>>>> Is there any vtk class that will help me doing this ?
>>>>
>>>> Thanks in advance,
>>>> Chiranjib
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>
>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150320/df2717e5/attachment.html>


More information about the vtkusers mailing list