本文整理汇总了C++中PointType::copy_in方法的典型用法代码示例。如果您正苦于以下问题:C++ PointType::copy_in方法的具体用法?C++ PointType::copy_in怎么用?C++ PointType::copy_in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointType
的用法示例。
在下文中一共展示了PointType::copy_in方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cell
void mitk::CreateDistanceImageFromSurfaceFilter::CreateSolutionMatrixAndFunctionValues()
{
unsigned int numberOfInputs = this->GetNumberOfInputs();
if (numberOfInputs == 0)
{
MITK_ERROR << "mitk::CreateDistanceImageFromSurfaceFilter: No input available. Please set an input!" << std::endl;
itkExceptionMacro("mitk::CreateDistanceImageFromSurfaceFilter: No input available. Please set an input!");
return;
}
//First of all we have to extract the nomals and the surface points.
//Duplicated points can be eliminated
Surface* currentSurface;
vtkSmartPointer<vtkPolyData> polyData;
vtkSmartPointer<vtkDoubleArray> currentCellNormals;
vtkSmartPointer<vtkCellArray> existingPolys;
vtkSmartPointer<vtkPoints> existingPoints;
double p[3];
PointType currentPoint;
PointType normal;
for (unsigned int i = 0; i < numberOfInputs; i++)
{
currentSurface = const_cast<Surface*>( this->GetInput(i) );
polyData = currentSurface->GetVtkPolyData();
if (polyData->GetNumberOfPolys() == 0)
{
MITK_INFO << "mitk::CreateDistanceImageFromSurfaceFilter: No input-polygons available. Please be sure the input surface consists of polygons!" << std::endl;
}
currentCellNormals = vtkDoubleArray::SafeDownCast(polyData->GetCellData()->GetNormals());
existingPolys = polyData->GetPolys();
existingPoints = polyData->GetPoints();
existingPolys->InitTraversal();
vtkIdType* cell (NULL);
vtkIdType cellSize (0);
for( existingPolys->InitTraversal(); existingPolys->GetNextCell(cellSize, cell);)
{
for ( unsigned int j = 0; j < cellSize; j++ )
{
existingPoints->GetPoint(cell[j], p);
currentPoint.copy_in(p);
int count = std::count(m_Centers.begin() ,m_Centers.end(),currentPoint);
if (count == 0)
{
double currentNormal[3];
currentCellNormals->GetTuple(cell[j], currentNormal);
normal.copy_in(currentNormal);
m_Normals.push_back(normal);
m_Centers.push_back(currentPoint);
}
}//end for all points
}//end for all cells
}//end for all outputs
//For we can now calculate the exact size of the centers we initialize the data structures
unsigned int numberOfCenters = m_Centers.size();
m_Centers.reserve(numberOfCenters*3);
m_FunctionValues.set_size(numberOfCenters*3);
m_FunctionValues.fill(0);
//Create inner points
for (unsigned int i = 0; i < numberOfCenters; i++)
{
currentPoint = m_Centers.at(i);
normal = m_Normals.at(i);
currentPoint[0] = currentPoint[0] - normal[0];
currentPoint[1] = currentPoint[1] - normal[1];
currentPoint[2] = currentPoint[2] - normal[2];
m_Centers.push_back(currentPoint);
m_FunctionValues.put(numberOfCenters+i, -1);
}
//Create outer points
for (unsigned int i = 0; i < numberOfCenters; i++)
{
currentPoint = m_Centers.at(i);
normal = m_Normals.at(i);
currentPoint[0] = currentPoint[0] + normal[0];
//.........这里部分代码省略.........
示例2: cell
void mitk::CreateDistanceImageFromSurfaceFilter::PreprocessContourPoints()
{
unsigned int numberOfInputs = this->GetNumberOfIndexedInputs();
if (numberOfInputs == 0)
{
MITK_ERROR << "mitk::CreateDistanceImageFromSurfaceFilter: No input available. Please set an input!" << std::endl;
itkExceptionMacro("mitk::CreateDistanceImageFromSurfaceFilter: No input available. Please set an input!");
return;
}
//First of all we have to extract the nomals and the surface points.
//Duplicated points can be eliminated
Surface* currentSurface;
vtkSmartPointer<vtkPolyData> polyData;
vtkSmartPointer<vtkDoubleArray> currentCellNormals;
vtkSmartPointer<vtkCellArray> existingPolys;
vtkSmartPointer<vtkPoints> existingPoints;
double p[3];
PointType currentPoint;
PointType normal;
for (unsigned int i = 0; i < numberOfInputs; i++)
{
currentSurface = const_cast<Surface*>( this->GetInput(i) );
polyData = currentSurface->GetVtkPolyData();
if (polyData->GetNumberOfPolys() == 0)
{
MITK_INFO << "mitk::CreateDistanceImageFromSurfaceFilter: No input-polygons available. Please be sure the input surface consists of polygons!" << std::endl;
}
currentCellNormals = vtkDoubleArray::SafeDownCast(polyData->GetCellData()->GetNormals());
existingPolys = polyData->GetPolys();
existingPoints = polyData->GetPoints();
existingPolys->InitTraversal();
vtkIdType* cell (nullptr);
vtkIdType cellSize (0);
for( existingPolys->InitTraversal(); existingPolys->GetNextCell(cellSize, cell);)
{
for ( vtkIdType j = 0; j < cellSize; j++ )
{
existingPoints->GetPoint(cell[j], p);
currentPoint.copy_in(p);
int count = std::count(m_Centers.begin() ,m_Centers.end(),currentPoint);
if (count == 0)
{
double currentNormal[3];
currentCellNormals->GetTuple(cell[j], currentNormal);
normal.copy_in(currentNormal);
m_Normals.push_back(normal);
m_Centers.push_back(currentPoint);
}
}//end for all points
}//end for all cells
}//end for all outputs
}