Scalismo Course Femur Reconstruction Code

63 vues
Accéder directement au premier message non lu

Steven A

non lue,
8 mars 2022, 03:30:0708/03/2022
à scalismo
Considering I have paid for the Scalismo course, and apparently we are not allowed to ask questions pertaining to the most up to date code for Scalismo, is there any way that I could get an updated solution to the femur reconstruction project with current scalismo code as there is no longer any point in my participation for the scalismo course as I took it already several years ago, obtained the certificate, and working through the old femur reconstruction code is no longer valid with the new modifications to the libraries?

Marcel Luethi

non lue,
8 mars 2022, 04:19:1908/03/2022
à Steven A,scalismo
Hi Steven

Maybe there are a few points we should clarify here:

- The online course is (and was always) free. FutureLearn makes money by selling certificates, but there is no obligation to buy those. Furthermore, all the course material can also be accessed openly even from outside futurelean (https://gravis.dmi.unibas.ch/PMM/lectures/ssm_courseRun19/).
- The course on FutureLearn is not primarily about scalismo, but about shape modelling. Our primary goal is to help participants to understand the concepts behind shape modelling. Scalismo is used to enable participants to experiment with the concepts. Our hope is, that once the concepts are understood, translating them to newer Scalismo versions should be the smaller problem.
- The tutorials on scalismo.org are always updated to match the latest scalismo version. As they are very close to the original tutorials, it should be possible to translate the code from the course to the new version.  If at some point the translation should be difficult, feel free to ask here on the mailing list
- We have not, and will not, provide official solutions to the femur reconstruction project, as it is an ongoing challenge, in which every year many participants of the course take part.
- I did not tell you (on FutureLearn) that you cannot ask questions on Scalismo from IntelliJ, but only that you should ask these questions on the mailing list.  Feel free to post questions here and I will try my best to answer them. I would appreciate, however, if the questions address specific points you struggle with, as too open questions are very difficult to answer. If the questions are so open that I can only point you back to the tutorials, it will also not bring  you closer to your problem.

Best regards,

Marcel



On Tue, Mar 8, 2022 at 9:30 AM Steven A <steve...@gmail.com> wrote:
Considering I have paid for the Scalismo course, and apparently we are not allowed to ask questions pertaining to the most up to date code for Scalismo, is there any way that I could get an updated solution to the femur reconstruction project with current scalismo code as there is no longer any point in my participation for the scalismo course as I took it already several years ago, obtained the certificate, and working through the old femur reconstruction code is no longer valid with the new modifications to the libraries?

--
You received this message because you are subscribed to the Google Groups "scalismo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalismo+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalismo/79f06ab2-c588-430f-a3b4-8f9d15960eaen%40googlegroups.com.

Steven A

non lue,
8 mars 2022, 04:58:2008/03/2022
à scalismo
Ok, then my first question is, within the previous code that I got to help compare my code to, which no longer works because of similar problems the import function:
import scalismo.geometry.{Landmark, Point3D, Vector, _3D} no longer works because Vector is no longer available. Therefore, when I use the val gauss = GaussianProcess[_3D, Vector[_3D]](changepointkernel), I cannot generate the proper gaussian process. I do not understand whether I should now be using DiscreteLowRankGaussianProcess as in:  val faceGP : DiscreteLowRankGaussianProcess[_3D, TriangleMesh, EuclideanVector[_3D]] = faceModel.gp from the tutorial on Gaussian Processes or whether I should be using the process from Shape modelling with Gaussian kernels:
val gp = GaussianProcess3D[EuclideanVector[_3D]](zeroMean, matrixValuedGaussianKernel) to build it, in which case, why is it necessary to start with a zeromean gaussian kernel?

Also, within this code:
def doRegistration(
lowRankGP: LowRankGaussianProcess[_3D, EuclideanVector[_3D]],
referenceMesh: TriangleMesh[_3D],
targetmesh: TriangleMesh[_3D],
registrationParameters: RegistrationParameters,
initialCoefficients: DenseVector[Double]
): DenseVector[Double] = {
val transformationSpace = GaussianProcessTransformationSpace(lowRankGP)
val fixedImage = referenceMesh.operations.toDistanceImage
val movingImage = targetMesh.operations.toDistanceImage
val sampler = FixedPointsUniformMeshSampler3D(
referenceMesh,
registrationParameters.numberOfSampledPoints
)
val metric = MeanSquaresMetric(
fixedImage,
movingImage,
transformationSpace,
sampler
)
val optimizer = LBFGSOptimizer(registrationParameters.numberOfIterations)
val regularizer = L2Regularizer(transformationSpace)
val registration = Registration(
metric,
regularizer,
registrationParameters.regularizationWeight,
optimizer
)
val registrationIterator = registration.iterator(initialCoefficients)
val visualizingRegistrationIterator = for ((it, itnum) <- registrationIterator.zipWithIndex) yield {
println(s"object value in iteration $itnum is ${it.value}")
it
}
val registrationResult = visualizingRegistrationIterator.toSeq.last
registrationResult.parameters
} 
Is the registrationResult value the registered triangle mesh from the Parametric, non-rigid registration tutorial? if so, how do I get the triangle mesh from this in orer to save the non-rigid registered sample from this line: val finalCoefficients = registrationParameters.foldLeft(initialCoefficients)((modelCoefficients, regParameters) =>
doRegistration(lowRankGP, referenceMesh, targetMesh, regParameters, modelCoefficients)
)?
Is this how you would actually run the registration?
for ((targetMeshFile, targetMesh, targetLandmarkFile, targetLandmarks) <- meshAndLandmarkPairs) {

println("registering mesh " + targetMeshFile.getName)
ui.find[TriangleMeshView](targetGroup, (tv : TriangleMeshView) => true).foreach(v => v.remove())
val targetView = ui.show(targetGroup, targetMesh, "target")
targetView.color = Color.RED

val pointPairsForPosterior = for ((refLm, targetLm) <- referenceLandmarks.zip(targetLandmarks)) yield {
(refLm.point, targetLm.point - refLm.point)
}
val posteriorGP = lowRankGP.posterior(pointPairsForPosterior.toIndexedSeq, sigma2 = 9.0)
val initialCoefficients = DenseVector.zeros[Double](lowRankGP.rank)

val registrationParameters = Seq(
RegistrationParameters(regularizationWeight = 1e-1, numberOfIterations = 20, numberOfSampledPoints = 1000),
RegistrationParameters(regularizationWeight = 1e-2, numberOfIterations = 30, numberOfSampledPoints = 1000),
RegistrationParameters(regularizationWeight = 1e-4, numberOfIterations = 40, numberOfSampledPoints = 2000),
RegistrationParameters(regularizationWeight = 1e-6, numberOfIterations = 50, numberOfSampledPoints = 4000)
)

val registeredMesh = doRegistration(posteriorGP, referenceMesh, targetMesh, registrationParameters, iniitalcoefs)

MeshIO.writeMesh(registeredMesh, new File(outputMeshDir, targetMeshFile.getName))
}

Marcel Luethi

non lue,
8 mars 2022, 08:15:4708/03/2022
à Steven A,scalismo
Hi Steven

If I understand your email correctly, you are trying to perform a registration.
Tutorial 12 provides you with functioning code (which you can download as an scala file). If you also download the corresponding data (https://drive.switch.ch/index.php/s/zOJDpqh2ZGxzJJH) and run the code, you will see how the registration proceeds. I would advice you to read the corresponding tutorial to get a sense what the code is doing and then replace the face with your own dataset.

Best regards,
Marcel

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message