[Paraview] Simple Visualization

David E DeMarle dave.demarle at kitware.com
Thu Oct 30 13:34:12 EDT 2008


On Thu, Oct 30, 2008 at 1:22 PM, Lorenzo Isella
<lorenzo.isella at gmail.com> wrote:
> 2008/10/30 David E DeMarle <dave.demarle at kitware.com>:
>> You can manually change the glyphs shape and size. It has some default
>> size which is probably not working well with your data.
>
> Hello,
> I attach the visualization of the system I obtain via povray.
> I seem to get a nice "agreement" by setting the sphere radius to 0.1
> (but I cannot expect to go by trial and error in case I need to
> post-process hundreds of files).

How does povray determine the size?

In visualization glyphs often scaled according to some scalar property
at each point. For example points with a value corresponding to a
larger atomic number (or temperature or density or velocity magnitude
or whatever) could be made bigger. Glyphs are often oriented according
to a vector or tensor orientation too.

>
> You can also
>> supply values with each point and have the glyphs shaped and oriented
>> according the the values.
>
> This is a bit unclear to me. Do you mean that I should add this info
> directly in the VTK file? Or via the GUI?

Either.

Try this: in the GUI filter the source or readers output through a
calculator filter to add an array with a constant value. Then apply
the Glyph filter and scale by the new array. Now save the output of
the calculator as a VTK file and compare it with the original.

