Commit 3b37e8c4 authored by Mathieu Westphal's avatar Mathieu Westphal

Adding new Uniform Glyphing Mode

This adds two new uniform glyphing modes to the vtkPVGlyphFilter and also generalizes a bit its API.
The two new modes are based on "inverse transform sampling" algorithm, the first one uses surface area, the second one uses cell volume.

The surface one will actually extract the surface first if needed, so the glyphs will be located on the surface mesh only.
The volume one will ignore completely non-3D cells.

Both modes support multiblocks and parallel meshes perfectly, as well as cell centers when using cell data.

Those modes were needed because the current algorithm is only based on the mesh bounds and this have limitations and bad behaviors, especially when dealing with multi pieces mesh.
parent 1abd028c
......@@ -509,6 +509,7 @@ list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/UndoRedo7.xml
${CMAKE_CURRENT_SOURCE_DIR}/UndoRedo8.xml
${CMAKE_CURRENT_SOURCE_DIR}/UnstructuredOutline.xml
${CMAKE_CURRENT_SOURCE_DIR}/UniformInverseTransformSamplingGlyph.xml
${CMAKE_CURRENT_SOURCE_DIR}/VectorComponentHistogram.xml
${CMAKE_CURRENT_SOURCE_DIR}/VolumeRenderingWithContour.xml
${CMAKE_CURRENT_SOURCE_DIR}/VolumeReprTwoIndepComp.xml
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/can.ex2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mousePress" arguments="1,1,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget" command="setCurrent" arguments="0.0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mouseRelease" arguments="1,0,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mousePress" arguments="1,1,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mouseRelease" arguments="1,0,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="Calculator" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ResultArrayName/ResultArrayName" command="set_string" arguments="point" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Function/Function" command="set_string" arguments="1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Function/Function" command="key" arguments="16777248" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="Calculator" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ResultArrayName/ResultArrayName" command="set_string" arguments="cell" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Function/Function" command="set_string" arguments="1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Function/Function" command="key" arguments="16777248" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/AttributeType/ComboBox" command="activated" arguments="Cell Data" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="Solid Color" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeY" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Opacity/DoubleRangeWidget/Slider" command="set_int" arguments="16" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="activated" arguments="Surface With Edges" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Glyph" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/SearchBox/AdvancedButton" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/comboBox" command="activated" arguments="Sphere" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ScaleArray/ComboBox" command="activated" arguments="No scale array" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/frame/ChosenProxyWidget/Radius/DoubleLineEdit0" command="set_full_precision_text" arguments="0.1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/MaximumNumberOfSamplePoints/LineEdit0" command="set_string" arguments="500" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/GlyphMode/ComboBox" command="activated" arguments="Uniform Spatial Distribution (Surface Sampling)" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Baseline/UniformInverseTransformSamplingGlyph_A.png" threshold="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/GlyphMode/ComboBox" command="activated" arguments="Uniform Spatial Distribution (Volume Sampling)" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Baseline/UniformInverseTransformSamplingGlyph_B.png" threshold="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/GlyphMode/ComboBox" command="activated" arguments="Uniform Spatial Distribution (Surface Sampling)" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ScaleArray/ComboBox" command="activated" arguments="cell" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="Solid Color" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Baseline/UniformInverseTransformSamplingGlyph_C.png" threshold="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/GlyphMode/ComboBox" command="activated" arguments="Uniform Spatial Distribution (Volume Sampling)" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
</pqevents>
# Glyph filter new uniform inverse transform sampling mode
This adds two new uniform glyphing modes to the vtkPVGlyphFilter.
The two new modes are based on "inverse transform sampling" algorithm, the first one uses surface area, the second one uses cell volume.
The surface one will actually extract the surface first if needed, so the glyphs will be located on the surface mesh only.
The volume one will ignore completely non-3D cells.
Both modes support multiblocks and parallel meshes perfectly, as well as cell centers when using cell data.
......@@ -7797,7 +7797,9 @@ source.</Documentation>
<EnumerationDomain name="enum">
<Entry text="All Points" value="0"/>
<Entry text="Every Nth Point" value="1"/>
<Entry text="Uniform Spatial Distribution" value="2"/>
<Entry text="Uniform Spatial Distribution (Bounds Based)" value="2"/>
<Entry text="Uniform Spatial Distribution (Surface Sampling)" value="3"/>
<Entry text="Uniform Spatial Distribution (Volume Sampling)" value="4"/>
</EnumerationDomain>
<Documentation>
This property indicates the mode that will be used to generate
......@@ -7814,11 +7816,14 @@ This property specifies the maximum number of sample points to use
when sampling the space when Uniform Spatial Distribution is used.
</Documentation>
<Hints>
<PropertyWidgetDecorator type="GenericDecorator"
mode="visibility"
property="GlyphMode"
value="2" />
<!-- show this widget when GlyphMode==2 -->
<PropertyWidgetDecorator type="CompositeDecorator">
<Expression type="or">
<PropertyWidgetDecorator type="GenericDecorator" mode="visibility" property="GlyphMode" value="2" inverse="0" />
<PropertyWidgetDecorator type="GenericDecorator" mode="visibility" property="GlyphMode" value="3" inverse="0" />
<PropertyWidgetDecorator type="GenericDecorator" mode="visibility" property="GlyphMode" value="4" inverse="0" />
</Expression>
</PropertyWidgetDecorator>
<!-- show this widget when GlyphMode==2||3||4 -->
</Hints>
</IntVectorProperty>
<IntVectorProperty command="SetSeed"
......@@ -7832,11 +7837,14 @@ uniform distribution of glyph points when a Uniform Spatial
Distribution is used.
</Documentation>
<Hints>
<PropertyWidgetDecorator type="GenericDecorator"
mode="visibility"
property="GlyphMode"
value="2" />
<!-- show this widget when GlyphMode==2 -->
<PropertyWidgetDecorator type="CompositeDecorator">
<Expression type="or">
<PropertyWidgetDecorator type="GenericDecorator" mode="visibility" property="GlyphMode" value="2" inverse="0" />
<PropertyWidgetDecorator type="GenericDecorator" mode="visibility" property="GlyphMode" value="3" inverse="0" />
<PropertyWidgetDecorator type="GenericDecorator" mode="visibility" property="GlyphMode" value="4" inverse="0" />
</Expression>
</PropertyWidgetDecorator>
<!-- show this widget when GlyphMode==2||3||4 -->
</Hints>
</IntVectorProperty>
<IntVectorProperty command="SetStride"
......
......@@ -32,9 +32,28 @@
* distribution of points are glyphed. \c Seed controls the seed point for the random
* number generator (vtkMinimalStandardRandomSequence). \c MaximumNumberOfSamplePoints
* can be used to limit the number of sample points used for random sampling. This
* doesn't not equal the number of points actually glyphed, since that depends on
* does not equal the number of points actually glyphed, since that depends on
* several factors. In parallel, this filter ensures that spatial bounds are collected
* across all ranks for generating identical sample points.
*
* \li SPATIALLY_UNIFORM_INVERSE_TRANSFORM_SAMPLING_SURFACE: points randomly sampled
* via an inverse transform on surface area of each cell. When used with a volume dataset,
* the surface mesh is extracted and used for the sampling.
* \c Seed controls the seed point for the random number generator.
* \c MaximumNumberOfSamplePoints limits the number of sample points used for random sampling.
* The number of glyphs produced can be smaller since the sampling depends on several factors.
* In parallel and with composite dataset, this filter ensures that each piece
* samples only a representative number of points.
* Note that the mesh will be triangulated first.
*
* \li SPATIALLY_UNIFORM_INVERSE_TRANSFORM_SAMPLING_VOLUME: points randomly sampled
* via an inverse transform on the volume of each cell. Only 3D cells will be considered.
* \c Seed controls the seed point for the random number generator.
* \c MaximumNumberOfSamplePoints limits the number of sample points used for random sampling.
* The number of glyphs produced can be smaller since the sampling depends on several factors.
* In parallel and with composite dataset, this filter ensures that each piece
* samples only a representative number of points.
* Note that the grid will be tetrahedralized first.
*/
#ifndef vtkPVGlyphFilter_h
......@@ -59,7 +78,9 @@ public:
{
ALL_POINTS,
EVERY_NTH_POINT,
SPATIALLY_UNIFORM_DISTRIBUTION
SPATIALLY_UNIFORM_DISTRIBUTION,
SPATIALLY_UNIFORM_INVERSE_TRANSFORM_SAMPLING_SURFACE,
SPATIALLY_UNIFORM_INVERSE_TRANSFORM_SAMPLING_VOLUME
};
vtkTypeMacro(vtkPVGlyphFilter, vtkPolyDataAlgorithm);
......@@ -135,7 +156,7 @@ public:
/**
* Set/Get the mode at which glyphs will be generated.
*/
vtkSetClampMacro(GlyphMode, int, ALL_POINTS, SPATIALLY_UNIFORM_DISTRIBUTION);
vtkSetClampMacro(GlyphMode, int, ALL_POINTS, SPATIALLY_UNIFORM_INVERSE_TRANSFORM_SAMPLING_VOLUME);
vtkGetMacro(GlyphMode, int);
//@}
......@@ -159,13 +180,12 @@ public:
//@{
/**
* Set/Get maximum number of sample points to use to sample the space when
* GlyphMode is set to SPATIALLY_UNIFORM_DISTRIBUTION.
* GlyphMode is set to SPATIALLY_UNIFORM_*.
*/
vtkSetClampMacro(MaximumNumberOfSamplePoints, int, 1, VTK_INT_MAX);
vtkGetMacro(MaximumNumberOfSamplePoints, int);
//@}
//@{
/**
* Overridden to create output data of appropriate type.
*/
......@@ -174,7 +194,6 @@ public:
protected:
vtkPVGlyphFilter();
~vtkPVGlyphFilter() override;
//@}
// Standard Pipeline methods
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
......@@ -185,8 +204,10 @@ protected:
/**
* Returns 1 if point is to be glyphed, otherwise returns 0.
* \c index is the flat index of the dataset when using composite dataset.
* \c cellCenters is a flag to know if cellCenters are currently used
*/
virtual int IsPointVisible(vtkDataSet* ds, vtkIdType ptId);
virtual int IsPointVisible(unsigned int index, vtkDataSet* ds, vtkIdType ptId, bool cellCenters);
/**
* Returns true if input Scalars and Vectors are compatible, otherwise returns 0.
......@@ -213,23 +234,18 @@ protected:
*/
bool NeedsVectors();
/**
* Method called in RequestData() to do the actual data processing. This will
* apply a Cell Centers before the Glyph. The \c input, filling up the \c output
* based on the filter parameters.
*/
virtual bool ExecuteWithCellCenters(
vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
//@{
/**
* Method called in RequestData() to do the actual data processing. This will
* glyph the \c input, filling up the \c output based on the filter
* parameters.
* parameters. \c index is the flat index of the dataset when using composite dataset.
* This will use vtkCellCenters if UseCellCenters returns true.
*/
virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
vtkDataArray* inSScalars, vtkDataArray* inVectors);
virtual bool Execute(
unsigned int index, vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
virtual bool Execute(unsigned int index, vtkDataSet* input, vtkInformationVector* sourceVector,
vtkPolyData* output, vtkDataArray* inSScalars, vtkDataArray* inVectors,
bool cellCenters = false);
//@}
int VectorScaleMode;
......
7938229b90249e7fd38fecf2cc9dad164cc13e850a6c03f2a241e08e4ff5d599ca1f516a13766c69b0c72834975c0940dd37339d084ca089a94518d4ba0b943e
b4a8b88a03384270e94701aa8004cf71fdaace75465d8f585b58e907fe482539582b0cc47b0f543cea6180aeddf40be35e2773c0c44010db361d6f9cd7524e61
48f39890a7a0e282c713a920161c06f05c91b6d842144b1f78df9d357844a05819ffbaa9d987b4721d9c30e598cb9701cb62c661f005f8ee61aad1e17d4f0b77
c18b622f7b69ec497e208e54dc5dba7917995c06771cc8e80a1e2b0883022a35aded32c69b27bc3829e38bdbbda7512ac9c382a653438d540e8b7f500289f082
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment