| 37 | } |
| 38 | |
| 39 | void mitk::PointLocator::SetPoints(vtkPointSet *pointSet) |
| 40 | { |
| 41 | if (pointSet == nullptr) |
| 42 | { |
| 43 | itkWarningMacro("Points are nullptr!"); |
| 44 | return; |
| 45 | } |
| 46 | vtkPoints *points = pointSet->GetPoints(); |
| 47 | |
| 48 | if (m_VtkPoints) |
| 49 | { |
| 50 | if ((m_VtkPoints == points) && (m_VtkPoints->GetMTime() == points->GetMTime())) |
| 51 | { |
| 52 | return; // no need to recalculate search tree |
| 53 | } |
| 54 | } |
| 55 | m_VtkPoints = points; |
| 56 | |
| 57 | size_t size = points->GetNumberOfPoints(); |
| 58 | if (m_ANNDataPoints != nullptr) |
| 59 | delete[] m_ANNDataPoints; |
| 60 | m_ANNDataPoints = annAllocPts(size, m_ANNDimension); |
| 61 | m_IndexToPointIdContainer.clear(); |
| 62 | m_IndexToPointIdContainer.resize(size); |
| 63 | for (vtkIdType i = 0; (unsigned)i < size; ++i) |
| 64 | { |
| 65 | double *currentPoint = points->GetPoint(i); |
| 66 | (m_ANNDataPoints[i])[0] = currentPoint[0]; |
| 67 | (m_ANNDataPoints[i])[1] = currentPoint[1]; |
| 68 | (m_ANNDataPoints[i])[2] = currentPoint[2]; |
| 69 | m_IndexToPointIdContainer[i] = i; |
| 70 | } |
| 71 | InitANN(); |
| 72 | } |
| 73 | |
| 74 | void mitk::PointLocator::SetPoints(mitk::PointSet *points) |
| 75 | { |
no test coverage detected