17 #include <vtkCardinalSpline.h> 18 #include <vtkCellArray.h> 19 #include <vtkPoints.h> 20 #include <vtkPolyData.h> 21 #include <vtkPolyDataMapper.h> 23 #include <vtkPropAssembly.h> 24 #include <vtkPropCollection.h> 25 #include <vtkProperty.h> 26 #include <vtkTubeFilter.h> 108 Superclass::ApplyColorAndOpacityProperties(renderer, actor);
111 double rgba[4] = {1.0f, 1.0f, 1.0f, 1.0f};
117 rgba[0] = temprgba[0];
118 rgba[1] = temprgba[1];
119 rgba[2] = temprgba[2];
120 rgba[3] = temprgba[3];
125 if (dynamic_cast<mitk::IntProperty *>(this->
GetDataNode()->GetProperty(
"line width")) ==
nullptr)
142 return (dynamic_cast<vtkPolyDataMapper *>(
m_SplinesActor->GetMapper()))->GetInput();
152 return vtkActor::New();
162 unsigned int numberOfInputPoints = input->GetSize();
164 if (numberOfInputPoints >= 2)
167 vtkCardinalSpline *splineX = vtkCardinalSpline::New();
168 vtkCardinalSpline *splineY = vtkCardinalSpline::New();
169 vtkCardinalSpline *splineZ = vtkCardinalSpline::New();
170 unsigned int index = 0;
171 mitk::PointSet::DataType::PointsContainer::Pointer pointsContainer = input->GetPointSet()->GetPoints();
172 for (mitk::PointSet::DataType::PointsContainer::Iterator it = pointsContainer->Begin();
173 it != pointsContainer->End();
178 splineX->AddPoint(index, point[0]);
179 splineY->AddPoint(index, point[1]);
180 splineZ->AddPoint(index, point[2]);
182 vtkPoints *points = vtkPoints::New();
183 vtkPolyData *profileData = vtkPolyData::New();
188 for (
unsigned int i = 0; i < numberOfOutputPoints; ++i)
190 t = ((((double)numberOfInputPoints) - 1.0f) / (((
double)numberOfOutputPoints) - 1.0f)) * ((
double)i);
191 points->InsertPoint(i, splineX->Evaluate(t), splineY->Evaluate(t), splineZ->Evaluate(t));
195 vtkCellArray *lines = vtkCellArray::New();
196 lines->InsertNextCell(numberOfOutputPoints);
197 for (
unsigned int i = 0; i < numberOfOutputPoints; ++i)
198 lines->InsertCellPoint(i);
200 profileData->SetPoints(points);
201 profileData->SetLines(lines);
209 vtkPolyDataMapper *profileMapper = vtkPolyDataMapper::New();
210 profileMapper->SetInputData(profileData);
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...
vtkSmartPointer< vtkPropAssembly > m_PointsAssembly
L * GetLocalStorage(mitk::BaseRenderer *forRenderer)
Retrieves a LocalStorage for a specific BaseRenderer.
Base class for mapper specific rendering ressources.
LocalStorageHandler< BaseLocalStorage > m_LSH
unsigned long GetMTime() const override
Get the timestamp of the last change of the map or the last change of one of the properties store in ...
vtkPolyData * GetSplinesPolyData()
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
vtkActor * GetSplinesActor()
~SplineVtkMapper3D() override
vtkPropAssembly * m_SplineAssembly
Organizes the rendering process.
unsigned int m_SplineResolution
virtual const mitk::PointSet * GetInput()
itk::TimeStamp m_SplineUpdateTime
bool SplinesAreAvailable()
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
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.
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.
void ApplyAllProperties(BaseRenderer *renderer, vtkActor *actor) override
mitk::PropertyList * GetPropertyList(const mitk::BaseRenderer *renderer=nullptr) const
Get the PropertyList of the renderer. If renderer is nullptr, the BaseRenderer-independent PropertyLi...
virtual void UpdateSpline()
int GetTimestep() const
Returns the current time step as calculated from the renderer.
bool m_SplinesAddedToAssembly
void UpdateVtkTransform(mitk::BaseRenderer *renderer) override
Set the vtkTransform of the m_Prop3D for the current time step of renderer.
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
vtkActor * m_SplinesActor