Building GP from point clouds

48 views
Skip to first unread message

Carley Stewart

unread,
Mar 20, 2023, 11:02:27 AM3/20/23
to scalismo
Hi,
I'm trying to construct a GP from a series of point clouds which are already in correspondence. Is this possible with scalismo? 
Thanks,
Carley

Marcel Luethi

unread,
Mar 20, 2023, 1:59:53 PM3/20/23
to Carley Stewart, scalismo
Hi Carley

Yes, this is possible. You essentially follow the steps described in Tutorial 6 ( https://scalismo.org/docs/Tutorials/tutorial06 ), but replace the type TriangleMesh with UnstructuredPointsDomain.

This would look somehow like this:

  // the files with poitn clouds in a standard mesh format (e.g. stl)
  val pcFiles : Seq[java.io.File] = ???

  // read files as mesh and extract point set
  val pointClouds = for (pcFile <- pcFiles) yield MeshIO.readMesh(pcFile).get.pointSet

  // wrap pointSet in a Domain
  val pointDomains = for (pointCloud <- pointClouds) yield UnstructuredPointsDomain3D(pointCloud)
   
  // Build model
  val reference = pointDomains.head
  val dc = DataCollection.fromUnstructuredPointsDomainSequence(reference, pointDomains)

  val pdm : PointDistributionModel[_3D, UnstructuredPointsDomain] = PointDistributionModel.createUsingPCA(dc)

The underlying GP can be extracted from the pdm, using pdm.gp

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/83e05fa3-c03e-4798-a6f2-ba00f3993341n%40googlegroups.com.

Carley Stewart

unread,
Mar 22, 2023, 1:05:14 PM3/22/23
to scalismo
I'm having trouble converting my point cloud data (X,Y,Z coordinates in a text file) into an stl file. Is there a method to create a pointSet straight from a .txt file?
Thanks! 

Marcel Luethi

unread,
Mar 23, 2023, 7:36:23 AM3/23/23
to Carley Stewart, scalismo
Hi Carley

You can create an UnstructuredPointsDomain directly from a sequence of points as follows:
        val pointSeq = IndexedSeq(Point3D(0,0,0), Point3D(1,1,1))
        val usDomain  = UnstructuredPointsDomain3D(pointSeq)
Hence, you can read the coordinates of the points from a txt file, create a sequence of points and use this sequence in turn to define an UnstructuredPointsDomain.
With that you are at the point where you can use the code I sent in the previously to build a point distribution model.

Best regards,

Marcel


On Mon, Mar 20, 2023 at 4:02 PM Carley Stewart <cgst...@gmail.com> wrote:
--

Marcel Luethi

unread,
Mar 27, 2023, 2:36:26 AM3/27/23
to Carley Stewart, scalismo
Dear Carley

Great to hear that your project is advancing.
Support for visualizing point distribution models has only been added very recently. You need to upgrade to version 0.92-RC1. Once you have the new version, a simple show should work. You don't need to manually add the argument ShowInScene.

Best regards,

Marcel

On Fri, Mar 24, 2023 at 10:28 AM Marcel Luethi <marcel...@gmail.com> wrote:
Dear Carley

Great to hear that your project is advancing.
Support for visualizing point distribution models has only been added very recently. You need to upgrade to version 0.92-SNAPSHOT. Once you have the new version, a simple show should work. You don't need to manually add the argument ShowInScene.

I hope to be able to release a first release candidate of 0.92 later today or on Monday.

Best regards,

Marcel

On Thu, Mar 23, 2023 at 8:54 PM Carley Stewart <cgst...@gmail.com> wrote:
Super! I feel like I am almost there. Thank you for the help so far. I am able to read and point clouds and display them, and create a model and display samples or the mean, but I cannot display the model. Can you do this with a point cloud? Below is my code so far: 
image.png

Carley Stewart

unread,
Apr 18, 2023, 8:53:05 AM4/18/23
to scalismo
Hi Marcel, 
I have been able to upgrade and display the model as a point cloud. Could you explain what the coefficients slider bars are? Do they represent different components of the PCA (slider bar 1 = priniciple component 1) ?
Thanks!
Carley
Reply all
Reply to author
Forward
0 new messages