vtkReebGraphVolumeSkeletonFilter.h 3.59 KB
Newer Older
1 2 3
/*=========================================================================

  Program:   Visualization Toolkit
4
  Module:    vtkReebGraphVolumeSkeletonFilter.h
5 6 7 8 9 10 11 12 13 14

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15 16 17 18 19 20 21 22 23 24
/**
 * @class   vtkReebGraphVolumeSkeletonFilter
 * @brief   compute a skeletal embedding of the
 * Reeb graph of a scalar field defined on a tetrahedral mesh
 * (vtkUnstructuredGrid).
 *
 * The filter takes a vtkUnstructuredGrid as an input (port 0), along with a
 * vtkReebGraph (port 1).
 * The filter samples each arc of the Reeb graph and embeds the samples on the
 * barycenter of the corresponding field contour.
25
 * The number of (evenly distributed) arc samples can be defined with
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
 * SetNumberOfSamples() (default value: 10).
 * The skeleton can be optionally smoothed with SetNumberOfSmoothingIterations()
 * (default value: 10).
 * The filter will first try to pull as a scalar field the vtkDataArray with Id
 * 'FieldId' of the vtkPolyData, see SetFieldId() (default: 0). The filter will
 * abort if this field does not exist.
 *
 * The filter outputs a vtkTable of points (double[3]). Each column contains the
 * samples (sorted by function value) of the corresponding arc. The first and
 * the last entry of the column corresponds to the critical nodes at the
 * extremity of the arc (each column has NumberOfSamples + 2 entries).
 *
 * The skeleton can be rendered by linking the samples with geometrical
 * primitives (for instance, spheres at critical nodes and cylinders between
 * intermediary samples, see Graphics/Testing/Cxx/TestReebGraph.cxx).
 *
*/
43

44 45
#ifndef vtkReebGraphVolumeSkeletonFilter_h
#define vtkReebGraphVolumeSkeletonFilter_h
46

47
#include "vtkFiltersReebGraphModule.h" // For export macro
48
#include  "vtkDataObjectAlgorithm.h"
49 50 51

class vtkReebGraph;
class vtkTable;
52

53
class VTKFILTERSREEBGRAPH_EXPORT vtkReebGraphVolumeSkeletonFilter :
54 55 56 57
  public vtkDataObjectAlgorithm
{
public:
  static vtkReebGraphVolumeSkeletonFilter* New();
58
  vtkTypeMacro(vtkReebGraphVolumeSkeletonFilter,
59
    vtkDataObjectAlgorithm);
60
  void PrintSelf(ostream& os, vtkIndent indent) override;
61

62 63 64 65 66
  //@{
  /**
   * Set the number of samples along each arc of the Reeb graph
   * Default value: 5
   */
67 68
  vtkSetMacro(NumberOfSamples, int);
  vtkGetMacro(NumberOfSamples, int);
69
  //@}
70

71 72 73 74 75
  //@{
  /**
   * Set the number of optional smoothing iterations
   * Default value: 30
   */
76 77
  vtkSetMacro(NumberOfSmoothingIterations, int);
  vtkGetMacro(NumberOfSmoothingIterations, int);
78
  //@}
79

80 81 82 83 84
  //@{
  /**
   * Set the scalar field Id
   * Default value: 0
   */
85 86
  vtkSetMacro(FieldId, vtkIdType);
  vtkGetMacro(FieldId, vtkIdType);
87
  //@}
88 89 90 91 92 93 94 95 96 97

  vtkTable* GetOutput();

protected:
  vtkReebGraphVolumeSkeletonFilter();
  ~vtkReebGraphVolumeSkeletonFilter();

  vtkIdType FieldId;
  int NumberOfSamples, NumberOfSmoothingIterations;

98 99
  int FillInputPortInformation(int portNumber, vtkInformation *) override;
  int FillOutputPortInformation(int portNumber, vtkInformation *info) override;
100 101

  int RequestData(vtkInformation *request,
102
    vtkInformationVector **inputVector, vtkInformationVector *outputVector) override;
103 104

private:
105 106
  vtkReebGraphVolumeSkeletonFilter(const vtkReebGraphVolumeSkeletonFilter&) = delete;
  void operator=(const vtkReebGraphVolumeSkeletonFilter&) = delete;
107 108 109
};

#endif