# create a statistical mesh model

43 views

### Michela Bisighini

Jan 6, 2021, 11:55:25 AMJan 6
to scalismo
Hi,I'm Michela and I'm working with ScalismoLab on a set of sockets.
I have some problems on creating the model. I would like to create a model that have higher deformations on the apex and on the posterior area of the socket.
I suppose that I need to use the changepoint Kernel but I don't know which matrices give in input to the function and how to modify this code in order to modify the deformation field only in the regions of interest.
I have used this code:
val zeroMean = VectorField(RealSpace[_3D], (pt:Point[_3D]) => Vector(0,0,0))
val kernelXYDirection = GaussianKernel[_3D](200) * 80 + GaussianKernel[_3D](100) * 20
val kernelZDirection = GaussianKernel[_3D](800) * 800 + GaussianKernel[_3D](400) * 1600
val matrixVauedGaussian = DiagonalKernel(kernelXYDirection, kernelXYDirection, kernelZDirection)

case class LinearKernel() extends PDKernel[_3D] {
override def domain = RealSpace[_3D]
override def k(x: Point[_3D], y: Point[_3D]) = {
x.toVector dot y.toVector
}
}

val linearPDKernel = new LinearKernel() * 0.01
val simLinear=DiagonalKernel(linearPDKernel)

case class ChangePointKernel(ker1 :MatrixValuedPDKernel[_3D, _3D], ker2 :MatrixValuedPDKernel[_3D, _3D]) extends MatrixValuedPDKernel[_3D, _3D] {

def s(p: Point[_3D]) =  1f / (1f + math.exp(-p(0)))

def k(x: Point[_3D], y: Point[_3D]) = {
val sx = s(x)
val sy = s(y)
ker1(x,y) * sx * sy + ker2(x,y) * (1-sx) * (1-sy)
}
override def domain = RealSpace[_3D]
}
val chgptKer = ChangePointKernel(matrixVauedGaussian,  simLinear)

//I build GP
val gp : GaussianProcess[_3D, _3D] = GaussianProcess(zeroMean, chgptKer)

I have tryed other type of kernels but I don't obtain a good fit when I fit the model created with the target. Do you have some ideas for building the model?
Best regards
Michela

Jan 6, 2021, 12:43:33 PMJan 6
to Michela Bisighini, scalismo
Hi Michela,
Have you tried locating some landmarks and accordingly constructing a posterior GP?

regards,

--
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.

### Michela Bisighini

Jan 7, 2021, 9:25:26 AMJan 7
to scalismo
Thanks, i hadn't thought about it. I managed to create a posterior model based on 1 marker, but I'm not able to create a posterior model that considers all my landmarks.
I think that I need to modify this party of the code but I'm not able to generate 200 points around all my markers.

val landmarksModel = LandmarkIO.readLandmarksJson[_3D](new File("datasets/reference invasature/LM_reference.json")).get
val pointIds = landmarksModel.map{l => model.mean.findClosestPoint(l.point).id}.toIndexedSeq
val tipMarginal = model.marginal(pointIds)
val tips = (0 to 200).map(i => tipMarginal.sample.point(PointId(0))) //consider only the first landmark
show(tips, "noseTips")

Michela

### Maia R.

Jan 7, 2021, 11:16:35 AMJan 7
to scalismo
Hi Michela,
I strongly advise you to use Scalismo within an IDE. It is really nicer to work with.
You can then use the tutorials, which are very well explained here:

Generating 200 points should be:
val sampler = UniformMeshSampler3D(model.reference, numberOfPoints = 200)  as explained here:

Regards

### Michela Bisighini

Jan 7, 2021, 1:12:51 PMJan 7
to scalismo
My goal is not to sample the mesh but to generate a posterior model that considers all my landmarks. I have already a model and I want to create a posterior model that consider big deformations on landmarks.
I don't know if I'm clear to explain the problem.
Michela

### V R

Jan 7, 2021, 1:30:00 PMJan 7
to Michela Bisighini, scalismo
Hi Michela,
Sorry for the confusion.
Everything you need to know to create a posteriori model is explained in the tutorials.
Best regards

You received this message because you are subscribed to a topic in the Google Groups "scalismo" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scalismo/CktWoNl-Vf4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scalismo+u...@googlegroups.com.