diff --git a/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp b/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp index df2fc88426..5342b1c9cd 100644 --- a/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp +++ b/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp @@ -1,396 +1,400 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkContourModelSetGLMapper2D.h" #include "mitkColorProperty.h" #include "mitkContourModelSet.h" #include "mitkPlaneGeometry.h" #include "mitkProperties.h" #include <vtkLinearTransform.h> #include "vtkPen.h" #include "vtkContext2D.h" #include "vtkContextDevice2D.h" #include "vtkOpenGLContextDevice2D.h" #include "mitkManualPlacementAnnotationRenderer.h" #include "mitkBaseRenderer.h" #include "mitkContourModel.h" #include "mitkTextAnnotation2D.h" mitk::ContourModelGLMapper2DBase::ContourModelGLMapper2DBase(): m_Initialized(false) { m_PointNumbersAnnotation = mitk::TextAnnotation2D::New(); m_ControlPointNumbersAnnotation = mitk::TextAnnotation2D::New(); } mitk::ContourModelGLMapper2DBase::~ContourModelGLMapper2DBase() { } void mitk::ContourModelGLMapper2DBase::Initialize(mitk::BaseRenderer *) { vtkOpenGLContextDevice2D *device = NULL; device = vtkOpenGLContextDevice2D::New(); if (device) { this->m_Context->Begin(device); device->Delete(); this->m_Initialized = true; } else { } } void mitk::ContourModelGLMapper2DBase::ApplyColorAndOpacityProperties(mitk::BaseRenderer *renderer, vtkActor * /*actor*/) { float rgba[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // check for color prop and use it for rendering if it exists GetDataNode()->GetColor(rgba, renderer, "color"); // check for opacity prop and use it for rendering if it exists GetDataNode()->GetOpacity(rgba[3], renderer, "opacity"); + if (this->m_Context->GetPen() == nullptr) + { + return; + } this->m_Context->GetPen()->SetColorF((double)rgba[0], (double)rgba[1], (double)rgba[2], (double)rgba[3]); } void mitk::ContourModelGLMapper2DBase::DrawContour(mitk::ContourModel *renderingContour, mitk::BaseRenderer *renderer) { if (std::find(m_RendererList.begin(), m_RendererList.end(), renderer) == m_RendererList.end()) { m_RendererList.push_back(renderer); } mitk::ManualPlacementAnnotationRenderer::AddAnnotation(m_PointNumbersAnnotation.GetPointer(), renderer); m_PointNumbersAnnotation->SetVisibility(false); mitk::ManualPlacementAnnotationRenderer::AddAnnotation(m_ControlPointNumbersAnnotation.GetPointer(), renderer); m_ControlPointNumbersAnnotation->SetVisibility(false); InternalDrawContour(renderingContour, renderer); } void mitk::ContourModelGLMapper2DBase::InternalDrawContour(mitk::ContourModel *renderingContour, mitk::BaseRenderer *renderer) { if (!renderingContour) return; if (!this->m_Initialized) { this->Initialize(renderer); } vtkOpenGLContextDevice2D::SafeDownCast( this->m_Context->GetDevice())->Begin(renderer->GetVtkRenderer()); mitk::DataNode *dataNode = this->GetDataNode(); renderingContour->UpdateOutputInformation(); unsigned int timestep = renderer->GetTimeStep(); if (!renderingContour->IsEmptyTimeStep(timestep)) { // apply color and opacity read from the PropertyList ApplyColorAndOpacityProperties(renderer); mitk::ColorProperty::Pointer colorprop = dynamic_cast<mitk::ColorProperty *>(dataNode->GetProperty("contour.color", renderer)); float opacity = 0.5; dataNode->GetFloatProperty("opacity", opacity, renderer); if (colorprop) { // set the color of the contour double red = colorprop->GetColor().GetRed(); double green = colorprop->GetColor().GetGreen(); double blue = colorprop->GetColor().GetBlue(); this->m_Context->GetPen()->SetColorF(red, green, blue, opacity); } mitk::ColorProperty::Pointer selectedcolor = dynamic_cast<mitk::ColorProperty *>(dataNode->GetProperty("contour.points.color", renderer)); if (!selectedcolor) { selectedcolor = mitk::ColorProperty::New(1.0, 0.0, 0.1); } vtkLinearTransform *transform = dataNode->GetVtkTransform(); // ContourModel::OutputType point; mitk::Point3D point; mitk::Point3D p; float vtkp[3]; float lineWidth = 3.0; bool drawit = false; bool isHovering = false; dataNode->GetBoolProperty("contour.hovering", isHovering); if (isHovering) dataNode->GetFloatProperty("contour.hovering.width", lineWidth); else dataNode->GetFloatProperty("contour.width", lineWidth); bool showSegments = false; dataNode->GetBoolProperty("contour.segments.show", showSegments); bool showControlPoints = false; dataNode->GetBoolProperty("contour.controlpoints.show", showControlPoints); bool showPoints = false; dataNode->GetBoolProperty("contour.points.show", showPoints); bool showPointsNumbers = false; dataNode->GetBoolProperty("contour.points.text", showPointsNumbers); bool showControlPointsNumbers = false; dataNode->GetBoolProperty("contour.controlpoints.text", showControlPointsNumbers); bool projectmode = false; dataNode->GetVisibility(projectmode, renderer, "contour.project-onto-plane"); mitk::ContourModel::VertexIterator pointsIt = renderingContour->IteratorBegin(timestep); Point2D pt2d; // projected_p in display coordinates Point2D lastPt2d; int index = 0; mitk::ScalarType maxDiff = 0.25; while (pointsIt != renderingContour->IteratorEnd(timestep)) { lastPt2d = pt2d; point = (*pointsIt)->Coordinates; itk2vtk(point, vtkp); transform->TransformPoint(vtkp, vtkp); vtk2itk(vtkp, p); renderer->WorldToView(p, pt2d); ScalarType scalardiff = fabs(renderer->GetCurrentWorldPlaneGeometry()->SignedDistance(p)); // project to plane if (projectmode) { drawit = true; } else if (scalardiff < maxDiff) // point is close enough to be drawn { drawit = true; } else { drawit = false; } // draw line if (drawit) { if (showSegments) { // lastPt2d is not valid in first step if (!(pointsIt == renderingContour->IteratorBegin(timestep))) { this->m_Context->GetPen()->SetWidth(lineWidth); this->m_Context->DrawLine(pt2d[0], pt2d[1], lastPt2d[0], lastPt2d[1]); this->m_Context->GetPen()->SetWidth(1); } } if (showControlPoints) { // draw ontrol points if ((*pointsIt)->IsControlPoint) { float pointsize = 4; Point2D tmp; Vector2D horz, vert; horz[1] = 0; vert[0] = 0; horz[0] = pointsize; vert[1] = pointsize; this->m_Context->GetPen()->SetColorF(selectedcolor->GetColor().GetRed(), selectedcolor->GetColor().GetBlue(), selectedcolor->GetColor().GetGreen()); this->m_Context->GetPen()->SetWidth(1); // a rectangle around the point with the selected color float* rectPts = new float[8]; tmp = pt2d - horz; rectPts[0] = tmp[0]; rectPts[1] = tmp[1]; tmp = pt2d + vert; rectPts[2] = tmp[0]; rectPts[3] = tmp[1]; tmp = pt2d + horz; rectPts[4] = tmp[0]; rectPts[5] = tmp[1]; tmp = pt2d - vert; rectPts[6] = tmp[0]; rectPts[7] = tmp[1]; this->m_Context->DrawPolygon(rectPts,4); // the actual point in the specified color to see the usual color of the point this->m_Context->GetPen()->SetColorF( colorprop->GetColor().GetRed(), colorprop->GetColor().GetGreen(), colorprop->GetColor().GetBlue()); this->m_Context->DrawPoint(pt2d[0], pt2d[1]); } } if (showPoints) { float pointsize = 3; Point2D tmp; Vector2D horz, vert; horz[1] = 0; vert[0] = 0; horz[0] = pointsize; vert[1] = pointsize; this->m_Context->GetPen()->SetColorF(0.0, 0.0, 0.0); this->m_Context->GetPen()->SetWidth(1); // a rectangle around the point with the selected color float* rectPts = new float[8]; tmp = pt2d - horz; rectPts[0] = tmp[0]; rectPts[1] = tmp[1]; tmp = pt2d + vert; rectPts[2] = tmp[0]; rectPts[3] = tmp[1]; tmp = pt2d + horz; rectPts[4] = tmp[0]; rectPts[5] = tmp[1]; tmp = pt2d - vert; rectPts[6] = tmp[0]; rectPts[7] = tmp[1]; this->m_Context->DrawPolygon(rectPts, 4); // the actual point in the specified color to see the usual color of the point this->m_Context->GetPen()->SetColorF( colorprop->GetColor().GetRed(), colorprop->GetColor().GetGreen(), colorprop->GetColor().GetBlue()); this->m_Context->DrawPoint(pt2d[0], pt2d[1]); } if (showPointsNumbers) { std::string l; std::stringstream ss; ss << index; l.append(ss.str()); float rgb[3]; rgb[0] = 0.0; rgb[1] = 0.0; rgb[2] = 0.0; WriteTextWithAnnotation(m_PointNumbersAnnotation, l.c_str(), rgb, pt2d, renderer); } if (showControlPointsNumbers && (*pointsIt)->IsControlPoint) { std::string l; std::stringstream ss; ss << index; l.append(ss.str()); float rgb[3]; rgb[0] = 1.0; rgb[1] = 1.0; rgb[2] = 0.0; WriteTextWithAnnotation(m_ControlPointNumbersAnnotation, l.c_str(), rgb, pt2d, renderer); } index++; } pointsIt++; } // end while iterate over controlpoints // close contour if necessary if (renderingContour->IsClosed(timestep) && drawit && showSegments) { lastPt2d = pt2d; point = renderingContour->GetVertexAt(0, timestep)->Coordinates; itk2vtk(point, vtkp); transform->TransformPoint(vtkp, vtkp); vtk2itk(vtkp, p); renderer->WorldToDisplay(p, pt2d); this->m_Context->GetPen()->SetWidth(lineWidth); this->m_Context->DrawLine(lastPt2d[0], lastPt2d[1], pt2d[0], pt2d[1]); this->m_Context->GetPen()->SetWidth(1); } // draw selected vertex if exists if (renderingContour->GetSelectedVertex()) { // transform selected vertex point = renderingContour->GetSelectedVertex()->Coordinates; itk2vtk(point, vtkp); transform->TransformPoint(vtkp, vtkp); vtk2itk(vtkp, p); renderer->WorldToDisplay(p, pt2d); ScalarType scalardiff = fabs(renderer->GetCurrentWorldPlaneGeometry()->SignedDistance(p)); //---------------------------------- // draw point if close to plane if (scalardiff < maxDiff) { float pointsize = 5; Point2D tmp; this->m_Context->GetPen()->SetColorF(0.0, 1.0, 0.0); this->m_Context->GetPen()->SetWidth(1); // a rectangle around the point with the selected color float* rectPts = new float[8]; // a diamond around the point // begin from upper left corner and paint clockwise rectPts[0] = pt2d[0] - pointsize; rectPts[1] = pt2d[1] + pointsize; rectPts[2] = pt2d[0] + pointsize; rectPts[3] = pt2d[1] + pointsize; rectPts[4] = pt2d[0] + pointsize; rectPts[5] = pt2d[1] - pointsize; rectPts[6] = pt2d[0] - pointsize; rectPts[7] = pt2d[1] - pointsize; this->m_Context->DrawPolygon(rectPts, 4); } //------------------------------------ } } this->m_Context->GetDevice()->End(); } void mitk::ContourModelGLMapper2DBase::WriteTextWithAnnotation(TextAnnotationPointerType textAnnotation, const char *text, float rgb[3], Point2D /*pt2d*/, mitk::BaseRenderer * /*renderer*/) { textAnnotation->SetText(text); textAnnotation->SetColor(rgb); textAnnotation->SetOpacity(1); textAnnotation->SetFontSize(16); textAnnotation->SetBoolProperty("drawShadow", false); textAnnotation->SetVisibility(true); } diff --git a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp index b51290694e..a5a5e8dd38 100644 --- a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp +++ b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp @@ -1,396 +1,96 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkContourModelSetGLMapper2D.h" #include "mitkColorProperty.h" #include "mitkContourModelSet.h" #include "mitkPlaneGeometry.h" #include "mitkProperties.h" #include <vtkLinearTransform.h> #include "mitkGL.h" mitk::ContourModelSetGLMapper2D::ContourModelSetGLMapper2D() { } mitk::ContourModelSetGLMapper2D::~ContourModelSetGLMapper2D() { } void mitk::ContourModelSetGLMapper2D::MitkRender(mitk::BaseRenderer *renderer, mitk::VtkPropRenderer::RenderType /*type*/) { BaseLocalStorage *ls = m_LSH.GetLocalStorage(renderer); mitk::DataNode::Pointer dataNode = this->GetDataNode(); bool visible = true; dataNode->GetVisibility(visible, nullptr); if (!visible) return; mitk::ContourModelSet::Pointer input = this->GetInput(); auto centerOfViewPointZ = renderer->GetCurrentWorldPlaneGeometry()->GetCenter()[2]; mitk::ContourModelSet::ContourModelSetIterator it = input->Begin(); mitk::ContourModelSet::ContourModelSetIterator end = input->End(); while (it != end) { //we have the assumption that each contour model vertex has the same z coordinate auto currentZValue = (*it)->GetVertexAt(0)->Coordinates[2]; double acceptedDeviationInMM = 5.0; //only draw contour if it is visible if (currentZValue - acceptedDeviationInMM < centerOfViewPointZ && currentZValue + acceptedDeviationInMM > centerOfViewPointZ){ this->DrawContour(it->GetPointer(), renderer); } ++it; } if (input->GetSize() < 1) return; ls->UpdateGenerateDataTime(); } mitk::ContourModelSet *mitk::ContourModelSetGLMapper2D::GetInput(void) { return const_cast<mitk::ContourModelSet *>(static_cast<const mitk::ContourModelSet *>(GetDataNode()->GetData())); } -void mitk::ContourModelSetGLMapper2D::InternalDrawContour(mitk::ContourModel *renderingContour, - mitk::BaseRenderer *renderer) -{ - if (!renderingContour) - return; - - mitk::DataNode::Pointer dataNode = this->GetDataNode(); - - renderingContour->UpdateOutputInformation(); - - unsigned int timestep = renderer->GetTimeStep(); - - if (!renderingContour->IsEmptyTimeStep(timestep)) - { - // apply color and opacity read from the PropertyList - ApplyColorAndOpacityProperties(renderer); - - mitk::ColorProperty::Pointer colorprop = - dynamic_cast<mitk::ColorProperty *>(dataNode->GetProperty("contour.color", renderer)); - float opacity = 0.5; - dataNode->GetFloatProperty("opacity", opacity, renderer); - - if (colorprop) - { - // set the color of the contour - double red = colorprop->GetColor().GetRed(); - double green = colorprop->GetColor().GetGreen(); - double blue = colorprop->GetColor().GetBlue(); - glColor4f(red, green, blue, opacity); - } - - mitk::ColorProperty::Pointer selectedcolor = - dynamic_cast<mitk::ColorProperty *>(dataNode->GetProperty("contour.points.color", renderer)); - if (!selectedcolor) - { - selectedcolor = mitk::ColorProperty::New(1.0, 0.0, 0.1); - } - - vtkLinearTransform *transform = dataNode->GetVtkTransform(); - - // ContourModel::OutputType point; - mitk::Point3D point; - - mitk::Point3D p; - float vtkp[3]; - float lineWidth = 3.0; - - bool drawit = false; - - bool isHovering = false; - dataNode->GetBoolProperty("contour.hovering", isHovering); - - if (isHovering) - dataNode->GetFloatProperty("contour.hovering.width", lineWidth); - else - dataNode->GetFloatProperty("contour.width", lineWidth); - - bool showSegments = false; - dataNode->GetBoolProperty("contour.segments.show", showSegments); - - bool showControlPoints = false; - dataNode->GetBoolProperty("contour.controlpoints.show", showControlPoints); - - bool showPoints = false; - dataNode->GetBoolProperty("contour.points.show", showPoints); - - bool showPointsNumbers = false; - dataNode->GetBoolProperty("contour.points.text", showPointsNumbers); - - bool showControlPointsNumbers = false; - dataNode->GetBoolProperty("contour.controlpoints.text", showControlPointsNumbers); - - bool projectmode = false; - dataNode->GetVisibility(projectmode, renderer, "contour.project-onto-plane"); - - mitk::ContourModel::VertexIterator pointsIt = renderingContour->IteratorBegin(timestep); - - Point2D pt2d; // projected_p in display coordinates - Point2D lastPt2d; - - int index = 0; - - mitk::ScalarType maxDiff = 0.25; - - while (pointsIt != renderingContour->IteratorEnd(timestep)) - { - lastPt2d = pt2d; - - point = (*pointsIt)->Coordinates; - - itk2vtk(point, vtkp); - transform->TransformPoint(vtkp, vtkp); - vtk2itk(vtkp, p); - - renderer->WorldToDisplay(p, pt2d); - - ScalarType scalardiff = fabs(renderer->GetCurrentWorldPlaneGeometry()->SignedDistance(p)); - - // project to plane - if (projectmode) - { - drawit = true; - } - else if (scalardiff < maxDiff) // point is close enough to be drawn - { - drawit = true; - } - else - { - drawit = false; - } - - // draw line - if (drawit) - { - if (showSegments) - { - // lastPt2d is not valid in first step - if (!(pointsIt == renderingContour->IteratorBegin(timestep))) - { - glLineWidth(lineWidth); - glBegin(GL_LINES); - glVertex2f(pt2d[0], pt2d[1]); - glVertex2f(lastPt2d[0], lastPt2d[1]); - glEnd(); - glLineWidth(1); - } - } - - if (showControlPoints) - { - // draw control points - if ((*pointsIt)->IsControlPoint) - { - float pointsize = 4; - Point2D tmp; - - Vector2D horz, vert; - horz[1] = 0; - vert[0] = 0; - horz[0] = pointsize; - vert[1] = pointsize; - glColor3f(selectedcolor->GetColor().GetRed(), - selectedcolor->GetColor().GetBlue(), - selectedcolor->GetColor().GetGreen()); - glLineWidth(1); - // a rectangle around the point with the selected color - glBegin(GL_LINE_LOOP); - tmp = pt2d - horz; - glVertex2dv(&tmp[0]); - tmp = pt2d + vert; - glVertex2dv(&tmp[0]); - tmp = pt2d + horz; - glVertex2dv(&tmp[0]); - tmp = pt2d - vert; - glVertex2dv(&tmp[0]); - glEnd(); - glLineWidth(1); - // the actual point in the specified color to see the usual color of the point - glColor3f( - colorprop->GetColor().GetRed(), colorprop->GetColor().GetGreen(), colorprop->GetColor().GetBlue()); - glPointSize(1); - glBegin(GL_POINTS); - tmp = pt2d; - glVertex2dv(&tmp[0]); - glEnd(); - } - } - - if (showPoints) - { - float pointsize = 3; - Point2D tmp; - - Vector2D horz, vert; - horz[1] = 0; - vert[0] = 0; - horz[0] = pointsize; - vert[1] = pointsize; - glColor3f(0.0, 0.0, 0.0); - glLineWidth(1); - // a rectangle around the point with the selected color - glBegin(GL_LINE_LOOP); - tmp = pt2d - horz; - glVertex2dv(&tmp[0]); - tmp = pt2d + vert; - glVertex2dv(&tmp[0]); - tmp = pt2d + horz; - glVertex2dv(&tmp[0]); - tmp = pt2d - vert; - glVertex2dv(&tmp[0]); - glEnd(); - glLineWidth(1); - // the actual point in the specified color to see the usual color of the point - glColor3f(colorprop->GetColor().GetRed(), colorprop->GetColor().GetGreen(), colorprop->GetColor().GetBlue()); - glPointSize(1); - glBegin(GL_POINTS); - tmp = pt2d; - glVertex2dv(&tmp[0]); - glEnd(); - } - - if (showPointsNumbers) - { - std::string l; - std::stringstream ss; - ss << index; - l.append(ss.str()); - - float rgb[3]; - rgb[0] = 0.0; - rgb[1] = 0.0; - rgb[2] = 0.0; - - WriteTextWithAnnotation(m_PointNumbersAnnotation, l.c_str(), rgb, pt2d, renderer); - } - - if (showControlPointsNumbers && (*pointsIt)->IsControlPoint) - { - std::string l; - std::stringstream ss; - ss << index; - l.append(ss.str()); - - float rgb[3]; - rgb[0] = 1.0; - rgb[1] = 1.0; - rgb[2] = 0.0; - - WriteTextWithAnnotation(m_ControlPointNumbersAnnotation, l.c_str(), rgb, pt2d, renderer); - } - - index++; - } - - pointsIt++; - } // end while iterate over controlpoints - - // close contour if necessary - if (renderingContour->IsClosed(timestep) && drawit && showSegments) - { - lastPt2d = pt2d; - point = renderingContour->GetVertexAt(0, timestep)->Coordinates; - itk2vtk(point, vtkp); - transform->TransformPoint(vtkp, vtkp); - vtk2itk(vtkp, p); - renderer->WorldToDisplay(p, pt2d); - - glLineWidth(lineWidth); - glBegin(GL_LINES); - glVertex2f(lastPt2d[0], lastPt2d[1]); - glVertex2f(pt2d[0], pt2d[1]); - glEnd(); - glLineWidth(1); - } - - // draw selected vertex if exists - if (renderingContour->GetSelectedVertex()) - { - // transform selected vertex - point = renderingContour->GetSelectedVertex()->Coordinates; - - itk2vtk(point, vtkp); - transform->TransformPoint(vtkp, vtkp); - vtk2itk(vtkp, p); - - renderer->WorldToDisplay(p, pt2d); - - ScalarType scalardiff = fabs(renderer->GetCurrentWorldPlaneGeometry()->SignedDistance(p)); - //---------------------------------- - - // draw point if close to plane - if (scalardiff < maxDiff) - { - float pointsize = 5; - Point2D tmp; - glColor3f(0.0, 1.0, 0.0); - glLineWidth(1); - // a diamond around the point - glBegin(GL_LINE_LOOP); - // begin from upper left corner and paint clockwise - tmp[0] = pt2d[0] - pointsize; - tmp[1] = pt2d[1] + pointsize; - glVertex2dv(&tmp[0]); - tmp[0] = pt2d[0] + pointsize; - tmp[1] = pt2d[1] + pointsize; - glVertex2dv(&tmp[0]); - tmp[0] = pt2d[0] + pointsize; - tmp[1] = pt2d[1] - pointsize; - glVertex2dv(&tmp[0]); - tmp[0] = pt2d[0] - pointsize; - tmp[1] = pt2d[1] - pointsize; - glVertex2dv(&tmp[0]); - glEnd(); - } - //------------------------------------ - } - } -} - void mitk::ContourModelSetGLMapper2D::SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer, bool overwrite) { node->AddProperty("contour.color", ColorProperty::New(0.9, 1.0, 0.1), renderer, overwrite); node->AddProperty("contour.points.color", ColorProperty::New(1.0, 0.0, 0.1), renderer, overwrite); node->AddProperty("contour.points.show", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("contour.segments.show", mitk::BoolProperty::New(true), renderer, overwrite); node->AddProperty("contour.controlpoints.show", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("contour.width", mitk::FloatProperty::New(1.0), renderer, overwrite); node->AddProperty("contour.hovering.width", mitk::FloatProperty::New(3.0), renderer, overwrite); node->AddProperty("contour.hovering", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("contour.points.text", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("contour.controlpoints.text", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("contour.project-onto-plane", mitk::BoolProperty::New(false), renderer, overwrite); node->AddProperty("opacity", mitk::FloatProperty::New(1.0f), renderer, overwrite); Superclass::SetDefaultProperties(node, renderer, overwrite); } diff --git a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h index 8de9f373d0..85fe93f0cc 100644 --- a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h +++ b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h @@ -1,70 +1,68 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITK_ContourModelSetGLMapper2D_H_ #define MITK_ContourModelSetGLMapper2D_H_ #include "mitkBaseRenderer.h" #include "mitkCommon.h" #include "mitkContourModelGLMapper2DBase.h" #include "mitkContourModelSet.h" #include <MitkContourModelExports.h> namespace mitk { class BaseRenderer; class ContourModel; /** * @brief OpenGL-based mapper to display a mitk::ContourModelSet object containing several contours in a 2D render * window * * * @ingroup MitkContourModelModule */ class MITKCONTOURMODEL_EXPORT ContourModelSetGLMapper2D : public ContourModelGLMapper2DBase { public: mitkClassMacro(ContourModelSetGLMapper2D, ContourModelGLMapper2DBase); itkFactorylessNewMacro(Self) itkCloneMacro(Self) /** * reimplemented from Baseclass */ virtual void MitkRender(mitk::BaseRenderer *renderer, mitk::VtkPropRenderer::RenderType type) override; static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false); LocalStorageHandler<BaseLocalStorage> m_LSH; protected: ContourModelSetGLMapper2D(); virtual ~ContourModelSetGLMapper2D(); - void InternalDrawContour(mitk::ContourModel *contour, mitk::BaseRenderer *renderer) override; - private: /** * return a reference of the rendered data object */ ContourModelSet *GetInput(void); }; } // namespace mitk #endif