MCPcopy Create free account
hub / github.com/Kitware/VTK / InternalUpdate

Method InternalUpdate

Common/DataModel/vtkIterativeClosestPointTransform.cxx:244–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242//------------------------------------------------------------------------------
243
244void vtkIterativeClosestPointTransform::InternalUpdate()
245{
246 // Check source, target
247
248 if (this->Source == nullptr || !this->Source->GetNumberOfPoints())
249 {
250 vtkErrorMacro(<< "Can't execute with nullptr or empty input");
251 return;
252 }
253
254 if (this->Target == nullptr || !this->Target->GetNumberOfPoints())
255 {
256 vtkErrorMacro(<< "Can't execute with nullptr or empty target");
257 return;
258 }
259
260 // Create locator
261
262 this->CreateDefaultLocator();
263 this->Locator->SetDataSet(this->Target);
264 this->Locator->SetNumberOfCellsPerBucket(1);
265 this->Locator->BuildLocator();
266
267 // Create two sets of points to handle iteration
268
269 int step = 1;
270 if (this->Source->GetNumberOfPoints() > this->MaximumNumberOfLandmarks)
271 {
272 step = this->Source->GetNumberOfPoints() / this->MaximumNumberOfLandmarks;
273 vtkDebugMacro(<< "Landmarks step is now : " << step);
274 }
275
276 vtkIdType nb_points = this->Source->GetNumberOfPoints() / step;
277
278 // Allocate some points.
279 // - closestp is used so that the internal state of LandmarkTransform remains
280 // correct whenever the iteration process is stopped (hence its source
281 // and landmark points might be used in a vtkThinPlateSplineTransform).
282 // - points2 could have been avoided, but do not ask me why
283 // InternalTransformPoint is not working correctly on my computer when
284 // in and out are the same pointer.
285
286 vtkPoints* points1 = vtkPoints::New();
287 points1->SetNumberOfPoints(nb_points);
288
289 vtkPoints* closestp = vtkPoints::New();
290 closestp->SetNumberOfPoints(nb_points);
291
292 vtkPoints* points2 = vtkPoints::New();
293 points2->SetNumberOfPoints(nb_points);
294
295 // Fill with initial positions (sample dataset using step)
296
297 vtkTransform* accumulate = vtkTransform::New();
298 accumulate->PostMultiply();
299
300 vtkIdType i;
301 int j;

Callers

nothing calls this directly

Calls 15

CreateDefaultLocatorMethod · 0.95
DeleteMethod · 0.65
NewFunction · 0.50
sqrtFunction · 0.50
GetNumberOfPointsMethod · 0.45
SetDataSetMethod · 0.45
BuildLocatorMethod · 0.45
SetNumberOfPointsMethod · 0.45
GetPointMethod · 0.45
TranslateMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected