3#include <vtkCleanPolyData.h>
4#include <vtkDataSetSurfaceFilter.h>
5#include <vtkDataSetTriangleFilter.h>
6#include <vtkFeatureEdges.h>
7#include <vtkInformation.h>
8#include <vtkPointData.h>
9#include <vtkUnstructuredGrid.h>
21 this->SetNumberOfInputPorts(1);
22 this->SetNumberOfOutputPorts(1);
26 vtkWarningMacro(
"`TTK RangePolygon' is now deprecated. Please use instead "
27 "`Poly Line Source' followed by `Resample With Dataset'.");
34 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"vtkUnstructuredGrid");
43 info->Set(vtkDataObject::DATA_TYPE_NAME(),
"vtkUnstructuredGrid");
51 vtkInformationVector **inputVector,
52 vtkInformationVector *outputVector) {
54 vtkUnstructuredGrid *input = vtkUnstructuredGrid::GetData(inputVector[0]);
55 vtkUnstructuredGrid *output = vtkUnstructuredGrid::GetData(outputVector);
57 if(input->GetNumberOfCells()) {
59 if(input->GetCell(0)->GetCellDimension() == 0) {
60 processPoints(input, output);
62 processTriangles(input, output);
65 processPoints(input, output);
73int ttkRangePolygon::processPoints(vtkUnstructuredGrid *input,
74 vtkUnstructuredGrid *output) {
79 output->SetPoints(pointSet);
81 output->GetPoints()->ShallowCopy(input->GetPoints());
82 output->GetPointData()->ShallowCopy(input->GetPointData());
87 idList->SetNumberOfIds(2);
89 for(
SimplexId i = 0; i < input->GetNumberOfPoints(); i++) {
91 idList->SetId(0, i - 1);
94 edgeArray->InsertNextCell(idList);
98 idList->SetId(0, input->GetNumberOfPoints() - 1);
100 edgeArray->InsertNextCell(idList);
103 output->SetCells(VTK_LINE, edgeArray);
105 printMsg(std::to_string(output->GetNumberOfCells()) +
" edges extracted", 1,
111int ttkRangePolygon::processTriangles(vtkUnstructuredGrid *input,
112 vtkUnstructuredGrid *output) {
119 surfaceMaker->SetInputData(input);
124 surfaceCleaner->SetInputConnection(surfaceMaker->GetOutputPort());
129 featureEdges->SetBoundaryEdges(
true);
130 featureEdges->SetManifoldEdges(
false);
131 featureEdges->SetFeatureEdges(
false);
132 featureEdges->SetNonManifoldEdges(
false);
133 featureEdges->SetColoring(
false);
134 featureEdges->SetInputConnection(surfaceCleaner->GetOutputPort());
139 triangleMaker->SetInputConnection(featureEdges->GetOutputPort());
140 triangleMaker->Update();
142 output->ShallowCopy(triangleMaker->GetOutput());
144 if(NumberOfIterations > 0) {
155 switch(output->GetPoints()->GetDataType()) {
157 smoother.
smooth<VTK_TT>(triangulation, NumberOfIterations));
160 for(
int i = 0; i < output->GetPointData()->GetNumberOfArrays(); i++) {
161 vtkDataArray *field = output->GetPointData()->GetArray(i);
171 switch(field->GetDataType()) {
173 smoother.
smooth<VTK_TT>(triangulation, NumberOfIterations));
178 printMsg(std::to_string(output->GetNumberOfCells()) +
" edges extracted", 1,
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
ttk::Triangulation * GetTriangulation(vtkDataSet *dataSet)
TTK VTK-filter which produces a valid range polygon for fiber surface extraction.
int FillOutputPortInformation(int port, vtkInformation *info) override
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
~ttkRangePolygon() override
int FillInputPortInformation(int port, vtkInformation *info) override
void setDebugMsgPrefix(const std::string &prefix)
virtual int setDebugLevel(const int &debugLevel)
TTK processing package for scalar field smoothing.
int preconditionTriangulation(AbstractTriangulation *triangulation)
void setDimensionNumber(const int &dimensionNumber)
void setOutputDataPointer(void *data)
int smooth(const triangulationType *triangulation, const int &numberOfIterations) const
void setInputDataPointer(void *data)
Triangulation is a class that provides time and memory efficient traversal methods on triangulations ...
int SimplexId
Identifier type for simplices of any dimension.
vtkStandardNewMacro(ttkRangePolygon)
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)