23 #include <vtkLinearTransform.h>
54 this->DrawContour(it->GetPointer(), renderer);
72 if (!renderingContour)
84 ApplyColorAndOpacityProperties(renderer);
94 double red = colorprop->GetColor().GetRed();
95 double green = colorprop->GetColor().GetGreen();
96 double blue = colorprop->GetColor().GetBlue();
97 glColor4f(red, green, blue, opacity);
114 float lineWidth = 3.0;
118 bool isHovering =
false;
126 bool showSegments =
false;
129 bool showControlPoints =
false;
130 dataNode->
GetBoolProperty(
"contour.controlpoints.show", showControlPoints);
132 bool showPoints =
false;
135 bool showPointsNumbers =
false;
138 bool showControlPointsNumbers =
false;
139 dataNode->
GetBoolProperty(
"contour.controlpoints.text", showControlPointsNumbers);
141 bool projectmode =
false;
142 dataNode->
GetVisibility(projectmode, renderer,
"contour.project-onto-plane");
153 while (pointsIt != renderingContour->
IteratorEnd(timestep))
157 point = (*pointsIt)->Coordinates;
160 transform->TransformPoint(vtkp, vtkp);
172 else if (scalardiff < maxDiff)
187 if (!(pointsIt == renderingContour->
IteratorBegin(timestep)))
189 glLineWidth(lineWidth);
191 glVertex2f(pt2d[0], pt2d[1]);
192 glVertex2f(lastPt2d[0], lastPt2d[1]);
198 if (showControlPoints)
201 if ((*pointsIt)->IsControlPoint)
211 glColor3f(selectedcolor->GetColor().GetRed(),
212 selectedcolor->GetColor().GetBlue(),
213 selectedcolor->GetColor().GetGreen());
216 glBegin(GL_LINE_LOOP);
218 glVertex2dv(&tmp[0]);
220 glVertex2dv(&tmp[0]);
222 glVertex2dv(&tmp[0]);
224 glVertex2dv(&tmp[0]);
229 colorprop->GetColor().GetRed(), colorprop->GetColor().GetGreen(), colorprop->GetColor().GetBlue());
233 glVertex2dv(&tmp[0]);
248 glColor3f(0.0, 0.0, 0.0);
251 glBegin(GL_LINE_LOOP);
253 glVertex2dv(&tmp[0]);
255 glVertex2dv(&tmp[0]);
257 glVertex2dv(&tmp[0]);
259 glVertex2dv(&tmp[0]);
263 glColor3f(colorprop->GetColor().GetRed(), colorprop->GetColor().GetGreen(), colorprop->GetColor().GetBlue());
267 glVertex2dv(&tmp[0]);
271 if (showPointsNumbers)
274 std::stringstream ss;
283 WriteTextWithOverlay(m_PointNumbersOverlay, l.c_str(), rgb, pt2d, renderer);
286 if (showControlPointsNumbers && (*pointsIt)->IsControlPoint)
289 std::stringstream ss;
298 WriteTextWithOverlay(m_ControlPointNumbersOverlay, l.c_str(), rgb, pt2d, renderer);
308 if (renderingContour->
IsClosed(timestep) && drawit && showSegments)
313 transform->TransformPoint(vtkp, vtkp);
317 glLineWidth(lineWidth);
319 glVertex2f(lastPt2d[0], lastPt2d[1]);
320 glVertex2f(pt2d[0], pt2d[1]);
332 transform->TransformPoint(vtkp, vtkp);
341 if (scalardiff < maxDiff)
345 glColor3f(0.0, 1.0, 0.0);
348 glBegin(GL_LINE_LOOP);
350 tmp[0] = pt2d[0] - pointsize;
351 tmp[1] = pt2d[1] + pointsize;
352 glVertex2dv(&tmp[0]);
353 tmp[0] = pt2d[0] + pointsize;
354 tmp[1] = pt2d[1] + pointsize;
355 glVertex2dv(&tmp[0]);
356 tmp[0] = pt2d[0] + pointsize;
357 tmp[1] = pt2d[1] - pointsize;
358 glVertex2dv(&tmp[0]);
359 tmp[0] = pt2d[0] - pointsize;
360 tmp[1] = pt2d[1] - pointsize;
361 glVertex2dv(&tmp[0]);
388 Superclass::SetDefaultProperties(node, renderer, overwrite);
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
Base class for mapper specific rendering ressources.
virtual void UpdateOutputInformation() override
Update the OutputInformation of a ContourModel object.
mitk::Point3D Coordinates
Coordinates in 3D space.
ContourModelSetGLMapper2D()
Organizes the rendering process.
virtual ScalarType SignedDistance(const Point3D &pt3d_mm) const
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
mitk::ContourElement::VertexIterator VertexIterator
virtual const PlaneGeometry * GetCurrentWorldPlaneGeometry()
Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering.
virtual ContourModelSetIterator Begin()
Return an iterator a the front.
virtual ContourModelSetIterator End()
Return an iterator a the front.
virtual ~ContourModelSetGLMapper2D()
VertexIterator IteratorBegin(int timestep=0) const
Returns a const VertexIterator at the start element of the contour.
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
virtual int GetSize() const
Returns the number of contained contours.
ContourModelListType::iterator ContourModelSetIterator
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=NULL, bool overwrite=false)
The ColorProperty class RGB color property.
VertexType * GetSelectedVertex()
Get the current selected vertex.
void WorldToDisplay(const Point3D &worldIndex, Point2D &displayPoint) const
This method converts a 3D world index to the display point using the geometry of the renderWindow...
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 bool IsEmptyTimeStep(unsigned int t) const override
Check if there isn't something at this timestep.
bool GetFloatProperty(const char *propertyKey, float &floatValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for float properties (instances of FloatProperty)
void InternalDrawContour(mitk::ContourModel *contour, mitk::BaseRenderer *renderer) override
void vtk2itk(const Tin &in, Tout &out)
vtkLinearTransform * GetVtkTransform(int t=0) const
Get the transformation applied prior to displaying the data as a vtkTransform.
virtual unsigned int GetTimeStep() const
void itk2vtk(const Tin &in, Tout &out)
void UpdateGenerateDataTime()
bool IsClosed(int timestep=0) const
Return if the contour is closed or not.
virtual void Paint(BaseRenderer *renderer) override
VertexIterator IteratorEnd(int timestep=0) const
Returns a const VertexIterator at the end element of the contour.
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...
Class for nodes of the DataTree.
virtual const VertexType * GetVertexAt(int index, int timestep=0) const
Returns the vertex at the index position within the container.