// I have a high resolution targetMesh:
1) Compute high resolution posterior model (with landmarks) and get highResPosteriorModel
2) Decimate the reference mesh of highResPosteriorModel and get a low res model:
val decimatedMesh = highResPosteriorModel.reference.operations.decimate(numberOfTargetedVertices)
val lowResModel = highResPosteriorModel.newReference(decimatedMesh, TriangleMeshInterpolator3D())
3) Get uniform points from the low res reference (as in
https://scalismo.org/docs/tutorials/tutorial11):
val sampler = UniformMeshSampler3D(lowResModel.reference, numberOfPoints = 5000)
val points : Seq[Point[_3D]] = sampler.sample.map(pointWithProbability => pointWithProbability._1)
val ptIds = points.map(point => lowResModel.reference.pointSet.findClosestPoint(point).id)
4) Non rigid icp with this low res model (output the mean and the posterior model). I changed the fitModel function in
https://scalismo.org/docs/tutorials/tutorial11 so that it outputs
the posterior.mean and the posterior model as well:
val finalFitAndPosteriorModel = nonrigidICP(lowResModel.mean, highResolutionTargetMesh, ptIds, 20)
val finalFit = finalFitAndPosteriorModel._1
val lastLowResPosteriorModel = finalFitAndPosteriorModel._2
5) Get the final coefficients of the mean of the low res posterior model:
val meanLowResCoeffs: DenseVector[Double] = lastLowResPosteriorModel.coefficients(lastLowResPosteriorModel.mean)
6) Here is where I am stuck as I don't know how to apply those coefficients to the high resolution mesh (either mean, sample or the reference)
// I tried this but I am to sure at all if this is correct
val highResMeshMean =
highResPosteriorModel.instance(meanLowResCoeffs) // The method instance needs a pdm but I don't know which one is to be used here ?
Also, in step 4, do I need to use a decimated targetMesh or keep the original high resolution mesh (highResolutionTargetMesh)?