当前位置: 首页>>代码示例>>C++>>正文


C++ Pointer::GetVtkPolyData方法代码示例

本文整理汇总了C++中mitk::surface::Pointer::GetVtkPolyData方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetVtkPolyData方法的具体用法?C++ Pointer::GetVtkPolyData怎么用?C++ Pointer::GetVtkPolyData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mitk::surface::Pointer的用法示例。


在下文中一共展示了Pointer::GetVtkPolyData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateContourPositionInformation

mitk::SurfaceInterpolationController::ContourPositionInformation CreateContourPositionInformation(mitk::Surface::Pointer contour)
{
  mitk::SurfaceInterpolationController::ContourPositionInformation contourInfo;
  contourInfo.contour = contour;
  double n[3];
  double p[3];
  contour->GetVtkPolyData()->GetPoints()->GetPoint(0, p);
  vtkPolygon::ComputeNormal(contour->GetVtkPolyData()->GetPoints(), n);
  contourInfo.contourNormal = n;
  contourInfo.contourPoint = p;
  return contourInfo;
}
开发者ID:DiagnosisMultisystems,项目名称:MITK,代码行数:12,代码来源:mitkSurfaceInterpolationController.cpp

示例2:

mitk::Surface::Pointer mitk::SurfaceModifier::DeepCopy(mitk::Surface::Pointer originalSurface)
  {
  mitk::Surface::Pointer clonedSurface = mitk::Surface::New();
  vtkSmartPointer<vtkPolyData> clonedPolyData = vtkPolyData::New();
  clonedPolyData->DeepCopy(originalSurface->GetVtkPolyData());
  clonedSurface->SetVtkPolyData(clonedPolyData);
  return clonedSurface;
  }
开发者ID:zomboir,项目名称:MITK,代码行数:8,代码来源:mitkSurfaceModifier.cpp

示例3: CompareSurfacePointPositions

