Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

mitk::ContourSetMapper2D Class Reference
[Mapper Classes]

OpenGL-based mapper to display a mitk::Contour object in a 2D render window. More...

#include <mitkContourSetMapper2D.h>

Inheritance diagram for mitk::ContourSetMapper2D:
Inheritance graph
[legend]
Collaboration diagram for mitk::ContourSetMapper2D:
Collaboration graph
[legend]

List of all members.

Public Types

typedef ContourSetMapper2D Self
typedef Mapper2D Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual void Paint (mitk::BaseRenderer *renderer)
const mitk::ContourSetGetInput (void)

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 ContourSetMapper2D ()
virtual ~ContourSetMapper2D ()

Detailed Description

OpenGL-based mapper to display a mitk::Contour object in a 2D render window.

Definition at line 38 of file mitkContourSetMapper2D.h.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

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.

{
}

Member Function Documentation

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++;
    }
  }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines