Skip to content

Commit 8b7d3d4

Browse files
hjmjohnsonSunderlandkyl
authored andcommitted
Add explicit vnl fixed-to-dynamic conversions for VXL 2026 / ITK 6
Recent VXL (as vendored by ITK 6) removed the implicit conversions from vnl_matrix_fixed / vnl_vector_fixed to vnl_matrix / vnl_vector, and changed the type returned by member accessors. Add explicit .as_matrix()/.as_vector() conversions in the probe-calibration algorithms, and construct vnl_svd from an .as_matrix() view. These accessors also exist in the ITK release-5.4 VNL, so the change is backward compatible.
1 parent 30ef102 commit 8b7d3d4

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/PlusCalibration/vtkProbeCalibrationAlgo/vtkPlusProbeCalibrationAlgo.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ PlusStatus vtkPlusProbeCalibrationAlgo::AddPositionsPerImage(igsioTrackedFrame*
495495

496496
{
497497
// Compute middle point position in probe frame
498-
vnl_vector<double> middleWireIntersectionPointPos_Probe = phantomToProbeTransformMatrix * middleWireIntersectionPointPos_Phantom;
498+
vnl_vector<double> middleWireIntersectionPointPos_Probe = (phantomToProbeTransformMatrix * middleWireIntersectionPointPos_Phantom).as_vector();
499499

500500
LOG_DEBUG(" Middle wire position in probe frame = " << middleWireIntersectionPointPos_Probe);
501501

src/PlusCalibration/vtkProbeCalibrationAlgo/vtkPlusProbeCalibrationOptimizerAlgo.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class DistanceToWiresCostFunction : public itk::SingleValuedCostFunction
6262

6363
auto rigidTransform=RigidTransformType::New();
6464
rigidTransform->SetParameters(imageToProbeTransformParameters);
65-
imageToProbeTransform_vnl.update(rigidTransform->GetMatrix().GetVnlMatrix());
65+
imageToProbeTransform_vnl.update(rigidTransform->GetMatrix().GetVnlMatrix().as_matrix());
6666
imageToProbeTransform_vnl.put(0,3,rigidTransform->GetOffset()[0]);
6767
imageToProbeTransform_vnl.put(1,3,rigidTransform->GetOffset()[1]);
6868
imageToProbeTransform_vnl.put(2,3,rigidTransform->GetOffset()[2]);
@@ -95,7 +95,7 @@ class DistanceToWiresCostFunction : public itk::SingleValuedCostFunction
9595

9696
// Decompose the initial calibration matrix to an orthogonal transformation matrix, scaling vector, and translation vector
9797
vnl_matrix_fixed<double,3,3> rotationMatrix= imageToProbeTransform_vnl.extract(3,3);
98-
vnl_svd<double> svd(rotationMatrix);
98+
vnl_svd<double> svd(rotationMatrix.as_matrix());
9999
itk::Matrix<double,3,3> orthogonalizedRotationMatrix;
100100
orthogonalizedRotationMatrix = svd.U() * svd.V().transpose();
101101
double scale[3] = { svd.W(0), svd.W(1), svd.W(2) };
@@ -202,15 +202,15 @@ PlusStatus vtkPlusProbeCalibrationOptimizerAlgo::ShowTransformation(const vnl_ma
202202
LOG_INFO("Translation = [" << imageToProbeTransformationMatrix.get(0,3) << " " << imageToProbeTransformationMatrix.get(1,3) << " " << imageToProbeTransformationMatrix.get(2,3) << " ]");
203203

204204
vnl_matrix_fixed<double,3,3> rotationMatrix=imageToProbeTransformationMatrix.extract(3,3);
205-
vnl_svd<double> svd(rotationMatrix);
205+
vnl_svd<double> svd(rotationMatrix.as_matrix());
206206
vnl_matrix<double> orthogonalizedRotationMatrix;
207207
orthogonalizedRotationMatrix = svd.U() * svd.V().transpose();
208208
double scale[3] = { svd.W(0), svd.W(1), svd.W(2) };
209209
LOG_INFO("Scale = [" << scale[0] << " " << scale[1] << " " << scale[2] << " ]");
210210

211-
vnl_vector<double> xAxis=imageToProbeTransformationMatrix.get_column(0);
211+
vnl_vector<double> xAxis=imageToProbeTransformationMatrix.get_column(0).as_vector();
212212
xAxis.normalize();
213-
vnl_vector<double> yAxis=imageToProbeTransformationMatrix.get_column(1);
213+
vnl_vector<double> yAxis=imageToProbeTransformationMatrix.get_column(1).as_vector();
214214
yAxis.normalize();
215215
double xyAxesAngleDeg=vtkMath::DegreesFromRadians(acos(dot_product(xAxis,yAxis)));
216216
LOG_INFO("XY axes angle = " << xyAxesAngleDeg << " deg");

0 commit comments

Comments
 (0)