Exemplo n.º 1
0
  /**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
  void setUp() override
  {
    //generate two sets of points
    m_PointsOne = vtkSmartPointer<vtkPoints>::New();
    m_PointsOne->InsertNextPoint( 0.0, 0.0, 0.0 );
    m_PointsOne->InsertNextPoint( 1.0, 0.0, 0.0 );
    m_PointsOne->InsertNextPoint( 0.0, 1.0, 0.0 );
    m_PointsOne->InsertNextPoint( 1.0, 1.0, 0.0 );

    m_PointsTwo = vtkSmartPointer<vtkPoints>::New();
    m_PointsTwo->InsertNextPoint( 0.0, 0.0, 0.0 );
    m_PointsTwo->InsertNextPoint( 0.0, 0.0, 2.0 );
    m_PointsTwo->InsertNextPoint( 0.0, 1.0, 0.0 );
    m_PointsTwo->InsertNextPoint( 0.0, 1.0, 2.0 );

    //generate two polygons
    vtkSmartPointer<vtkPolygon> polygonOne = vtkSmartPointer<vtkPolygon>::New();
    polygonOne->GetPointIds()->SetNumberOfIds(4);
    polygonOne->GetPointIds()->SetId(0,0);
    polygonOne->GetPointIds()->SetId(1,1);
    polygonOne->GetPointIds()->SetId(2,2);
    polygonOne->GetPointIds()->SetId(3,3);

    vtkSmartPointer<vtkPolygon> polygonTwo = vtkSmartPointer<vtkPolygon>::New();
    polygonTwo->GetPointIds()->SetNumberOfIds(4);
    polygonTwo->GetPointIds()->SetId(0,3);
    polygonTwo->GetPointIds()->SetId(1,2);
    polygonTwo->GetPointIds()->SetId(2,0);
    polygonTwo->GetPointIds()->SetId(3,1);

    //generate polydatas
    vtkSmartPointer<vtkCellArray> polygonArrayOne = vtkSmartPointer<vtkCellArray>::New();
    polygonArrayOne->InsertNextCell(polygonOne);

    m_PolyDataOne = vtkSmartPointer<vtkPolyData>::New();
    m_PolyDataOne->SetPoints(m_PointsOne);
    m_PolyDataOne->SetPolys(polygonArrayOne);

    m_PolygonArrayTwo = vtkSmartPointer<vtkCellArray>::New();
    m_PolygonArrayTwo->InsertNextCell(polygonTwo);

    vtkSmartPointer<vtkPolyData> polyDataTwo = vtkSmartPointer<vtkPolyData>::New();
    polyDataTwo->SetPoints(m_PointsOne);
    polyDataTwo->SetPolys(m_PolygonArrayTwo);

    //generate surfaces
    m_Surface3D = mitk::Surface::New();
    m_Surface3D->SetVtkPolyData( m_PolyDataOne );

    m_Surface3DTwoTimeSteps = mitk::Surface::New();
    m_Surface3DTwoTimeSteps->SetVtkPolyData( m_PolyDataOne, 0 );
    m_Surface3DTwoTimeSteps->SetVtkPolyData( polyDataTwo, 1 );
  }