[Paraview] Glyph scaling and orienting/programmable filter?

Jean Favre jfavre at cscs.ch
Tue Mar 3 11:41:54 EST 2009


 Pawel Krupinski wrote:
> *So I was thinking:  I need to scale spheres anisotropically to get
> ellipsoids so I really need to do it by scaling with vector components
> of the scales/axes_length vector.
> *
**
**What you describe seems to be exactly what the vtkTensorGlyph does.
See details here
http://www.vtk.org/doc/nightly/html/classvtkTensorGlyph.html

Tensor Glyphing is not in ParaView yet. But a ctest exist (if Python is
enabled)

 ./VTK/Graphics/Testing/Python/TenEllip.py

You can add Tensor Glyph yourself with a pluggin. Here are the XML
necessary. The CMakelists.txt is this:
############
/cmake_minimum_required(VERSION 2.6)
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})

ADD_PARAVIEW_PLUGIN(ExtraSMPlugin "1.0"
                    SERVER_MANAGER_XML extras_Server.xml
                    )

ADD_PARAVIEW_PLUGIN(ExtraGUIPlugin "1.0"
                    GUI_RESOURCES extras.qrc )/
#############

The file extras.qrc is this:

############
<RCC>
  <qresource prefix="/ParaViewResources" >
    <file>extras.xml</file>
  </qresource>
</RCC>
############

There is a complication. The data fields created by vtkTensorGlyph (and
vtkPointLoad) are not named. ParaView will not color them. You need to
add two lines of code in vtkTensorGlyph.cxx and vtkPointLoad.cxx
immediately after the declaration of
newNormals = vtkFloatArray::New();
newScalars = vtkFloatArray::New();
newTensors = vtkFloatArray::New();

newScalars->SetName("Scalars");
newNormals->SetName("Normals");
newTensors->SetName("Tensors");

hope it fits the bill. Caveat Emptor.

Jean --
Swiss National Supercomputing Center

------------------------------------------------------------------------

<ServerManagerConfiguration>
  <ProxyGroup name="sources">
   <SourceProxy name="Point Load" class="vtkPointLoad">
     <DoubleVectorProperty
        name="LoadValue"
        command="SetLoadValue"
        default_values="100"
        number_of_elements="1">
     </DoubleVectorProperty>
      <IntVectorProperty
        name="ComputeEffectiveStress"
        command="SetComputeEffectiveStress"
        number_of_elements="1"
        default_values="1" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <IntVectorProperty
         name="ModelBounds"
         command="SetModelBounds"
         number_of_elements="6"
         default_values="-10 10 -10 10 -10 10" >
      </IntVectorProperty>
      <IntVectorProperty
         name="SampleDimensions"
         command="SetSampleDimensions"
         number_of_elements="3"
         default_values="6 6 6" >
      </IntVectorProperty>
   </SourceProxy>
</ProxyGroup> 


<ProxyGroup name="filters">
   <SourceProxy name="Tensor Glyph" class="vtkTensorGlyph">
   <InputProperty
        name="Input"
        command="SetInputConnection">
           <ProxyGroupDomain name="groups">
             <Group name="sources"/>
             <Group name="filters"/>
           </ProxyGroupDomain>
           <DataTypeDomain name="input_type">
             <DataType value="vtkDataSet"/>
           </DataTypeDomain>
           <InputArrayDomain name="input_array1" attribute_type="point"
                             number_of_components="1" optional="1"/>
           <InputArrayDomain name="input_array2" attribute_type="point"
                             number_of_components="9" optional="1"/>
           <Documentation>
             This property specifies the input to the filter.
           </Documentation>
      </InputProperty>

      <StringVectorProperty 
          name="SelectInputScalars" 
          command="SetInputArrayToProcess"
          number_of_elements="5"
          element_types="0 0 0 0 2"
          label="Scalars">
        <ArrayListDomain name="array_list" attribute_type="Scalars" 
                         input_domain_name="input_array1">
          <RequiredProperties>
            <Property name="Input" function="Input"/>
          </RequiredProperties>
        </ArrayListDomain>
        <Documentation>
          This property indicates the name of the scalar array
        </Documentation>
      </StringVectorProperty>
      <StringVectorProperty 
          name="SelectInputTensors" 
          command="SetInputArrayToProcess"
          number_of_elements="5"
          element_types="0 0 0 0 2"
          label="Tensors">
        <ArrayListDomain name="array_list" attribute_type="Tensors" 
                         input_domain_name="input_array2">
          <RequiredProperties>
            <Property name="Input" function="Input"/>
          </RequiredProperties>
        </ArrayListDomain>
        <Documentation>
          This property indicates the name of the tensor array
        </Documentation>
      </StringVectorProperty>

      <InputProperty
        name="Source"
        command="SetSourceConnection"
        label="Glyph Type">
           <ProxyGroupDomain name="groups">
             <Group name="sources"/>
             <Group name="glyph_sources" />
           </ProxyGroupDomain>
           <DataTypeDomain name="input_type">
             <DataType value="vtkPolyData"/>
           </DataTypeDomain>
           <ProxyListDomain name="proxy_list">
              <Proxy group="sources" name="SphereSource" />
           </ProxyListDomain>
           <Documentation>
             This property determines which type of glyph will be placed at the points in the input dataset.
           </Documentation>
      </InputProperty>
      <IntVectorProperty
        name="ColorGlyphs"
        command="SetColorGlyphs"
        number_of_elements="1"
        default_values="1" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <IntVectorProperty
        name="ColorMode"
        command="SetColorMode"
        number_of_elements="1"
        default_values="1" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <IntVectorProperty
        name="Symmetric"
        command="SetSymmetric"
        number_of_elements="1"
        default_values="0" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <IntVectorProperty
        name="Scaling"
        command="SetScaling"
        number_of_elements="1"
        default_values="1" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <IntVectorProperty
        name="ClampScaling"
        command="SetClampScaling"
        number_of_elements="1"
        default_values="0" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <IntVectorProperty
        name="ExtractEigenvalues"
        command="SetExtractEigenvalues"
        number_of_elements="1"
        default_values="1" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <IntVectorProperty
        name="ThreeGlyphs"
        command="SetThreeGlyphs"
        number_of_elements="1"
        default_values="0" >
        <BooleanDomain name="bool"/>
      </IntVectorProperty>
      <DoubleVectorProperty
        name="ScaleFactor"
        command="SetScaleFactor"
        number_of_elements="1"
        default_values="10">
      </DoubleVectorProperty>
      <DoubleVectorProperty
        name="MaxScaleFactor"
        command="SetMaxScaleFactor"
        number_of_elements="1"
        default_values="100">
      </DoubleVectorProperty>
   </SourceProxy>
  </ProxyGroup>
  
</ServerManagerConfiguration>

------------------------------------------------------------------------

<ParaViewSources>
  <Source name="Point Load" />
  <Filter name="Tensor Glyph" />
</ParaViewSources>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090303/07c07b71/attachment-0001.htm>


More information about the ParaView mailing list