21 #include <vtkAppendPolyData.h> 22 #include <vtkAssembly.h> 23 #pragma GCC diagnostic ignored "-Wstrict-aliasing" 24 #include <vtkCellArray.h> 25 #pragma GCC diagnostic warning "-Wstrict-aliasing" 26 #include <vtkFollower.h> 27 #include <vtkLinearTransform.h> 28 #include <vtkPolyData.h> 29 #include <vtkPolyDataMapper.h> 30 #include <vtkPolygon.h> 31 #include <vtkProp3DCollection.h> 32 #include <vtkProperty.h> 33 #include <vtkRenderer.h> 34 #include <vtkSphereSource.h> 35 #include <vtkTubeFilter.h> 85 bool makeContour =
true;
89 vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
90 vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
92 int numPts = input->GetNumberOfPoints();
96 mitk::Contour::PathType::InputType cstart = path->StartOfInput();
97 mitk::Contour::PathType::InputType cend = path->EndOfInput();
98 mitk::Contour::PathType::InputType cstep = (cend - cstart + 1) / numPts;
99 mitk::Contour::PathType::InputType ccur;
101 vtkIdType ptIndex = 0;
102 vtkIdType lastPointIndex = 0;
112 bool showPoints =
true;
118 for (i = 0, ccur = cstart; i < numPts; ++i, ccur += cstep)
120 itk2vtk(path->Evaluate(ccur), vtkpoint);
121 points->InsertPoint(ptIndex, vtkpoint);
124 vtkIdType cell[2] = {ptIndex - 1, ptIndex};
125 lines->InsertNextCell((vtkIdType)2, cell);
127 lastPointIndex = ptIndex;
132 vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
134 sphere->SetRadius(pointSize);
135 sphere->SetCenter(vtkpoint);
142 if (input->GetClosed())
144 vtkIdType cell[2] = {lastPointIndex, 0};
145 lines->InsertNextCell((vtkIdType)2, cell);
165 double rgba[4] = {0.0f, 1.0f, 0.0f, 0.6f};
166 m_Actor->GetProperty()->SetColor(rgba);
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
bool GetFloatProperty(const char *propertyKey, float &floatValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for float properties (instances of FloatProperty)
Organizes the rendering process.
vtkSmartPointer< vtkPolyDataMapper > m_VtkPolyDataMapper
vtkSmartPointer< vtkActor > m_Actor
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
vtkSmartPointer< vtkAppendPolyData > m_VtkPointList
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
Stores vertices for drawing a contour.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
BoundingBoxType::PointsContainer::Pointer PointsContainerPointer
PathType::Pointer PathPointer
vtkSmartPointer< vtkTubeFilter > m_TubeFilter
void itk2vtk(const Tin &in, Tout &out)
~ContourVtkMapper3D() override
vtkSmartPointer< vtkPolyData > m_Contour
virtual const mitk::Contour * GetInput()
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.