14 #include <vtkCellArray.h> 15 #include <vtkPoints.h> 16 #include <vtkPolyData.h> 17 #include <vtkPolygon.h> 18 #include <vtkSmartPointer.h> 40 if (idx + 1 > this->GetNumberOfInputs())
42 this->SetNumberOfRequiredInputs(idx + 1);
44 if (input != static_cast<InputType *>(this->ProcessObject::GetInput(idx)))
46 this->ProcessObject::SetNthInput(idx, const_cast<InputType *>(input));
53 if (this->GetNumberOfInputs() < 1)
60 if (this->GetNumberOfInputs() < 1)
70 unsigned int numberOfTimeSteps = inputContour->
GetTimeSteps();
71 surface->
Expand(numberOfTimeSteps);
73 for (
unsigned int currentTimeStep = 0; currentTimeStep < numberOfTimeSteps; currentTimeStep++)
78 vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
79 vtkSmartPointer<vtkCellArray> polygons = vtkSmartPointer<vtkCellArray>::New();
80 vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
84 if (inputContour->GetNumberOfVertices(currentTimeStep) <= 2)
86 vtkSmartPointer<vtkPolyData> emptyPolyData = vtkSmartPointer<vtkPolyData>::New();
92 auto current = inputContour->IteratorBegin(currentTimeStep);
94 auto end = inputContour->IteratorEnd(currentTimeStep);
96 vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();
97 polygon->GetPointIds()->SetNumberOfIds(inputContour->GetNumberOfVertices(currentTimeStep));
100 while (current != end)
104 vtkIdType
id = points->InsertNextPoint(
107 polygon->GetPointIds()->SetId(j,
id);
113 lines->InsertNextCell(2);
114 lines->InsertCellPoint(
id - 1);
115 lines->InsertCellPoint(
id);
126 if (inputContour->IsClosed(currentTimeStep))
128 lines->InsertNextCell(2);
129 lines->InsertCellPoint(0);
130 lines->InsertCellPoint((inputContour->GetNumberOfVertices(currentTimeStep) - 1));
133 polygons->InsertNextCell(polygon);
136 vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
138 polyData->SetPoints(points);
139 polyData->SetPolys(polygons);
140 polyData->SetLines(lines);
141 polyData->BuildLinks();
Class for storing surfaces (vtkPolyData).
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
void GenerateData() override
mitk::Point3D Coordinates
Coordinates in 3D space.
~ContourModelToSurfaceFilter() override
const InputType * GetInput(void)
void GenerateOutputInformation() override
virtual void SetVtkPolyData(vtkPolyData *polydata, unsigned int t=0)
virtual void SetInput(const InputType *input)
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry As the base data has not a data vector given by it...
Represents a single vertex of contour.
ContourModelToSurfaceFilter()
void Expand(unsigned int timeSteps=1) override
Expands the TimeGeometry to a number of TimeSteps.