> Cheers
>
> Lorenzo
>
>
>
>>
>> On Thu, Oct 30, 2008 at 1:07 PM, David E DeMarle
>> <dave.demarle at kitware.com> wrote:
>>> On Thu, Oct 30, 2008 at 12:50 PM, Lorenzo Isella
>>> <lorenzo.isella at gmail.com> wrote:
>>>> Hello,
>>>> Sorry for coming back to this topic again.
>>>> I applied your suggestion to the example case and, as far as I can
>>>> say, it works.
>>>> However, when applied to another case (this time with 5000 particles),
>>>> the result is far from correct (I see a lot of coalescing sphere,
>>>> whereas Povray visualizes them as almost-in-touch objects, none of
>>>> them overlapping).
>>>
>>> Can you post images? It would help diagnose what is happening.
>>>
>>>> Hence my question: does Paraview apply any sort of automatic rescaling
>>>> of distances between the spheres to improve visualization?
>>>
>>> No.
>>>
>>>> I attach the text file which is giving me a hard time.
>>>> Many thanks
>>>>
>>>> Lorenzo
>>>>
>>>> P.S.: I see that paraview is an application having a scripting
>>>> language of its own (probably Python). It would be extremely useful to
>>>> me to know more about that in order to automate some tasks.
>>>> Where can I find more about it?
>>>>
>>>
>>> Python is a general purpose programming language. There are many books
>>> and online resources about it.
>>>
>>> About using Python to control paraview, take a look at the paraview
>>> wiki, there are pages about python scripting paraview some recent
>>> excellent tutorials there about what can be done with scripting.
>>>
>>> cheers,
>>> Dave
>>>
>>>> 2008/10/30 David E DeMarle <dave.demarle at kitware.com>:
>>>>> Or, try out the example of a python programmable reader that I've just
>>>>> posted to the wiki.
>>>>> http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters.
>>>>>
>>>>> To use it, open up Source->Programmable Source, set the output type to
>>>>> Poly Data, paste in the text, correct the filename, and in your case
>>>>> change the separator from "," to " ".
>>>>>
>>>>> Then apply the glyph filter. As Ken suggested.
>>>>>
>>>>>
>>>>> On Thu, Oct 30, 2008 at 10:10 AM, Moreland, Kenneth <kmorel at sandia.gov> wrote:
>>>>>> To be honest, ParaView doesn't make loading in a simple list of coordinates
>>>>>> as easy as it should.  It's something we will be working on in the near
>>>>>> future (e.g. bug #5016, http://www.paraview.org/Bug/view.php?id=5016).
>>>>>> However, it is still possible to do what you want, it just takes a few more
>>>>>> steps than it should.
>>>>>>
>>>>>> I think the easiest way to get your data into ParaView is to convert it to a
>>>>>> legacy VTK file.  From what you attached below, all you need to do is add
>>>>>> some header in front of it.  Below I have included a modified form of your
>>>>>> data that conforms to the legacy VTK file format (hopefully line endings are
>>>>>> preserved again, because they matter in the header).  Copy the data into a
>>>>>> file with a .vtk extension and you will be able to load it into ParaView.
>>>>>>
>>>>>> When you first load this into ParaView, you will not actually see anything
>>>>>> drawn.  This is because I was too lazy to add cells to the data.  However,
>>>>>> you can use the Glyph filter to add the exact geometry you described (a
>>>>>> sphere of radius 0.5).  After loading the data (don't forget to hit the
>>>>>> Apply button), add the Glyph filter (there is a convenient toolbar button
>>>>>> with an image of a large sphere covered by smaller green spheres).  Change
>>>>>> the "Glyph Type" to "Sphere".  The default radius happens to be 0.5, so you
>>>>>> are good to hit the Apply button and you should see your particles.
>>>>>>
>>>>>> Hope that helps.
>>>>>>
>>>>>> -Ken
>>>>>>
>>>>>> # vtk DataFile Version 2.0
>>>>>> Some example 50 particles.
>>>>>> ASCII
>>>>>> DATASET POLYDATA
>>>>>> POINTS 50 double
>>>>>> 5.488638491049999857e+01 4.533285539199999903e+01 5.990067340830000120e+01
>>>>>> 5.507634645640000315e+01 4.690055020359999816e+01 6.205816942250000068e+01
>>>>>> 5.611924302530000119e+01 4.584485860769999732e+01 6.292926739199999986e+01
>>>>>> 5.641759022880000174e+01 4.340893347419999770e+01 5.895382539940000299e+01
>>>>>> 5.693618177649999978e+01 4.489218829629999874e+01 6.410368616600000280e+01
>>>>>> 5.555939302830000059e+01 4.362780979029999884e+01 5.951328359800000101e+01
>>>>>> 5.554350617000000057e+01 4.188482518459999682e+01 5.878381606479999988e+01
>>>>>> 5.604427505559999645e+01 4.649609805720000111e+01 6.210705354470000117e+01
>>>>>> 5.530048293149999949e+01 4.624494566079999913e+01 5.959863344469999902e+01
>>>>>> 5.467705995490995718e+01 4.355678678950000204e+01 5.875568285069999774e+01
>>>>>> 5.621869458380000140e+01 4.439583221640000232e+01 5.924903889080000141e+01
>>>>>> 5.561998122079999973e+01 4.394605972949999995e+01 5.851489735050000007e+01
>>>>>> 5.690921858690000334e+01 4.582500510620000256e+01 6.362092096509999806e+01
>>>>>> 5.475098914309999998e+01 4.619126324740000200e+01 6.049120611730000263e+01
>>>>>> 5.641635311080000292e+01 4.243341419539999748e+01 5.854919389150000342e+01
>>>>>> 5.621830122240000094e+01 3.991548769199999924e+01 5.863887904930000161e+01
>>>>>> 5.719361166030000021e+01 4.174063668590000020e+01 5.835930649010000337e+01
>>>>>> 5.616689354599999717e+01 4.325470363480000202e+01 5.795258720969999899e+01
>>>>>> 5.579069489220000122e+01 4.498163925800000129e+01 5.848915900779999788e+01
>>>>>> 5.481830772069999824e+01 4.707179765050000242e+01 6.105822532359999855e+01
>>>>>> 5.564110346620000058e+01 3.912246424140000300e+01 5.901021183169999773e+01
>>>>>> 5.621457283520000203e+01 4.152797633419999812e+01 5.806957834979999689e+01
>>>>>> 5.719488688780000274e+01 3.994124700609999934e+01 5.900162063970000048e+01
>>>>>> 5.665532662689999910e+01 4.495426231879999790e+01 6.309290282119999915e+01
>>>>>> 5.580952576610000193e+01 4.721484517420000060e+01 6.137584942670000032e+01
>>>>>> 5.561332834329999741e+01 4.679007541709999884e+01 6.043663970149999898e+01
>>>>>> 5.518545746840000277e+01 4.457136614680000264e+01 5.923679874550000335e+01
>>>>>> 5.647997341979999675e+01 4.154384547210000278e+01 5.909534597060000038e+01
>>>>>> 5.765199147479999908e+01 4.512795159830000102e+01 6.337497765989999721e+01
>>>>>> 5.584302705049999815e+01 4.535378866500000328e+01 5.946951471839999925e+01
>>>>>> 5.562396915850000312e+01 4.236937535799999921e+01 5.785716254439999773e+01
>>>>>> 5.551942573040000184e+01 4.293100157170000131e+01 5.873180053770000342e+01
>>>>>> 5.536439253620000045e+01 4.586432050150000350e+01 6.446544382109999560e+01
>>>>>> 5.601580874620000117e+01 4.532177775110000084e+01 6.383980378760995222e+01
>>>>>> 5.522183270229999863e+01 4.591330843859999788e+01 6.239036235070000203e+01
>>>>>> 5.552475736130995188e+01 4.671884746799999988e+01 6.299182048400000156e+01
>>>>>> 5.569300298889999823e+01 4.574124821929999740e+01 6.043186792259999862e+01
>>>>>> 5.505789659319999885e+01 4.672642824350000268e+01 6.394446345749999949e+01
>>>>>> 5.647888952489999781e+01 4.055610006399999889e+01 5.944827188789999894e+01
>>>>>> 5.512435615700000113e+01 4.330096744890000338e+01 5.784002608130000311e+01
>>>>>> 5.587834371390000143e+01 4.749533078369999828e+01 6.238585686929999952e+01
>>>>>> 5.554561466909999723e+01 4.008492034519999692e+01 5.941969696160000325e+01
>>>>>> 5.513332295810000261e+01 4.791230244629999646e+01 6.177737797679999687e+01
>>>>>> 5.680377349180000124e+01 4.076690689720000194e+01 5.847625241530000295e+01
>>>>>> 5.520251321359999963e+01 4.582912735579999719e+01 6.343219189789999746e+01
>>>>>> 5.499600962339999910e+01 4.554144637859999989e+01 5.888039144079999687e+01
>>>>>> 5.577575750479999783e+01 4.085686345740000291e+01 5.873738147630000128e+01
>>>>>> 5.603135377430000119e+01 4.636511701490000092e+01 6.383143826789999764e+01
>>>>>> 5.642135364429999811e+01 3.952228659610000250e+01 5.958435845870000236e+01
>>>>>> 5.541103635689999862e+01 4.624251213800000215e+01 6.131094504189999839e+01
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 10/30/08 5:47 AM, "Lorenzo Isella" <lorenzo.isella at gmail.com> wrote:
>>>>>>
>>>>>>> Dear All,
>>>>>>> I am a complete newbie in visualization, so an apology in advance is
>>>>>>> what I ask will sound trivial.
>>>>>>> I am browsing several Paraview tutorials, but I am missing out what I
>>>>>>> really need.
>>>>>>> Right now, I do NOT need e.g. to plot a temperature field on a metal
>>>>>>> slab with a non-trivial geometry. Rather, I have a set of particles
>>>>>>> (each is a simple sphere) in a 3D-box. The raw data is an ascii file
>>>>>>> of the form:
>>>>>>>
>>>>>>> x_1  y_1  z_1
>>>>>>> x_2  y_2  z_2
>>>>>>> .............
>>>>>>> x_N  y_N  z_N
>>>>>>>
>>>>>>> In each position {x_i,y_i,z_i} there is a sphere having radius 0.5.
>>>>>>> Hence I do not have a grid but only a list of positions of some
>>>>>>> spheres in space.
>>>>>>> How should I deal with that in Paraview? Which format should I convert
>>>>>>> my ascii file to?
>>>>>>> In case it turns out to be useful to fix the ideas, I paste below an
>>>>>>> example case with 50 particles (each line should contain three
>>>>>>> numbers, but I do not know how it will be shown by your email client).
>>>>>>> Many thanks
>>>>>>>
>>>>>>> Lorenzo
>>>>>>>
>>>>>>> 5.488638491049999857e+01 4.533285539199999903e+01 5.990067340830000120e+01
>>>>>>> 5.507634645640000315e+01 4.690055020359999816e+01 6.205816942250000068e+01
>>>>>>> 5.611924302530000119e+01 4.584485860769999732e+01 6.292926739199999986e+01
>>>>>>> 5.641759022880000174e+01 4.340893347419999770e+01 5.895382539940000299e+01
>>>>>>> 5.693618177649999978e+01 4.489218829629999874e+01 6.410368616600000280e+01
>>>>>>> 5.555939302830000059e+01 4.362780979029999884e+01 5.951328359800000101e+01
>>>>>>> 5.554350617000000057e+01 4.188482518459999682e+01 5.878381606479999988e+01
>>>>>>> 5.604427505559999645e+01 4.649609805720000111e+01 6.210705354470000117e+01
>>>>>>> 5.530048293149999949e+01 4.624494566079999913e+01 5.959863344469999902e+01
>>>>>>> 5.467705995490995718e+01 4.355678678950000204e+01 5.875568285069999774e+01
>>>>>>> 5.621869458380000140e+01 4.439583221640000232e+01 5.924903889080000141e+01
>>>>>>> 5.561998122079999973e+01 4.394605972949999995e+01 5.851489735050000007e+01
>>>>>>> 5.690921858690000334e+01 4.582500510620000256e+01 6.362092096509999806e+01
>>>>>>> 5.475098914309999998e+01 4.619126324740000200e+01 6.049120611730000263e+01
>>>>>>> 5.641635311080000292e+01 4.243341419539999748e+01 5.854919389150000342e+01
>>>>>>> 5.621830122240000094e+01 3.991548769199999924e+01 5.863887904930000161e+01
>>>>>>> 5.719361166030000021e+01 4.174063668590000020e+01 5.835930649010000337e+01
>>>>>>> 5.616689354599999717e+01 4.325470363480000202e+01 5.795258720969999899e+01
>>>>>>> 5.579069489220000122e+01 4.498163925800000129e+01 5.848915900779999788e+01
>>>>>>> 5.481830772069999824e+01 4.707179765050000242e+01 6.105822532359999855e+01
>>>>>>> 5.564110346620000058e+01 3.912246424140000300e+01 5.901021183169999773e+01
>>>>>>> 5.621457283520000203e+01 4.152797633419999812e+01 5.806957834979999689e+01
>>>>>>> 5.719488688780000274e+01 3.994124700609999934e+01 5.900162063970000048e+01
>>>>>>> 5.665532662689999910e+01 4.495426231879999790e+01 6.309290282119999915e+01
>>>>>>> 5.580952576610000193e+01 4.721484517420000060e+01 6.137584942670000032e+01
>>>>>>> 5.561332834329999741e+01 4.679007541709999884e+01 6.043663970149999898e+01
>>>>>>> 5.518545746840000277e+01 4.457136614680000264e+01 5.923679874550000335e+01
>>>>>>> 5.647997341979999675e+01 4.154384547210000278e+01 5.909534597060000038e+01
>>>>>>> 5.765199147479999908e+01 4.512795159830000102e+01 6.337497765989999721e+01
>>>>>>> 5.584302705049999815e+01 4.535378866500000328e+01 5.946951471839999925e+01
>>>>>>> 5.562396915850000312e+01 4.236937535799999921e+01 5.785716254439999773e+01
>>>>>>> 5.551942573040000184e+01 4.293100157170000131e+01 5.873180053770000342e+01
>>>>>>> 5.536439253620000045e+01 4.586432050150000350e+01 6.446544382109999560e+01
>>>>>>> 5.601580874620000117e+01 4.532177775110000084e+01 6.383980378760995222e+01
>>>>>>> 5.522183270229999863e+01 4.591330843859999788e+01 6.239036235070000203e+01
>>>>>>> 5.552475736130995188e+01 4.671884746799999988e+01 6.299182048400000156e+01
>>>>>>> 5.569300298889999823e+01 4.574124821929999740e+01 6.043186792259999862e+01
>>>>>>> 5.505789659319999885e+01 4.672642824350000268e+01 6.394446345749999949e+01
>>>>>>> 5.647888952489999781e+01 4.055610006399999889e+01 5.944827188789999894e+01
>>>>>>> 5.512435615700000113e+01 4.330096744890000338e+01 5.784002608130000311e+01
>>>>>>> 5.587834371390000143e+01 4.749533078369999828e+01 6.238585686929999952e+01
>>>>>>> 5.554561466909999723e+01 4.008492034519999692e+01 5.941969696160000325e+01
>>>>>>> 5.513332295810000261e+01 4.791230244629999646e+01 6.177737797679999687e+01
>>>>>>> 5.680377349180000124e+01 4.076690689720000194e+01 5.847625241530000295e+01
>>>>>>> 5.520251321359999963e+01 4.582912735579999719e+01 6.343219189789999746e+01
>>>>>>> 5.499600962339999910e+01 4.554144637859999989e+01 5.888039144079999687e+01
>>>>>>> 5.577575750479999783e+01 4.085686345740000291e+01 5.873738147630000128e+01
>>>>>>> 5.603135377430000119e+01 4.636511701490000092e+01 6.383143826789999764e+01
>>>>>>> 5.642135364429999811e+01 3.952228659610000250e+01 5.958435845870000236e+01
>>>>>>> 5.541103635689999862e+01 4.624251213800000215e+01 6.131094504189999839e+01
>>>>>>> _______________________________________________
>>>>>>> ParaView mailing list
>>>>>>> ParaView at paraview.org
>>>>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>   ****      Kenneth Moreland
>>>>>>    ***      Sandia National Laboratories
>>>>>> ***********
>>>>>> *** *** ***  email: kmorel at sandia.gov
>>>>>> **  ***  **  phone: (505) 844-8919
>>>>>>    ***      fax:   (505) 845-0833
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> ParaView mailing list
>>>>>> ParaView at paraview.org
>>>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> David E DeMarle
>>>>> Kitware, Inc.
>>>>> R&D Engineer
>>>>> 28 Corporate Drive
>>>>> Clifton Park, NY 12065-8662
>>>>> Phone: 518-371-3971 x109
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Free will does not consist in inverting the river flow, but in being
>>>> the fish that leaps upstream.
>>>>
>>>
>>>
>>>
>>> --
>>> David E DeMarle
>>> Kitware, Inc.
>>> R&D Engineer
>>> 28 Corporate Drive
>>> Clifton Park, NY 12065-8662
>>> Phone: 518-371-3971 x109
>>>
>>
>>
>>
>> --
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x109
>>
>
>
>
> --
> Free will does not consist in inverting the river flow, but in being
> the fish that leaps upstream.
>



-- 
David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109


More information about the ParaView mailing list