36 #include <boost/filesystem.hpp> 37 #include <boost/lexical_cast.hpp> 38 #define _BACKWARD_BACKWARD_WARNING_H 1 //Cut out the vtk deprecated warning 39 #include <vtkPoints.h> 40 #include <vtkPolyData.h> 41 #include <vtkPolyDataMapper.h> 43 #include <vtkProperty.h> 44 #include <vtkUnsignedCharArray.h> 45 #if VTK_MAJOR_VERSION > 5 46 #include <vtkNamedColors.h> 48 #include <vtkSphereSource.h> 49 #include <vtkGlyph3D.h> 50 #include <vtkGlyph2D.h> 51 #include <vtkCubeAxesActor2D.h> 52 #include <vtkImageData.h> 53 #include <vtkGeometryFilter.h> 54 #include <vtkTubeFilter.h> 55 #include <vtkExtractEdges.h> 56 #include <vtkUnstructuredGrid.h> 58 #include <vtkPolygon.h> 59 #include <vtkIdList.h> 60 #include <vtkFeatureEdges.h> 61 #include "UblasIncludes.hpp" 62 #include "UblasVectorInclude.hpp" 63 #include "Exception.hpp" 64 #include "BaseUnits.hpp" 65 #include "VesselNetworkWriter.hpp" 67 #include "PartActorGenerator.hpp" 70 template<
unsigned DIM>
78 template<
unsigned DIM>
84 template<
unsigned DIM>
89 vtkSmartPointer<vtkPolyData> p_polydata =
mpPart->GetVtk();
94 vtkSmartPointer<vtkPolyDataMapper> p_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
95 #if VTK_MAJOR_VERSION <= 5 96 p_mapper->SetInput(p_polydata);
98 p_mapper->SetInputData(p_polydata);
101 vtkSmartPointer<vtkActor> p_actor = vtkSmartPointer<vtkActor>::New();
104 p_actor->SetMapper(p_mapper);
105 pRenderer->AddActor(p_actor);
111 vtkSmartPointer<vtkSphereSource> p_spheres = vtkSmartPointer<vtkSphereSource>::New();
112 p_spheres->SetRadius(this->mPointSize);
113 p_spheres->SetPhiResolution(16);
114 p_spheres->SetThetaResolution(16);
116 vtkSmartPointer<vtkGlyph3D> p_glyph = vtkSmartPointer<vtkGlyph3D>::New();
117 #if VTK_MAJOR_VERSION <= 5 118 p_glyph->SetInput(p_polydata);
119 p_glyph->SetSource(p_spheres->GetOutput());
121 p_glyph->SetInputData(p_polydata);
122 p_glyph->SetSourceConnection(p_spheres->GetOutputPort());
124 p_glyph->ClampingOff();
125 p_glyph->SetScaleModeToScaleByScalar();
126 p_glyph->SetScaleFactor(1.0);
129 vtkSmartPointer<vtkPolyDataMapper> p_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
130 #if VTK_MAJOR_VERSION <= 5 131 p_mapper->SetInput(p_glyph->GetOutput());
133 p_mapper->SetInputData(p_glyph->GetOutput());
135 p_mapper->ScalarVisibilityOn();
137 vtkSmartPointer<vtkActor> p_actor = vtkSmartPointer<vtkActor>::New();
138 p_actor->SetMapper(p_mapper);
140 pRenderer->AddActor(p_actor);
146 vtkSmartPointer<vtkFeatureEdges> p_edges = vtkSmartPointer<vtkFeatureEdges>::New();
147 #if VTK_MAJOR_VERSION <= 5 148 p_edges->SetInput(p_polydata);
150 p_edges->SetInputData(p_polydata);
152 p_edges->SetFeatureEdges(
false);
153 p_edges->SetBoundaryEdges(
true);
154 p_edges->SetManifoldEdges(
true);
155 p_edges->SetNonManifoldEdges(
false);
157 vtkSmartPointer<vtkTubeFilter> p_voronoi_tubes = vtkSmartPointer<vtkTubeFilter>::New();
158 p_voronoi_tubes->SetInputConnection(p_edges->GetOutputPort());
159 p_voronoi_tubes->SetRadius(this->mEdgeSize);
160 p_voronoi_tubes->SetNumberOfSides(12);
162 vtkSmartPointer<vtkPolyDataMapper> p_voronoi_tube_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
163 p_voronoi_tube_mapper->SetInputConnection(p_voronoi_tubes->GetOutputPort());
165 vtkSmartPointer<vtkActor> p_voronoi_tube_actor = vtkSmartPointer<vtkActor>::New();
166 p_voronoi_tube_actor->SetMapper(p_voronoi_tube_mapper);
168 pRenderer->AddActor(p_voronoi_tube_actor);
174 template<
unsigned DIM>
c_vector< double, 3 > mEdgeColor
boost::shared_ptr< Part< DIM > > mpPart
void SetPart(boost::shared_ptr< Part< DIM > > pPart)
c_vector< double, 3 > mPointColor
void AddActor(vtkSmartPointer< vtkRenderer > pRenderer)
c_vector< double, 3 > mVolumeColor