Vtk-based mapper for mitk::Contour. More...
#include <mitkContourVtkMapper3D.h>


Public Types | |
| typedef ContourVtkMapper3D | Self |
| typedef VtkMapper3D | Superclass |
| typedef itk::SmartPointer< Self > | Pointer |
| typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
| virtual const char * | GetClassName () const |
| virtual const mitk::Contour * | GetInput () |
| virtual vtkProp * | GetVtkProp (mitk::BaseRenderer *renderer) |
Static Public Member Functions | |
| static Pointer | New () |
Protected Member Functions | |
| ContourVtkMapper3D () | |
| virtual | ~ContourVtkMapper3D () |
| virtual void | GenerateData (mitk::BaseRenderer *renderer) |
| Generate the data needed for rendering into renderer. | |
Protected Attributes | |
| vtkSmartPointer < vtkPolyDataMapper > | m_VtkPolyDataMapper |
| vtkSmartPointer< vtkTubeFilter > | m_TubeFilter |
| vtkSmartPointer < vtkAppendPolyData > | m_VtkPointList |
| vtkSmartPointer< vtkPolyData > | m_Contour |
| vtkSmartPointer< vtkActor > | m_Actor |
Vtk-based mapper for mitk::Contour.
Definition at line 41 of file mitkContourVtkMapper3D.h.
| typedef itk::SmartPointer<const Self> mitk::ContourVtkMapper3D::ConstPointer |
Reimplemented from mitk::VtkMapper3D.
Definition at line 44 of file mitkContourVtkMapper3D.h.
| typedef itk::SmartPointer<Self> mitk::ContourVtkMapper3D::Pointer |
Reimplemented from mitk::VtkMapper3D.
Definition at line 44 of file mitkContourVtkMapper3D.h.
Reimplemented from mitk::VtkMapper3D.
Definition at line 44 of file mitkContourVtkMapper3D.h.
Reimplemented from mitk::VtkMapper3D.
Definition at line 44 of file mitkContourVtkMapper3D.h.
| mitk::ContourVtkMapper3D::ContourVtkMapper3D | ( | ) | [protected] |
Definition at line 43 of file mitkContourVtkMapper3D.cpp.
References m_Actor, m_TubeFilter, m_VtkPointList, m_VtkPolyDataMapper, and New().
{
m_VtkPolyDataMapper = vtkPolyDataMapper::New();
m_VtkPointList = vtkAppendPolyData::New();
m_Actor = vtkActor::New();
m_Actor->SetMapper(m_VtkPolyDataMapper);
m_TubeFilter = vtkTubeFilter::New();
}
| mitk::ContourVtkMapper3D::~ContourVtkMapper3D | ( | ) | [protected, virtual] |
Definition at line 53 of file mitkContourVtkMapper3D.cpp.
{
if(m_VtkPolyDataMapper)
m_VtkPolyDataMapper->Delete();
if(m_TubeFilter)
m_TubeFilter->Delete();
if(m_VtkPointList)
m_VtkPointList->Delete();
if(m_Contour)
m_Contour->Delete();
if(m_Actor)
m_Actor->Delete();
}
| void mitk::ContourVtkMapper3D::GenerateData | ( | mitk::BaseRenderer * | renderer ) | [protected, virtual] |
Generate the data needed for rendering into renderer.
Reimplemented from mitk::Mapper.
Definition at line 76 of file mitkContourVtkMapper3D.cpp.
{
if ( IsVisible(renderer)==false )
{
m_Actor->VisibilityOff();
return;
}
m_Actor->VisibilityOn();
m_Contour = vtkPolyData::New();
mitk::Contour::Pointer input = const_cast<mitk::Contour*>(this->GetInput());
bool makeContour = true;
if ( makeContour )
{
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
int numPts=input->GetNumberOfPoints();
if ( numPts > 200000 )
numPts = 200000;
mitk::Contour::PathPointer path = input->GetContourPath();
mitk::Contour::PathType::InputType cstart = path->StartOfInput();
mitk::Contour::PathType::InputType cend = path->EndOfInput();
mitk::Contour::PathType::InputType cstep = (cend-cstart+1)/numPts;
mitk::Contour::PathType::InputType ccur;
vtkIdType ptIndex = 0;
vtkIdType lastPointIndex = 0;
mitk::Contour::PointsContainerPointer contourPoints = input->GetPoints();
mitk::Contour::PointsContainerIterator pointsIt = contourPoints->Begin();
vtkFloatingPointType vtkpoint[3];
int i;
float pointSize = 2;
this->GetDataNode()->GetFloatProperty("spheres size", pointSize);
bool showPoints = true;
this->GetDataNode()->GetBoolProperty("show points", showPoints);
if ( showPoints )
{
m_VtkPointList = vtkAppendPolyData::New();
}
for ( i=0, ccur=cstart; i<numPts; ++i, ccur+=cstep )
{
itk2vtk(path->Evaluate(ccur), vtkpoint);
points->InsertPoint(ptIndex, vtkpoint);
if ( ptIndex > 0 )
{
int cell[2] = {ptIndex-1,ptIndex};
lines->InsertNextCell((vtkIdType)2,(vtkIdType*) cell);
}
lastPointIndex = ptIndex;
++ptIndex;
if ( showPoints )
{
vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
sphere->SetRadius(pointSize);
sphere->SetCenter(vtkpoint);
m_VtkPointList->AddInput(sphere->GetOutput());
sphere->Update();
}
}
if ( input->GetClosed() )
{
int cell[2] = {lastPointIndex,0};
lines->InsertNextCell((vtkIdType)2,(vtkIdType*) cell);
}
m_Contour->SetPoints(points);
m_Contour->SetLines(lines);
m_Contour->Update();
m_TubeFilter->SetInput(m_Contour);
m_TubeFilter->SetRadius(pointSize / 2.0f);
m_TubeFilter->SetNumberOfSides(8);
m_TubeFilter->Update();
if ( showPoints )
{
m_VtkPointList->AddInput(m_TubeFilter->GetOutput());
m_VtkPolyDataMapper->SetInput(m_VtkPointList->GetOutput());
}
else
{
m_VtkPolyDataMapper->SetInput(m_TubeFilter->GetOutput());
}
vtkFloatingPointType rgba[4]={0.0f,1.0f,0.0f,0.6f};
m_Actor->GetProperty()->SetColor(rgba);
m_Actor->SetMapper(m_VtkPolyDataMapper);
}
SetVtkMapperImmediateModeRendering(m_VtkPolyDataMapper);
}
| virtual const char* mitk::ContourVtkMapper3D::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::VtkMapper3D.
| const mitk::Contour * mitk::ContourVtkMapper3D::GetInput | ( | void | ) | [virtual] |
Definition at line 178 of file mitkContourVtkMapper3D.cpp.
{
return static_cast<const mitk::Contour* > ( GetData() );
}
| vtkProp * mitk::ContourVtkMapper3D::GetVtkProp | ( | mitk::BaseRenderer * | renderer ) | [virtual] |
Implements mitk::VtkMapper3D.
Definition at line 71 of file mitkContourVtkMapper3D.cpp.
{
return m_Actor;
}
| static Pointer mitk::ContourVtkMapper3D::New | ( | ) | [static] |
vtkSmartPointer<vtkActor> mitk::ContourVtkMapper3D::m_Actor [protected] |
Definition at line 63 of file mitkContourVtkMapper3D.h.
Referenced by ContourVtkMapper3D().
vtkSmartPointer<vtkPolyData> mitk::ContourVtkMapper3D::m_Contour [protected] |
Definition at line 62 of file mitkContourVtkMapper3D.h.
vtkSmartPointer<vtkTubeFilter> mitk::ContourVtkMapper3D::m_TubeFilter [protected] |
Definition at line 59 of file mitkContourVtkMapper3D.h.
Referenced by ContourVtkMapper3D().
vtkSmartPointer<vtkAppendPolyData> mitk::ContourVtkMapper3D::m_VtkPointList [protected] |
Definition at line 61 of file mitkContourVtkMapper3D.h.
Referenced by ContourVtkMapper3D().
vtkSmartPointer<vtkPolyDataMapper> mitk::ContourVtkMapper3D::m_VtkPolyDataMapper [protected] |
Definition at line 58 of file mitkContourVtkMapper3D.h.
Referenced by ContourVtkMapper3D().
1.7.2