Model fitting, acces at the coefficient value

63 views
Skip to first unread message

Cedric Hemom

unread,
Aug 10, 2021, 5:55:59 AMAug 10
to scalismo
Hi,
I use my SSM to the model fitting and I want to know the coefficient assigned by the gp.posterior method.
I can't figure out how I can access the coefficient values of the modes in my gp.

Thanks for your help.
Sincerely,
Cedric.

Marcel Luethi

unread,
Aug 10, 2021, 6:39:10 AMAug 10
to Cedric Hemom, scalismo
HI Cedric

The mode (singular) of your posterior has the coefficients (0, ... 0). The posterior is a Gaussian distribution and therefore has only one mode.

In general, you can access the coefficient of any sample of your posterior, by using the coefficients method of the GP as follows:
val posterior: PointDistributionModel[_3D, TriangleMesh] = ???
val sample: TriangleMesh[_3D] = posterior.sample()
val coeffs = posterior.coefficients(sample)

Best regards

Marcel

--
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/c83c6ca8-a878-4632-aeab-9b24f2c2821an%40googlegroups.com.

Cedric Hemom

unread,
Aug 10, 2021, 10:19:55 AMAug 10
to scalismo
Ah ok,
I would like to use the modes of my SSM to fit the other meshes. I don't know if such a solution is possible in scalismo. 
My goal is to know the coefficients on the modes assigned for each mesh to use them as ground truth.

Thank you for your answer.
Sincerely,
Cedric.

Marcel Luethi

unread,
Aug 11, 2021, 3:01:00 AMAug 11
to Cedric Hemom, scalismo
Dear Cedric

Maybe I am not exactly understanding your question. Do you mean by modes the point of the distribution with maximum probability or are you referring to the modes of variation?
I assumed the first in my last answer.
If you mean the latter, you can use the posterior distribution that you obtain from the Gaussian process regression in place of your initial model. It is a Gaussian process model  itself and so can be used as a drop in replacement in any place where a model is required.

Best regards,

Marcel

Cedric Hemom

unread,
Aug 11, 2021, 5:22:34 AMAug 11
to scalismo
I was referring to the modes of variation. The problem is that once I have built my SSM from the mapped data, I would like to find the coefficients on the modes of variation to reconstruct the shapes of my dataset. 
I don't know if this optimization is present in scalismo. Unfortunately I have to keep my initial model and I cannot use each time the new model obtained from the gaussian process.

Thanks for your help.
Sincerely,
Cédric.

Marcel Luethi

unread,
Aug 11, 2021, 1:52:38 PMAug 11
to Cedric Hemom, scalismo
Dear Cedric,

Yes, this is possible. As the data is in correspondence, you can use the coefficients method on the dataset:
val model : PointDistributionModel[_3D, TriangleMesh] = ???
val mesh : TriangleMesh[_3D] = ???

val coeffs = model.coefficients(mesh)
model.instance(coeffs) // should reproduce the mesh

Best regards,

Marcel

Cedric Hemom

unread,
Aug 13, 2021, 4:31:42 AMAug 13
to scalismo
Ok , Thank you very much.
I will try this method.

Sincerely,
Cedric.

Cedric Hemom

unread,
Aug 18, 2021, 10:28:49 AMAug 18
to scalismo
Is it possible to change the mean of the an SSM from scalismo?
I need to change the mean shape by applying just a rigid transformation but keep the original deformation field.

Marcel Luethi

unread,
Aug 19, 2021, 2:51:00 AMAug 19
to Cedric Hemom, scalismo
Hi Cedric,

Yes this is possible by changing the underlying reference mesh. You can do it as follows:
val pdm : PointDistributionModel[_3D, TriangleMesh] = ???
val newReferenceMesh : TriangleMesh[_3D] = ???
val pdmWithNewMean = pdm.newReference(newReferenceMesh, TriangleMeshInterpolator3D())

This will not only change the reference mesh, but also adjust the mean such that the represented distribution remains the same.
Best regards, 

Marcel

Cedric Hemom

unread,
Aug 19, 2021, 4:06:27 AMAug 19
to scalismo
It works but it is not perfect. I tried using the changeReference function and applying a rigid transformation and I can't change the mean shape. 
I don't know if there is a function that can directly change just the mean shape because the newReference function gives me approximate results.

Andreas Morel-Forster

unread,
Aug 19, 2021, 10:30:04 AMAug 19
to scal...@googlegroups.com

Hi Cedric

I am not sure, but maybe you are looking for the pdm.transform( ... ) function. This will move your PDM in space to a different location while keeping the statistical shape space the same. You should then observe the same mean shape at a different location in space.

The method newReference instead only changes the reference, i.e. the domain on which the PDM is defined. This method could be used if you want to remesh your reference and transfer the statistical shape space to your new remeshed reference/domain.

Best, Andreas

Cedric Hemom

unread,
Aug 19, 2021, 11:36:10 AMAug 19
to scalismo
Thanks for the explanation of the newReference method.
I misread the documentation and did not see that the transform method was defined for the PDM class.
Sorry, for this waste of time and thank you very much always for your quick help.

Best, 
Cedric.
Reply all
Reply to author
Forward
0 new messages