[Paraview] Paraview Programmable Source 3D Text

Dr. Roman Grothausmann grothausmann.roman at mh-hannover.de
Wed Jan 7 04:34:21 EST 2015


Dear Cory,

Many thanks for Your reply.
On 07/01/15 04:17, Cory Quammen wrote:
> vtkFollower won't work with the text glyph approach
> you are proposing. The problem is that you need to rotate each of the
> text glyphs independently to face the camera plane. If you generate a
> set of 3D glyphs at each point, using a vtkFollower in the
> representation will reorient the entire set of glyphs and not each
> glyph independently. Does that make sense?

I think this would not be a problem because I would append all labels to a 
single vtkPolyData and that would not be translated from the origin, so I'd 
think that a rotation applied by the vtkFollower to that object should do the 
trick. If I understand the general idea of representation plugins correctly, I 
could just choose this kind of camera-follower representation for the appended 
vtkVectorText object and the normal representations for other objects.
Let's assume for simplicity that I'd just want a 3D arrow to always point in the 
same direction no matter how I rotate the view direction. Would that be possible 
with this modified representation approach?

> You might want to take a look at vtkDataLabelRepresentation in
> ParaView. It draws cell ID and point ID labels oriented with the
> camera plane.

I had a look and found an example from Utkarsh here: 
http://public.kitware.com/pipermail/paraview/2012-May/024920.html
It works but has the same problem as the selection label tool: It draws the 
labels as 2D text such that labels of hidden points (when using an intransparent 
surface or volume representation) are still visible in front. For an orbiting 
cam animation we need, this effect is very irritating when viewed with many labels.
I also tried to modify vtkDataLabelRepresentation* to use:
   this->PointLabelMapper = vtkPolyDataMapper::New();
   this->PointLabelActor = vtkFollower::New();
   this->PointLabelProperty = vtkVectorText::New();
but it seems this needs many many changes in the code.

Although I'd love to have such functionality for the 3D-view of PV, one other 
idea I just had: Is it possible to load a paraview scene within a python script 
such that I'd do the creation of the animation there? Would it be possible then 
to use vtkVectorText+vtkFollower?

Many thanks for Your help.
Roman

> On Tue, Jan 6, 2015 at 5:58 AM, Dr. Roman Grothausmann
> <grothausmann.roman at mh-hannover.de> wrote:
>> Dear Cory,
>>
>>
>> Following Your suggestion, I tried to modify my current plugin to include a
>> new representation. However, I'm lost on how to combine the two things
>> together. The example at the wiki and the one I found from Utkarsh
>> (http://public.kitware.com/pipermail/paraview/2011-July/022296.html) replace
>> the Mapper and not the actor. So I'm not sure where to place the
>> text-plydata-generation in that case. Can You help me to get going with
>> this? My current attempt is attached.
>>
>> Many thanks for Your help
>> Roman
>>
>>
>> PS: I tried to compile Utkarsh's example but it stops because the
>> UpdateSuppressor seems to be gone:
>>
>> /net/home/grothama/vtk/paraview_plugins/Representation/vtkMySpecialRepresentation.cxx:43:53:
>> error: ?class vtkMySpecialRepresentation? has no member named
>> ?UpdateSuppressor?
>>
>> Would vtkMySpecialRepresentation need to be derived from
>> vtkPVUpdateSuppressor?
>>
>>
>> On 05/01/15 14:57, Cory Quammen wrote:
>>>
>>> Hi Roman,
>>>
>>> A representation plugin could probably do this. It would just need to
>>> set its internal actor to an instance of vtkFollower and set the
>>> camera from the view's renderer, which could be set by overriding the
>>> AddToView(vtkView* view) method in your custom representation.
>>>
>>> I hope that helps,
>>> Cory
>>>
>>> On Mon, Jan 5, 2015 at 8:24 AM, Dr. Roman Grothausmann
>>> <grothausmann.roman at mh-hannover.de> wrote:
>>>>
>>>> Dear Utkarsh,
>>>>
>>>>
>>>> Needing the same thing as Willi, I've created a paraview plugin written
>>>> in
>>>> C++ doing basically the same as Your script. Would it be possible to
>>>> achieve
>>>> something like vtkFollower does from within a c++ PV plugin such that the
>>>> text always faces the camera? An other idea would be to use Python in the
>>>> animation view to rotate the text as the camera orbits. This would be a
>>>> workaround only for animations, which would suffice for me. Do You thing
>>>> that should be possible if nothing else works?
>>>>
>>>> Many thanks for looking into this.
>>>> Roman
>>>>
>>>> On 26/09/13 19:52, Utkarsh Ayachit wrote:
>>>>>
>>>>>
>>>>> Alas, that's not easy to do, if at all possible, with Python source.
>>>>>
>>>>>
>>>>> On Thu, Sep 26, 2013 at 5:48 AM, Willi Karel <wk at ipf.tuwien.ac.at
>>>>> <mailto:wk at ipf.tuwien.ac.at>> wrote:
>>>>>
>>>>>       Dear Utkarsh,
>>>>>
>>>>>       would it be possible to synchronize the transform of the rendered
>>>>> texts
>>>>>       to the transform of the camera, such that the planes in which the
>>>>> texts
>>>>>       lie stay normal to the viewing direction?
>>>>>       I'm aware of vtkFollower, but I'm not sure if it is applicable /
>>>>> how
>>>>> to
>>>>>       make use of it in the context of ParaView / Programmable Source, as
>>>>> it
>>>>>       derives from vtkActor.
>>>>>
>>>>>       Many thanks!
>>>>>       Willi.
>>>>>
>>
>>
>> --
>> Dr. Roman Grothausmann
>>
>> Tomographie und Digitale Bildverarbeitung
>> Tomography and Digital Image Analysis
>>
>> Institut für Funktionelle und Angewandte Anatomie, OE 4120
>> Medizinische Hochschule Hannover
>> Carl-Neuberg-Str. 1
>> D-30625 Hannover
>>
>> Tel. +49 511 532-9574
>
>
>

-- 
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover

Tel. +49 511 532-9574


More information about the ParaView mailing list