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

mitk::LineVtkMapper3D Class Reference
[Mapper Classes]

Vtk-based mapper to draw Lines from PointSet. More...

#include <mitkLineVtkMapper3D.h>

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

List of all members.

Public Types

typedef LineVtkMapper3D Self
typedef PointSetVtkMapper3D Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 LineVtkMapper3D ()
virtual ~LineVtkMapper3D ()
virtual void GenerateData (mitk::BaseRenderer *renderer)
 Generate the data needed for rendering into renderer.

Detailed Description

Vtk-based mapper to draw Lines from PointSet.

Definition at line 53 of file mitkLineVtkMapper3D.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::LineVtkMapper3D::ConstPointer

Reimplemented from mitk::PointSetVtkMapper3D.

Definition at line 57 of file mitkLineVtkMapper3D.h.

typedef itk::SmartPointer<Self> mitk::LineVtkMapper3D::Pointer

Reimplemented from mitk::PointSetVtkMapper3D.

Definition at line 57 of file mitkLineVtkMapper3D.h.

Reimplemented from mitk::PointSetVtkMapper3D.

Definition at line 57 of file mitkLineVtkMapper3D.h.

Reimplemented from mitk::PointSetVtkMapper3D.

Definition at line 57 of file mitkLineVtkMapper3D.h.


Constructor & Destructor Documentation

mitk::LineVtkMapper3D::LineVtkMapper3D (  ) [protected]

Definition at line 28 of file mitkLineVtkMapper3D.cpp.

: PointSetVtkMapper3D()//constructor of superclass
{
}
mitk::LineVtkMapper3D::~LineVtkMapper3D (  ) [protected, virtual]

Definition at line 33 of file mitkLineVtkMapper3D.cpp.

{
}

Member Function Documentation

void mitk::LineVtkMapper3D::GenerateData ( mitk::BaseRenderer renderer ) [protected, virtual]

Generate the data needed for rendering into renderer.

Reimplemented from mitk::PointSetVtkMapper3D.

Definition at line 37 of file mitkLineVtkMapper3D.cpp.

{//from PointListVTKMapper3D and a little re-layouted!
  if(IsVisible(renderer)==false)
  {
      m_Actor->VisibilityOff();
      return;
  }

  m_Actor->VisibilityOn();

  m_vtkPointList->Delete();
  m_vtkTextList->Delete();
  m_contour->Delete();
  m_tubefilter->Delete();

  m_vtkPointList = vtkAppendPolyData::New();
  m_vtkTextList = vtkAppendPolyData::New();
  m_contour = vtkPolyData::New();
  m_tubefilter = vtkTubeFilter::New();


  mitk::PointSet::Pointer input  = const_cast<mitk::PointSet*>(this->GetInput());
  mitk::PointSet::PointSetType::Pointer pointList;

  pointList = input->GetPointList();

  mitk::PointSet::PointsContainer::Iterator i;

  int j;
  bool makeContour;
  if (dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("show contour").GetPointer()) == NULL)
    makeContour = false;
  else
    makeContour = dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("show contour").GetPointer())->GetValue();

  vtkPoints *points = vtkPoints::New();
  vtkCellArray *polys = vtkCellArray::New();

  for (j=0, i=pointList->GetPoints()->Begin(); i!=pointList->GetPoints()->End() ; i++,j++)
  {
    int cell[2] = {j-1,j};
    points->InsertPoint(j,i.Value()[0],i.Value()[1],i.Value()[2]);
    if (j>0)
      polys->InsertNextCell(2,cell);
  }

  bool close;
  if (dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("close contour").GetPointer()) == NULL)
    close = false;
  else
    close = dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("close contour").GetPointer())->GetValue();

  if (close) 
  {
    int cell[2] = {j-1,0};
    polys->InsertNextCell(2,cell);
  }

  m_contour->SetPoints(points);
  points->Delete();
  m_contour->SetLines(polys);
  polys->Delete();
  m_contour->Update();

  m_tubefilter->SetInput(m_contour);
  m_tubefilter->SetRadius(1);
  m_tubefilter->Update();;

  m_vtkPointList->AddInput(m_tubefilter->GetOutput());
  

  // check for color prop and use it for rendering if it exists
  float rgba[4]={1.0f,1.0f,1.0f,1.0f};
  GetColor(rgba, renderer);

  for (j=0, i=pointList->GetPoints()->Begin(); i!=pointList->GetPoints()->End() ; i++,j++)
  {
    vtkSphereSource *sphere = vtkSphereSource::New();

    sphere->SetRadius(2);
    sphere->SetCenter(i.Value()[0],i.Value()[1],i.Value()[2]);

    m_vtkPointList->AddInput(sphere->GetOutput());

    if (dynamic_cast<mitk::StringProperty *>(this->GetDataNode()->GetProperty("label").GetPointer()) == NULL)
    {
    }
    else 
    {
      const char * pointLabel =dynamic_cast<mitk::StringProperty *>(this->GetDataNode()->GetProperty("label").GetPointer())->GetValue();
      char buffer[20];
       std::string l = pointLabel;
      if (input->GetSize()>1)
      {
        sprintf(buffer,"%d",j+1);
        l.append(buffer);
      }

      // Define the text for the label
      vtkVectorText *label = vtkVectorText::New();
      label->SetText(l.c_str());

      // Set up a transform to move the label to a new position.
      vtkTransform *aLabelTransform =vtkTransform::New();
      aLabelTransform->Identity();
      aLabelTransform->Translate(i.Value()[0]+2,i.Value()[1]+2,i.Value()[2]);
      aLabelTransform->Scale(5.7,5.7,5.7);

      // Move the label to a new position.
      vtkTransformPolyDataFilter *labelTransform = vtkTransformPolyDataFilter::New();
      labelTransform->SetTransform(aLabelTransform);
      labelTransform->SetInput(label->GetOutput());

      m_vtkPointList->AddInput(labelTransform->GetOutput());
    }


  }


  m_VtkPolyDataMapper->SetInput(m_vtkPointList->GetOutput());
  m_Actor->GetProperty()->SetColor(rgba);
}
virtual const char* mitk::LineVtkMapper3D::GetClassName (  ) const [virtual]

Reimplemented from mitk::PointSetVtkMapper3D.

static Pointer mitk::LineVtkMapper3D::New (  ) [static]

Reimplemented from mitk::PointSetVtkMapper3D.


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