bool CompareSurfacePointPositions(mitk::Surface::Pointer s1, mitk::Surface::Pointer s2)
{
  vtkPoints* p1 = s1->GetVtkPolyData()->GetPoints();
  vtkPoints* p2 = s2->GetVtkPolyData()->GetPoints();

  if(p1->GetNumberOfPoints() != p2->GetNumberOfPoints())
    return false;

  for(int i = 0; i < p1->GetNumberOfPoints(); ++i)
  {
    if(p1->GetPoint(i)[0] != p2->GetPoint(i)[0] ||
      p1->GetPoint(i)[1] != p2->GetPoint(i)[1] ||
      p1->GetPoint(i)[2] != p2->GetPoint(i)[2] )
    {
      return true;
    }
  }
  return false;
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:19,代码来源:mitkImageToSurfaceFilterTest.cpp

示例4: PerturbePoint

bool mitk::SurfaceModifier::PerturbeSurface(mitk::Surface::Pointer surface, double varianceX, double varianceY, double varianceZ, double maxNoiseVectorLenght)
  {
  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
  points->ShallowCopy(surface->GetVtkPolyData()->GetPoints());
  for(unsigned int i = 0; i < points->GetNumberOfPoints(); i++)
    {
    double p[3];
    points->GetPoint(i, p);
    mitk::Point3D point;
    point[0] = p[0];
    point[1] = p[1];
    point[2] = p[2];
    point = PerturbePoint(point,varianceX,varianceY,varianceZ,maxNoiseVectorLenght);
    p[0] = point[0];
    p[1] = point[1];
    p[2] = point[2];
    points->SetPoint(i, p);
    }
  surface->GetVtkPolyData()->SetPoints(points);

  return true;
  }
开发者ID:zomboir,项目名称:MITK,代码行数:22,代码来源:mitkSurfaceModifier.cpp

示例5: TransformPoint

bool mitk::SurfaceModifier::TransformSurface(mitk::Surface::Pointer surface, itk::Matrix<double,3,3> TransformationR, itk::Vector<double,3> TransformationT)
  {
  //apply transformation
  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
  points->ShallowCopy(surface->GetVtkPolyData()->GetPoints());

  for(unsigned int i = 0; i < points->GetNumberOfPoints(); i++)
    {
    double p[3];
    points->GetPoint(i, p);
    mitk::Point3D point;
    point[0] = p[0];
    point[1] = p[1];
    point[2] = p[2];
    point = TransformPoint(point,TransformationR,TransformationT);
    p[0] = point[0];
    p[1] = point[1];
    p[2] = point[2];
    points->SetPoint(i, p);
    }
  surface->GetVtkPolyData()->SetPoints(points);

  return true;
  }
开发者ID:zomboir,项目名称:MITK,代码行数:24,代码来源:mitkSurfaceModifier.cpp

示例6: count

void mitk::SurfaceInterpolationController::ReinitializeInterpolation(mitk::Surface::Pointer contours)
{
  // 1. detect coplanar contours
  // 2. merge coplanar contours into a single surface
  // 4. add contour to pipeline

  // Split the surface into separate polygons
  vtkSmartPointer<vtkCellArray> existingPolys;
  vtkSmartPointer<vtkPoints> existingPoints;
  existingPolys = contours->GetVtkPolyData()->GetPolys();
  existingPoints = contours->GetVtkPolyData()->GetPoints();
  existingPolys->InitTraversal();

  vtkSmartPointer<vtkIdList> ids = vtkSmartPointer<vtkIdList>::New();

  typedef std::pair<mitk::Vector3D, mitk::Point3D> PointNormalPair;
  std::vector<ContourPositionInformation> list;
  std::vector<vtkSmartPointer<vtkPoints> > pointsList;
  int count (0);
  for( existingPolys->InitTraversal(); existingPolys->GetNextCell(ids);)
  {
    // Get the points
    vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
    existingPoints->GetPoints(ids, points);
    ++count;
    pointsList.push_back(points);


    PointNormalPair p_n;
    double n[3];
    vtkPolygon::ComputeNormal(points, n);
    p_n.first = n;
    double p[3];

    existingPoints->GetPoint(ids->GetId(0), p);
    p_n.second = p;

    ContourPositionInformation p_info;
    p_info.contourNormal = n;
    p_info.contourPoint = p;
    list.push_back(p_info);
    continue;
  }

  // Detect and sort coplanar polygons
  auto outer = list.begin();
  std::vector< std::vector< vtkSmartPointer<vtkPoints> > > relatedPoints;
  while (outer != list.end())
  {
    auto inner = outer;
    ++inner;
    std::vector< vtkSmartPointer<vtkPoints> > rel;
    auto pointsIter = pointsList.begin();
    rel.push_back((*pointsIter));
    pointsIter = pointsList.erase(pointsIter);

    while (inner != list.end())
    {
      if(ContoursCoplanar((*outer),(*inner)))
      {
        inner = list.erase(inner);
        rel.push_back((*pointsIter));
        pointsIter = pointsList.erase(pointsIter);
      }
      else
      {
        ++inner;
        ++pointsIter;
      }
    }
    relatedPoints.push_back(rel);
    ++outer;
  }

  // Build the separate surfaces again
  std::vector<mitk::Surface::Pointer> finalSurfaces;
  for (unsigned int i = 0; i < relatedPoints.size(); ++i)
  {
    vtkSmartPointer<vtkPolyData> contourSurface = vtkSmartPointer<vtkPolyData>::New();
    vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
    vtkSmartPointer<vtkCellArray> polygons = vtkSmartPointer<vtkCellArray>::New();
    unsigned int pointId (0);
    for (unsigned int j = 0; j < relatedPoints.at(i).size(); ++j)
    {
      unsigned int numPoints = relatedPoints.at(i).at(j)->GetNumberOfPoints();
      vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();
      polygon->GetPointIds()->SetNumberOfIds(numPoints);
      polygon->GetPoints()->SetNumberOfPoints(numPoints);
      vtkSmartPointer<vtkPoints> currentPoints = relatedPoints.at(i).at(j);
      for (unsigned k = 0; k < numPoints; ++k)
      {
        points->InsertPoint(pointId, currentPoints->GetPoint(k));
        polygon->GetPointIds()->SetId(k, pointId);
        ++pointId;
      }
      polygons->InsertNextCell(polygon);
    }
    contourSurface->SetPoints(points);
    contourSurface->SetPolys(polygons);
    contourSurface->BuildLinks();
//.........这里部分代码省略.........
开发者ID:DiagnosisMultisystems,项目名称:MITK,代码行数:101,代码来源:mitkSurfaceInterpolationController.cpp


注:本文中的mitk::surface::Pointer::GetVtkPolyData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。