Hi everyone,
I’m trying to make this example work with 3D pointsets.
I’m using the same methods as the example (AffineTransform, JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4, RegistrationParameterScalesFromPhysicalShift and GradientDescentOptimizerv4)
However, it seems like the optimization doesn’t converge towards a reasonable solution. I would appreciate any thoughts or ideas about what could be causing this issue.
Here are my input data : fix in blue, moving in yellow
And the output : fix in blue, registered moving data in red
The inputs I have are vtkPolyData, so I first create an itk pointset from the polydata using this simple method:
vtkPoints* points = polyData->GetPoints();
PointSetType::Pointer mesh = PointSetType::New();
mesh->Initialize();
for (unsigned int i = 0; i < points->GetNumberOfPoints(); ++i) {
mesh->SetPoint(i, points->GetPoint(i));
}
The parameters for the metric:
using PointSetMetricType = itk::JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4<PointSetType>;
PointSetMetricType::Pointer metric = PointSetMetricType::New();
metric->SetFixedPointSet(fixedPoints);
metric->SetMovingPointSet(movingPoints);
metric->SetMovingTransform(transform);
metric->SetPointSetSigma(1.0);
metric->SetUseAnisotropicCovariances(false);
metric->SetEvaluationKNeighborhood(50);
metric->SetCovarianceKNeighborhood(5);
metric->SetKernelSigma(10.0);
metric->SetAlpha(1.1);
metric->Initialize();
And for the optimizer:
using OptimizerType = itk::GradientDescentOptimizerv4;
OptimizerType::Pointer optimizer = OptimizerType::New();
optimizer->SetMetric(metric);
optimizer->SetNumberOfIterations(10);
optimizer->SetScalesEstimator(shiftScaleEstimator);
optimizer->SetMaximumStepSizeInPhysicalUnits(3.0);
optimizer->SetConvergenceWindowSize(10);
optimizer->StartOptimization();