1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkFlyingEdgesPlaneCutter.h 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 /** 16 * @class vtkFlyingEdgesPlaneCutter 17 * @brief cut a volume with a plane and generate a 18 * polygonal cut surface 19 * 20 * vtkFlyingEdgesPlaneCutter is a specialization of the FlyingEdges algorithm 21 * to cut a volume with a single plane. It is designed for performance and 22 * an exploratory, fast workflow. 23 * 24 * This algorithm is not only fast because it uses flying edges, but also 25 * because it plays some "tricks" during processing. For example, rather 26 * than evaluate the cut (plane) function on all volume points like vtkCutter 27 * and its ilk do, this algorithm intersects the volume x-edges against the 28 * plane to (potentially) generate the single intersection point. It then 29 * quickly classifies the voxel edges as above, below, or straddling the cut 30 * plane. Thus the number of plane evaluations is greatly reduced. 31 * 32 * For more information see vtkFlyingEdges3D and/or the paper "Flying Edges: 33 * A High-Performance Scalable Isocontouring Algorithm" by Schroeder, 34 * Maynard, Geveci. Proc. of LDAV 2015. Chicago, IL. 35 * 36 * @warning 37 * This filter is specialized to 3D volumes. This implementation can produce 38 * degenerate triangles (i.e., zero-area triangles). 39 * 40 * @warning 41 * This class has been threaded with vtkSMPTools. Using TBB or other 42 * non-sequential type (set in the CMake variable 43 * VTK_SMP_IMPLEMENTATION_TYPE) may improve performance significantly. 44 * 45 * @sa 46 * vtkFlyingEdges2D vtkFlyingEdges3D 47 */ 48 49 #ifndef vtkFlyingEdgesPlaneCutter_h 50 #define vtkFlyingEdgesPlaneCutter_h 51 52 #include "vtkFiltersCoreModule.h" // For export macro 53 #include "vtkPolyDataAlgorithm.h" 54 55 class vtkImageData; 56 class vtkPlane; 57 58 class VTKFILTERSCORE_EXPORT vtkFlyingEdgesPlaneCutter : public vtkPolyDataAlgorithm 59 { 60 public: 61 //@{ 62 /** 63 * Standard construction and print methods. 64 */ 65 static vtkFlyingEdgesPlaneCutter *New(); 66 vtkTypeMacro(vtkFlyingEdgesPlaneCutter,vtkPolyDataAlgorithm); 67 void PrintSelf(ostream& os, vtkIndent indent) override; 68 //@} 69 70 /** 71 * The modified time depends on the delegated cut plane. 72 */ 73 vtkMTimeType GetMTime() override; 74 75 //@{ 76 /** 77 * Specify the plane (an implicit function) to perform the cutting. The 78 * definition of the plane (its origin and normal) is controlled via this 79 * instance of vtkPlane. 80 */ 81 virtual void SetPlane(vtkPlane*); 82 vtkGetObjectMacro(Plane,vtkPlane); 83 //@} 84 85 //@{ 86 /** 87 * Set/Get the computation of normals. The normal generated is simply the 88 * cut plane normal. By default this is disabled. 89 */ 90 vtkSetMacro(ComputeNormals,vtkTypeBool); 91 vtkGetMacro(ComputeNormals,vtkTypeBool); 92 vtkBooleanMacro(ComputeNormals,vtkTypeBool); 93 //@} 94 95 //@{ 96 /** 97 * Indicate whether to interpolate other attribute data besides the input 98 * scalars (which are required). That is, as the isosurface is generated, 99 * interpolate all other point attribute data across intersected edges. 100 */ 101 vtkSetMacro(InterpolateAttributes,vtkTypeBool); 102 vtkGetMacro(InterpolateAttributes,vtkTypeBool); 103 vtkBooleanMacro(InterpolateAttributes,vtkTypeBool); 104 //@} 105 106 //@{ 107 /** 108 * Set/get which component of the scalar array to contour on; defaults to 0. 109 */ 110 vtkSetMacro(ArrayComponent, int); 111 vtkGetMacro(ArrayComponent, int); 112 //@} 113 114 protected: 115 vtkFlyingEdgesPlaneCutter(); 116 ~vtkFlyingEdgesPlaneCutter() override; 117 118 vtkPlane *Plane; 119 vtkTypeBool ComputeNormals; 120 vtkTypeBool InterpolateAttributes; 121 int ArrayComponent; 122 123 int RequestData(vtkInformation *, vtkInformationVector **, 124 vtkInformationVector *) override; 125 int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, 126 vtkInformationVector *) override; 127 int FillInputPortInformation(int port, vtkInformation *info) override; 128 129 private: 130 vtkFlyingEdgesPlaneCutter(const vtkFlyingEdgesPlaneCutter&) = delete; 131 void operator=(const vtkFlyingEdgesPlaneCutter&) = delete; 132 }; 133 134 #endif 135