Running a loop for landmarking with Geomorph

6 views
Skip to first unread message

Helen Ryan

unread,
Dec 11, 2025, 3:29:03 AM (8 days ago) Dec 11
to geomorph R package
Hi! 

I have a heap (~600) specimens to landmark so have created a loop to streamline the landmarking process. 

for(i in 1:length(ply_files)) {
  spec3D <- vcgPlyRead(ply_files[i], updateNormals = TRUE)
  surf.pts <- digitsurface(spec = spec3D, fixed = 12)
}

I am having two issues. 1) once I have placed the 12th fixed landmark, it opens the next specimen in the RGL window, without showing me how the sliding landmarks placed on the specimen so I can't check for errors, and 2) the landmark file saves as spec3D.nts instead of the original file number (eg HS051.nts) which would mean all subsequent files will overwrite the previous one.

I would love some advice on how to correct the code to fix these two issues.

Cheers,
Helen

Adams, Dean [EEOB]

unread,
Dec 11, 2025, 10:27:28 AM (8 days ago) Dec 11
to geomorph-...@googlegroups.com
Helen,

The first issue is unavoidable when putting this into a loop. However, you can call the specimens up post-digitizing using the 'plotspec' function to visualize.

To the second issue, your loop hasn't specified things in a specimen-specific manner, so it has no way of knowing which specimen is which.  Please have a look at the 3D digitizing vignette which comes with geomorph. In that example we add a line or two of code that specifies 2 specimens. Then, when digitsurface is called, the output *.nts have different names.  You should be able to follow this logic and add a line or two of code in your loop to allow for this.

The alternative is to add a line of code after 'digitsurface' where you brute-force change the name to what you want. 

Dean
--
Dr. Dean C. Adams
Distinguished Professor
Director, Ecology and Evolutionary Biology Graduate Program
Department of Ecology, Evolution, and Organismal Biology
Iowa State University

From: geomorph-...@googlegroups.com <geomorph-...@googlegroups.com> on behalf of Helen Ryan <mrsry...@gmail.com>
Sent: Thursday, December 11, 2025 2:29 AM
To: geomorph R package <geomorph-...@googlegroups.com>
Subject: [geomorph-r-package] Running a loop for landmarking with Geomorph
 
--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/geomorph-r-package/38fdbe99-944b-4440-bc6c-6762a1cfb2bcn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages