OpenGL-based mapper to display a mitk::Contour object in a 2D render window. More...
#include <mitkContourSetMapper2D.h>
Public Types | |
typedef ContourSetMapper2D | 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 (mitk::BaseRenderer *renderer) |
const mitk::ContourSet * | GetInput (void) |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
ContourSetMapper2D () | |
virtual | ~ContourSetMapper2D () |
OpenGL-based mapper to display a mitk::Contour object in a 2D render window.
Definition at line 38 of file mitkContourSetMapper2D.h.
typedef itk::SmartPointer<const Self> mitk::ContourSetMapper2D::ConstPointer |
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourSetMapper2D.h.
typedef itk::SmartPointer<Self> mitk::ContourSetMapper2D::Pointer |
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourSetMapper2D.h.
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourSetMapper2D.h.
Reimplemented from mitk::Mapper2D.
Definition at line 42 of file mitkContourSetMapper2D.h.
mitk::ContourSetMapper2D::ContourSetMapper2D | ( | ) | [protected] |
Definition at line 29 of file mitkContourSetMapper2D.cpp.
{ }
mitk::ContourSetMapper2D::~ContourSetMapper2D | ( | ) | [protected, virtual] |
Definition at line 33 of file mitkContourSetMapper2D.cpp.
{ }
virtual const char* mitk::ContourSetMapper2D::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::Mapper2D.
const mitk::ContourSet * mitk::ContourSetMapper2D::GetInput | ( | void | ) |
return a refernce of the rendered data object
Definition at line 125 of file mitkContourSetMapper2D.cpp.
{ return static_cast<const mitk::ContourSet * > ( GetData() ); }
static Pointer mitk::ContourSetMapper2D::New | ( | ) | [static] |
void mitk::ContourSetMapper2D::Paint | ( | mitk::BaseRenderer * | renderer ) | [virtual] |
reimplemented from Baseclass
Implements mitk::GLMapper2D.
Definition at line 38 of file mitkContourSetMapper2D.cpp.
References mitk::ContourSet::GetContours(), mitk::BaseRenderer::GetDisplayGeometry(), GL_LINE_LOOP, GL_LINE_STRIP, glBegin(), glEnd(), glLineWidth(), and glVertex2f().
{ if(IsVisible(renderer)==false) return; bool updateNeccesary=true; if (updateNeccesary) { // 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); mitk::ContourSet::Pointer input = const_cast<mitk::ContourSet*>(this->GetInput()); mitk::ContourSet::ContourVectorType contourVec = input->GetContours(); mitk::ContourSet::ContourIterator contourIt = contourVec.begin(); while ( contourIt != contourVec.end() ) { mitk::Contour::Pointer nextContour = (mitk::Contour::Pointer) (*contourIt).second; vtkLinearTransform* transform = GetDataNode()->GetVtkTransform(); // Contour::OutputType point; Contour::BoundingBoxType::PointType point; mitk::Point3D p, projected_p; float vtkp[3]; glLineWidth( nextContour->GetWidth() ); if (nextContour->GetClosed()) { glBegin (GL_LINE_LOOP); } else { glBegin (GL_LINE_STRIP); } //float rgba[4]={1.0f,1.0f,1.0f,1.0f}; //if ( nextContour->GetSelected() ) //{ // rgba[0] = 1.0; // rgba[1] = 0.0; // rgba[2] = 0.0; //} //glColor4fv(rgba); mitk::Contour::PointsContainerPointer points = nextContour->GetPoints(); mitk::Contour::PointsContainerIterator pointsIt = points->Begin(); while ( pointsIt != points->End() ) { point = pointsIt.Value(); itk2vtk(point, vtkp); transform->TransformPoint(vtkp, vtkp); vtk2itk(vtkp,p); displayGeometry->Project(p, projected_p); Vector3D diff=p-projected_p; if(diff.GetSquaredNorm()<1.0) { Point2D pt2d, tmp; displayGeometry->Map(projected_p, pt2d); displayGeometry->WorldToDisplay(pt2d, pt2d); glVertex2f(pt2d[0], pt2d[1]); } pointsIt++; // idx += 1; } glEnd (); glLineWidth(1.0); contourIt++; } } }