[Paraview] Simple Visualization

Lorenzo Isella lorenzo.isella at gmail.com
Tue Nov 4 12:30:57 EST 2008


2008/10/31 David E DeMarle <dave.demarle at kitware.com>:
> This is what I meant:
>
> 1) load the vtk file
> ParaView now makes a pipeline that looks like this
>
>     FileReader->Data
>
> And the data is like so (just a list of points in space):
> x1,y1,z1:
> x2,y2,z2:
> ...
>
> 2) Apply the Calculator Filter to add a constant valued point
> associated array to the data.
>
> Now the Pipeline looks like this:
>   FileReader->Data->Calculator->Data'
>
> And Data looks the same as it did,
> While Data' is a set of locations in space, each with an associated value:
> x1,y1,z1:someconstant
> x1,y1,z1:someconstant
> ...
>
> 3) save Data' to a file. Click on Calculator filter in pipelinebrowser
> and select file->Save Data, and choose the VTK format.
>
> 4) compare the input and output files to see what the file should look
> like to give each vertex file format for data with values
>
> Now that the data has some value, the glyph filter has something to
> work with to let it decide how large to make the polygons that make up
> each sphere.
>
> 5) load Data' into VTK, apply the glyph filter and turn scaling by
> scalar value on.
>
> If the values meant something (like atomic number), instead of just
> being a constant value, the glyph size would mean something. Without
> that, the glyph filter just makes each sphere exactly 0.5 units wide
> because it can not guess what you need it to look like.

OK, now it works! The newly-generated vtk files contains now an extra part

POINT_DATA 5000
SCALARS Result double
LOOKUP_TABLE default
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1

where 1 is the value I gave to the calculator filter.
I can then load the new vtk file, apply the gliph filter, set scale
mode to "scalar", tick the edit box and set 1 as the value, then
visualization is correct.





> I am quite surprised that povray will make a guess actually. How does
> it know what radius to choose that looks right? Are you trying to draw
> stars from your list of coordinates, apples int a bin, marbles on a
> table, bubbles in a pint of beer, or atoms in a molecule?

Well, I cannot comment on Povray's inner workings. But to me the
situation looks different: I am telling povray (or any other code at
that regard) that in physical position (x1,y1,z1) I want a sphere with
physical diameter 1 and in position (x2,y2,z2) another sphere always
with diameter 1. If the distance between the two sphere
[sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2))] is equal to one, the two
spheres must touch, if larger they cannot and if smaller than 1 they
overlap. How that is showed and rescaled on screen is not my business,
but the fact that spheres overlap/do not overlap is fixed by their
radius and their coordinates. I do not need (nor want) to provide
povray with any extra info about what the sphere stands for.
Thanks a lot for the very appreciated help.
Kind Regards

Lorenzo

>
> cheers,
> Dave
>
> On Fri, Oct 31, 2008 at 1:08 PM, Lorenzo Isella
> <lorenzo.isella at gmail.com> wrote:
>> Hello,
>> I installed from source version 3.4.2. Now I can follow your procedure.
>> I generated the new vtk file (saved as ascii), but it is definitely
>> different from what I started from:
>>
>> # vtk DataFile Version 3.0
>> vtk output
>> ASCII
>> DATASET POLYDATA
>> POINTS 250000 float
>> 64.3441 20.798 26.378 64.3441 20.798 18.4467 66.0647 20.798 25.9853
>> 67.4446 20.798 24.8849 68.2103 20.798 23.2948 68.2103 20.798 21.5299
>> 67.4446 20.798 19.9398 66.0647 20.798 18.8394 65.5608 22.0147 25.9853
>> 66.5365 22.9904 24.8849 67.0779 23.5319 23.2948 67.0779 23.5319 21.5299
>> 66.5365 22.9904 19.9398 65.5608 22.0147 18.8394 64.3441 22.5187 25.9853
>> 64.3441 23.8985 24.8849 64.3441 24.6643 23.2948 64.3441 24.6643 21.5299
>> 64.3441 23.8985 19.9398 64.3441 22.5187 18.8394 63.1274 22.0147 25.9853
>> [...]
>>
>> For instance, now there are many more points. The generated text file
>> is above 20Mb, so it is not a piece of cake to look for its new
>> features.
>> Cheers
>>
>> Lorenzo
>>
>>
>>
>> 2008/10/31 Lorenzo Isella <lorenzo.isella at gmail.com>:
>>> 2008/10/30 David E DeMarle <dave.demarle at kitware.com>:
>>>>> Alright, we'll get to the bottom of this.
>>>>> This is a list of what I do (which is clearly NOT working).
>>>>> (1) open the .VTK file I emailed you.
>>>>> (2)click apply
>>>>> (3) I cannot select the calculator filter right now in the GUI hence
>>>>
>>>> I can not replicate that problem. As soon as I hit apply the
>>>> calculator filter is an option. I am on paraview 3.4.
>>>
>>> This unexpected. I am on Debian testing and I have paraview 3.2.2.
>>>
>>>
>>>>
>>>>> (4) I apply a gliph filter and set the radius to 0.1
>>>>> (5) I can now apply a calculator filter. I leave the defaults and
>>>>> write 1 in the empty space before applying it
>>>>> (6) nothing changes in the snapshot apart from the color
>>>>
>>>> It shouldn't. You have just associated some data with the polygonal
>>>> spheres. You have not made them larger.
>>>>
>>>> The color changed because you now have some associated data, not just
>>>> locations to work with, so paraview automatically colormaps the data.
>>>> Your data is pretty boring (everything has the value 1.0), so the
>>>> color is pretty lame, (everything is red).
>>>
>>> So this makes sense now.
>>>
>>>
>>>>> (7) select again gliph filter, set sphere to radius 0.1 and click
>>>>> apply (In the "scalar" field I now read "Result", so I thought
>>>>> Paraview somehow had info about the previous filter I had applied),
>>>>
>>>> Yes, this second glyph filter now has something besides the x,y,z
>>>> locations to work with. It has the same associated data that caused
>>>> the color to change.
>>>>
>>>>> (8) Now everything is red and I have no idea of what I should do.
>>>>
>>>> At the bottom of Glyph2's Properties Tab of the Object Inspector,
>>>> change scale mode to scalar.
>>>>
>>>> What you will now see is not what are aiming for, it actually shows a
>>>> sphere on top of every vertex within the original sets of spheres. But
>>>> change the calculator filters expression and see what happens.
>>>
>>> Here I am a bit flying blind. Changing the numerical value in the
>>> filter (1, 5, 10) does not do anything at first sight.
>>> However, if I save everything to a legacy ascii vtk file, I now get
>>> something large (about 30Mb).
>>>
>>>
>>>> You should figure out why the calculator couldn't be applied to the
>>>> final_config.vtk file reader's output.
>>>
>>> This is really the bad news. Does anyone on this list use paraview
>>> from Debian testing standard repositories?
>>> Actually, I should add now the problem of visualizing correctly the
>>> spheres appears even in the simple example with 50 particles only;
>>> there I noticed that the particles (by using radius 0.5) are actually
>>> slightly smaller than they should be (and povray also disagrees).
>>> I am puzzled; I thought all this would take minutes.
>>> Cheers
>>>
>>> Lorenzo
>>>
>>>
>>>>
>>>>>
>>>>> What am I doing wrong?
>>>>> Regards
>>>>>
>>>>> Lorenzo
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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.
>>>
>>
>>
>>
>> --
>> 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
>



-- 
Free will does not consist in inverting the river flow, but in being
the fish that leaps upstream.


More information about the ParaView mailing list