OpenGL-based mapper to display a mitk::Contour object in a 2D render window. More...
#include <mitkContourMapper2D.h>
Public Types | |
typedef ContourMapper2D | Self |
typedef Mapper2D | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual void | Paint (BaseRenderer *renderer) |
const Contour * | GetInput (void) |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
ContourMapper2D () | |
virtual | ~ContourMapper2D () |
OpenGL-based mapper to display a mitk::Contour object in a 2D render window.
Definition at line 38 of file mitkContourMapper2D.h.
typedef itk::SmartPointer<const Self> mitk::ContourMapper2D::ConstPointer |
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourMapper2D.h.
typedef itk::SmartPointer<Self> mitk::ContourMapper2D::Pointer |
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourMapper2D.h.
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourMapper2D.h.
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourMapper2D.h.
mitk::ContourMapper2D::ContourMapper2D | ( | ) | [protected] |
Definition at line 29 of file mitkContourMapper2D.cpp.
{ }
mitk::ContourMapper2D::~ContourMapper2D | ( | ) | [protected, virtual] |
Definition at line 33 of file mitkContourMapper2D.cpp.
{ }
virtual const char* mitk::ContourMapper2D::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::Mapper2D.
const mitk::Contour * mitk::ContourMapper2D::GetInput | ( | void | ) |
return a refernce of the rendered data object
Definition at line 127 of file mitkContourMapper2D.cpp.
{ return static_cast<const mitk::Contour * > ( GetData() ); }
static Pointer mitk::ContourMapper2D::New | ( | ) | [static] |
void mitk::ContourMapper2D::Paint | ( | mitk::BaseRenderer * | renderer ) | [virtual] |
reimplemented from Baseclass
Implements mitk::GLMapper2D.
Definition at line 38 of file mitkContourMapper2D.cpp.
References mitk::BaseRenderer::GetDisplayGeometry(), GL_LINE_LOOP, GL_LINE_STRIP, glBegin(), glEnd(), glLineWidth(), and glVertex2f().
{ if(IsVisible(renderer)==false) return; bool updateNeccesary=true; if (updateNeccesary) { mitk::Contour::Pointer input = const_cast<mitk::Contour*>(this->GetInput()); // ok, das ist aus GenerateData kopiert mitk::DisplayGeometry::Pointer displayGeometry = renderer->GetDisplayGeometry(); assert(displayGeometry.IsNotNull()); //apply color and opacity read from the PropertyList ApplyProperties(renderer); vtkLinearTransform* transform = GetDataNode()->GetVtkTransform(); // Contour::OutputType point; Contour::BoundingBoxType::PointType point; mitk::Point3D p, projected_p; float vtkp[3]; float lineWidth = 3.0; if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("Width")) != NULL) lineWidth = dynamic_cast<mitk::FloatProperty*>(this->GetDataNode()->GetProperty("Width"))->GetValue(); glLineWidth(lineWidth); if (input->GetClosed()) { glBegin (GL_LINE_LOOP); } else { glBegin (GL_LINE_STRIP); } //Contour::InputType end = input->GetContourPath()->EndOfInput(); //if (end > 50000) end = 0; mitk::Contour::PointsContainerPointer points = input->GetPoints(); mitk::Contour::PointsContainerIterator pointsIt = points->Begin(); while ( pointsIt != points->End() ) { //while ( idx != end ) //{ // point = input->GetContourPath()->Evaluate(idx); point = pointsIt.Value(); itk2vtk(point, vtkp); transform->TransformPoint(vtkp, vtkp); vtk2itk(vtkp,p); displayGeometry->Project(p, projected_p); bool projectmode=false; GetDataNode()->GetVisibility(projectmode, renderer, "project"); bool drawit=false; if(projectmode) drawit=true; else { Vector3D diff=p-projected_p; if(diff.GetSquaredNorm()<1.0) drawit=true; } if(drawit) { Point2D pt2d, tmp; displayGeometry->Map(projected_p, pt2d); displayGeometry->WorldToDisplay(pt2d, pt2d); glVertex2f(pt2d[0], pt2d[1]); } pointsIt++; // idx += 1; } glEnd (); glLineWidth(1.0); } }