14 #include <vtkCellArray.h> 15 #include <vtkPoints.h> 16 #include <vtkProperty.h> 56 if (this->
GetDataNode()->GetFloatProperty(
"contour.3D.width", lineWidth, renderer))
86 const TimeGeometry *dataTimeGeometry = data->GetTimeGeometry();
87 if ((dataTimeGeometry ==
nullptr) || (dataTimeGeometry->
CountTimeSteps() == 0) ||
91 localStorage->
m_Mapper->SetInputData(vtkSmartPointer<vtkPolyData>::New());
96 data->UpdateOutputInformation();
124 vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
126 vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
128 vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
148 vtkIdType p1 = points->InsertNextPoint(currentControlPoint->
Coordinates[0],
151 vtkIdType p2 = points->InsertNextPoint(
154 lines->InsertNextCell(2);
155 lines->InsertCellPoint(p1);
156 lines->InsertCellPoint(p2);
162 if (inputContour->
IsClosed(timestep))
171 vtkIdType p2 = points->InsertNextPoint(
173 vtkIdType p1 = points->InsertNextPoint(
177 lines->InsertNextCell(2);
178 lines->InsertCellPoint(p1);
179 lines->InsertCellPoint(p2);
184 polyData->SetPoints(points);
186 polyData->SetLines(lines);
200 double red = colorprop->GetColor().GetRed();
201 double green = colorprop->GetColor().GetGreen();
202 double blue = colorprop->GetColor().GetBlue();
203 localStorage->
m_Actor->GetProperty()->SetColor(red, green, blue);
216 m_Mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
217 m_Actor = vtkSmartPointer<vtkActor>::New();
218 m_OutlinePolyData = vtkSmartPointer<vtkPolyData>::New();
219 m_TubeFilter = vtkSmartPointer<vtkTubeFilter>::New();
222 m_Actor->SetMapper(m_Mapper);
232 Superclass::SetDefaultProperties(node, renderer, overwrite);
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...
LocalStorage()
Default constructor of the local storage.
L * GetLocalStorage(mitk::BaseRenderer *forRenderer)
Retrieves a LocalStorage for a specific BaseRenderer.
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
virtual TimeStepType CountTimeSteps() const =0
Returns the number of time steps.
mitk::Point3D Coordinates
Coordinates in 3D space.
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 ...
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.
vtkSmartPointer< vtkTubeFilter > m_TubeFilter
virtual const PlaneGeometry * GetCurrentWorldPlaneGeometry()
Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering.
virtual void ApplyContourProperties(mitk::BaseRenderer *renderer)
vtkSmartPointer< vtkPolyDataMapper > m_Mapper
Mapper of a 2D render window.
unsigned long GetMTime() const override
Get the timestamp of the last change of the contents of this node or the referenced BaseData...
void Update(mitk::BaseRenderer *renderer) override
Checks whether this mapper needs to update itself and generate data.
virtual vtkSmartPointer< vtkPolyData > CreateVtkPolyDataFromContour(mitk::ContourModel *inputContour)
~ContourModelMapper3D() override
The ColorProperty class RGB color property.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
void AddProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
Add the property (instance of BaseProperty) if it does not exist (or always ifoverwrite istrue) with ...
virtual unsigned int GetTimeStep() const
LocalStorage * GetLocalStorage(mitk::BaseRenderer *renderer)
Get the LocalStorage corresponding to the current renderer.
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...
VertexIterator IteratorEnd(int timestep=0) const
Returns a const VertexIterator at the end element of the contour.
virtual void CalculateTimeStep(BaseRenderer *renderer)
Updates the time step, which is sometimes needed in subclasses.
bool IsClosed(int timestep=0) const
Return if the contour is closed or not.
mitk::PropertyList * GetPropertyList(const mitk::BaseRenderer *renderer=nullptr) const
Get the PropertyList of the renderer. If renderer is nullptr, the BaseRenderer-independent PropertyLi...
vtkSmartPointer< vtkPolyData > m_OutlinePolyData
const mitk::ContourModel * GetInput(void)
int GetTimestep() const
Returns the current time step as calculated from the renderer.
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
itk::TimeStamp m_LastUpdateTime
Timestamp of last update of stored data.
unsigned long GetCurrentWorldPlaneGeometryUpdateTime()
Get timestamp of last call of SetCurrentWorldPlaneGeometry.
VertexIterator IteratorBegin(int timestep=0) const
Returns a const VertexIterator at the start element of the contour.
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
Set the default properties for general image rendering.
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
Represents a single vertex of contour.
vtkSmartPointer< vtkActor > m_Actor
Actor of a 2D render window.
virtual bool IsValidTimeStep(TimeStepType timeStep) const =0
Test for the given time step if a geometry is availible.
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.
Class for nodes of the DataTree.