23 #include <vtkAssembly.h> 24 #include <vtkFollower.h> 25 #include <vtkProp3DCollection.h> 26 #include <vtkPropAssembly.h> 27 #include <vtkRenderer.h> 30 #include <vtkPolyDataMapper.h> 31 #include <vtkProperty.h> 104 mitk::Mesh::DataType::Pointer itkMesh = input->GetMesh(this->
GetTimestep());
106 if (itkMesh.GetPointer() ==
nullptr)
112 mitk::Mesh::PointsContainer::Iterator i;
116 float floatRgba[4] = {1.0f, 1.0f, 1.0f, 1.0f};
117 double doubleRgba[4] = {1.0f, 1.0f, 1.0f, 1.0f};
123 if (dynamic_cast<mitk::ColorProperty *>(this->
GetDataNode()->GetProperty(
"unselectedcolor")) !=
nullptr)
126 floatRgba[0] = tmpColor[0];
127 floatRgba[1] = tmpColor[1];
128 floatRgba[2] = tmpColor[2];
130 doubleRgba[0] = floatRgba[0];
131 doubleRgba[1] = floatRgba[1];
132 doubleRgba[2] = floatRgba[2];
133 doubleRgba[3] = floatRgba[3];
136 if (itkMesh->GetNumberOfPoints() > 0)
139 float pointSize = 2.0;
142 if (pointSizeProp.IsNotNull())
143 pointSize = pointSizeProp->GetValue();
145 for (j = 0, i = itkMesh->GetPoints()->Begin(); i != itkMesh->GetPoints()->End(); i++, j++)
147 vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
149 sphere->SetRadius(pointSize);
150 sphere->SetCenter(i.Value()[0], i.Value()[1], i.Value()[2]);
152 m_Spheres->AddInputConnection(sphere->GetOutputPort());
162 if (itkMesh->GetNumberOfCells() > 0)
166 itkExceptionMacro(<<
"MeshVtkMapper3D currently not working for MS Visual C++ 6.0, because MeshUtils are " 167 "currently not supported.");
177 bool wireframe =
true;
199 bool makeContour =
false;
211 bool showPoints =
true;
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
void UpdateVtkTransform(mitk::BaseRenderer *renderer) override
Set the vtkTransform of the m_Prop3D for the current time step of renderer.
~MeshVtkMapper3D() override
L * GetLocalStorage(mitk::BaseRenderer *forRenderer)
Retrieves a LocalStorage for a specific BaseRenderer.
void ResetMapper(BaseRenderer *renderer) override
Reset the mapper (i.e., make sure that nothing is displayed) if no valid data is present. In most cases the reimplemented function disables the according actors (toggling visibility off)
Base class for mapper specific rendering ressources.
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
vtkPropAssembly * m_PropAssembly
bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Mapper *mapper, mitk::DataNode *dataNode) const
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
Organizes the rendering process.
vtkActor * m_SpheresActor
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
virtual const mitk::Mesh * GetInput()
The ColorProperty class RGB color property.
vtkActor * m_ContourActor
vtkPolyDataMapper * m_ContourMapper
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
DataStructure which stores a set of points (incl. pointdata) where each point can be associated to an...
static vtkPolyData * MeshToPolyData(MeshType *mesh, bool onlyTriangles=false, bool useScalarAccessor=false, unsigned int pointDataType=0, mitk::BaseGeometry *geometryFrame=nullptr, vtkPolyData *polydata=nullptr)
mitk::DataNode * m_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...
vtkLinearTransform * GetVtkTransform(int t=0) const
Get the transformation applied prior to displaying the data as a vtkTransform.
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
vtkAppendPolyData * m_Spheres
void UpdateGenerateDataTime()
int GetTimestep() const
Returns the current time step as calculated from the renderer.
LocalStorageHandler< BaseLocalStorage > m_LSH
vtkPolyDataMapper * m_SpheresMapper
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.