[vtkusers] Re: Fw: Glyph3D questions

John Platt jcplatt at lineone.net
Tue Aug 30 18:36:53 EDT 2005


Hi Roger,

In 4.4, the trick is to use point scalars with 2 components. The 1st
component can be used for scaling and the 2nd component passed on to the
glyph mapper for colour mapping. You must use
vtkGlyph3D::SetColorModeToColorByScalar() to copy the input scalars to
the output.

In your glyph mapper, colour by component 1 -

	ScalarVisibilityOn();
      ColorByArrayComponent( "myscalarname", 1 );

HTH

John.

-----Original Message-----
From: vtkusers-bounces+jcplatt=lineone.net at vtk.org
[mailto:vtkusers-bounces+jcplatt=lineone.net at vtk.org] On Behalf Of Roger
Blum
Sent: 30 August 2005 21:10
To: vtkusers at public.kitware.com
Subject: [vtkusers] Re: Fw: Glyph3D questions

Hi John,

As I am working on a protoype right now with a very tight time and
money budget, I can not change the vtk version right now. I will
find a way to display the glyphs with one actor per color and type.
This will work in a short time and will show the customer what he
wants to see.
But I will have to upgrade for the real application. I then might
contact
you again for additional information.

Thanks again,
Roger

"John Biddiscombe" <biddisco at cscs.ch> schrieb im Newsbeitrag 
news:43146065.9020307 at cscs.ch...
> Roger,
>
> I think you may not be able to do what you want with earlier versions
of 
> glyph3D. I can't remember when (a couple of months back?), but I added

> some code to make different scalars used for different
colouring/scaling. 
> Indexing should be ok (look harder it is possible I'm sure). I've not 
> looed at the code for old versions today so I realy can't remember. If
you 
> can update to a new vtk version (cvs) then give it a try. If you have
a 
> lot of homemade filters, probably you've got some work to do, but if
not, 
> then the pain shouldn't be too much.
>
> JB
>
>
> Roger Blum wrote:
>
>>
>> ----- Original Message ----- From: "Roger Blum"
<rogerblum at hawaii.rr.com>
>> To: "John Biddiscombe" <biddisco at cscs.ch>
>> Sent: Monday, August 29, 2005 3:50 PM
>> Subject: Re: [vtkusers] Glyph3D questions
>>
>>
>>> Hello John,
>>>
>>> Thanks for your answer.
>>> I have been trying to make it work, but had no succes till now.
>>> I haven't mentioned in my posting that I use vtk 4.4.2 and script it

>>> with Tcl.
>>>
>>> After searching all of the examples I still cannot figure out, how
to 
>>> supply
>>> the extra information (a color index, a type index and a direction)
to 
>>> the
>>> vtkGlyph3D object.
>>> The method you supposed "SetInputArrayToProcess" doesn't seem to
>>> exist (in this version of vtk?).
>>> So how does vtkGlyph3D know which type of glyph and color to assign
>>> to a node? How do I have to construct the input for vtkGlyph3D?
>>>
>>> I've also checked the source code vtkGlyph3D.cxx and it seems to
only
>>> use one scalar value for the scaling, indexing and color selection.
Is 
>>> this
>>> correct? If yes, I wouldn't be able to do what I want then. I would
have
>>> to create one Glyph3D per type or per color.
>>>
>>> Thanks again for your help,
>>> Roger
>>>
>>> ----- Original Message ----- From: "John Biddiscombe"
<biddisco at cscs.ch>
>>> To: "Roger Blum" <roger_blum at swissonline.ch>
>>> Cc: <vtkusers at public.kitware.com>
>>> Sent: Thursday, August 25, 2005 9:23 PM
>>> Subject: Re: [vtkusers] Glyph3D questions
>>>
>>>
>>>> Using vtk from recent CVS (glyph3D has changed a lot since vtk4.4),
to 
>>>> display a different object for each type, with a differnet colour,
I 
>>>> use this snippet. In this case data scaling is off, but if you
wanted 
>>>> to do scaling too then you can add another SetInputArrayToProcess
call. 
>>>> Likewise for orientation. If you can't get orientation working,
then 
>>>> ask me again and I'll have another look inside the glyph3D code, I
cant 
>>>> remember if orientation can be specified separately from other
scalars 
>>>> etc.
>>>>
>>>>    NodeGlyphs->SetInput(NodeData);
>>>>    NodeGlyphs->SetColorModeToColorByScalar();
>>>>    NodeGlyphs->SetScaleModeToDataScalingOff();
>>>>    NodeGlyphs->SetScaleFactor(0.25);
>>>>    NodeGlyphs->SetScaling(1);
>>>>    NodeGlyphs->SetIndexModeToScalar();
>>>>
>>>>
NodeGlyphs->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATIO
N_POINTS, 
>>>> "nodeTypes");
>>>>
>>>>
NodeGlyphs->SetInputArrayToProcess(3,0,0,vtkDataObject::FIELD_ASSOCIATIO
N_POINTS, 
>>>> "nodeColours");
>>>>
>>>>    for (int i=0; i<this->NumGlyphObjects; ++i) {
>>>>      NodeGlyphs->SetSource(i, this->GlyphObjects[i]);
>>>>    }
>>>>    NodeGlyphs->SetRange(0,NODET_MAX);
>>>>    NodeGlyphs->Update();
>>>>
>>>> In the above code, we assume that there is an array called
"nodeTypes" 
>>>> and another "nodeColours" which is present on the pointdata of the 
>>>> NodeData object.
>>>>
>>>> JB
>>>>
>>>>
>>>> Roger Blum wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I have checked the manual, examples and news list but couldn't
find 
>>>>> the
>>>>> solution to my problem.
>>>>>
>>>>> I would like to use a vthGlyph3D filter to display my data.
>>>>> For each glyph I have
>>>>> - a point (X,Y,Z)
>>>>> - a direction (X,Y,Z)
>>>>> - a color code (1,...,n)
>>>>> - a type code (1,...,n)
>>>>>
>>>>> With this information I would like to show the glyphs (type
depending 
>>>>> on type code)
>>>>> with a specific color (depending on color code) at a position
(point) 
>>>>> with a direction
>>>>> at a fixed size (not influenced by zooming).
>>>>>
>>>>> How do I have to set up and connect the needed objects so my 
>>>>> vtkGlyph3D object
>>>>> generates the desired output?
>>>>>
>>>>> Thanks for your help,
>>>>> Roger
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> This is the private VTK discussion list. Please keep messages 
>>>>> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>
>>>>
>>>>
>>>> -- 
>>>> John Biddiscombe,                            email:biddisco @
cscs.ch
>>>> http://www.cscs.ch/about/BJohn.php
>>>> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91)
610.82.07
>>>> Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91)
610.82.82
>>>>
>>>>
>>>> _______________________________________________
>>>> This is the private VTK discussion list. Please keep messages
on-topic. 
>>>> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>> _______________________________________________
>> This is the private VTK discussion list. Please keep messages
on-topic. 
>> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> -- 
> John Biddiscombe,                            email:biddisco @ cscs.ch
> http://www.cscs.ch/about/BJohn.php
> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
> Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82
>
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages
on-topic. 
> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 



_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list