Slicermorph GPA: Critical Error preventing analysis

Operating system: Windows
Slicer version: 5.0.3
Expected behavior: Run GPA on PseudoLM data
Actual behavior: Does not load, produces error message (below)

Hello,

I am trying to run a GPA on 40 landmarked endocasts. Landmarks represent a dense point cloud (# LM = 1232) which was created with PseudoLMGenerator and applied to a larger dataset using ALPACA.

I can run a GPA on the first 23 species, but when I try to add additional species OR when I try to run it on species at the bottom of the list I get an error (below). As far as I can tell, all my .fcsv files look normal and I haven’t been able to pinpoint a single species from the bottom of the list which might be causing the error. I tried rerunning the GPA on the same data with fewer landmarks (n = 491) and reinstalling the Slicermorph extension but the same issue occurs.

Is there a way to resolve this?

Error Message:
C:\Users\madle\AppData\Local\NA-MIC\Slicer 5.0.3\NA-MIC\Extensions-30893\SlicerMorph\lib\Slicer-5.0\qt-scripted-modules\Support\gpa_lib.py:94: RuntimeWarning: invalid value encountered in true_divide
shape=shape/np.linalg.norm(shape)
Traceback (most recent call last):
File “C:/Users/madle/AppData/Local/NA-MIC/Slicer 5.0.3/NA-MIC/Extensions-30893/SlicerMorph/lib/Slicer-5.0/qt-scripted-modules/GPA.py”, line 1241, in onLoad
self.LM.doGpa(self.skipScalingOption)
File “C:/Users/madle/AppData/Local/NA-MIC/Slicer 5.0.3/NA-MIC/Extensions-30893/SlicerMorph/lib/Slicer-5.0/qt-scripted-modules/GPA.py”, line 279, in doGpa
self.lm, self.mShape=gpa_lib.runGPA(self.lmOrig)
File “C:\Users\madle\AppData\Local\NA-MIC\Slicer 5.0.3\NA-MIC\Extensions-30893\SlicerMorph\lib\Slicer-5.0\qt-scripted-modules\Support\gpa_lib.py”, line 125, in runGPA
allLandmarkSets = procrustesAlign(allLandmarkSets[:,:,0],allLandmarkSets)
File “C:\Users\madle\AppData\Local\NA-MIC\Slicer 5.0.3\NA-MIC\Extensions-30893\SlicerMorph\lib\Slicer-5.0\qt-scripted-modules\Support\gpa_lib.py”, line 142, in procrustesAlign
allLandmarkSets[:,:,index] = alignShape(mean, allLandmarkSets[:,:,index])
File “C:\Users\madle\AppData\Local\NA-MIC\Slicer 5.0.3\NA-MIC\Extensions-30893\SlicerMorph\lib\Slicer-5.0\qt-scripted-modules\Support\gpa_lib.py”, line 102, in alignShape
u,s,v=sp.svd(np.dot(np.transpose(refShape),shape), full_matrices=True)
File “C:\Users\madle\AppData\Local\NA-MIC\Slicer 5.0.3\lib\Python\Lib\site-packages\scipy\linalg_decomp_svd.py”, line 108, in svd
a1 = _asarray_validated(a, check_finite=check_finite)
File “C:\Users\madle\AppData\Local\NA-MIC\Slicer 5.0.3\lib\Python\Lib\site-packages\scipy_lib_util.py”, line 287, in _asarray_validated
a = toarray(a)
File “C:\Users\madle\AppData\Local\NA-MIC\Slicer 5.0.3\lib\Python\Lib\site-packages\numpy\lib\function_base.py”, line 603, in asarray_chkfinite
raise ValueError(
ValueError: array must not contain infs or NaNs

@Madlen_Lang the last line suggests there are NAs or missing values in your dataset. This may come up in different ways. For example alpaca may not successfully transfer lm. As a first step, i suggest loading the models and alpaca transfer and confirm that alpaca set completed successfully for all samples

Thank you!

There does appear to have been and error in the transfer of the landmarks using ALPACA. I think the software was having a hard time aligning the surfaces to place the landmarks, as some species have very disparate morphology. When I opened the files in Slicer some of the species only had one landmark visible (though there were the correct number of landmarks in the list). I was able to run the GPA on the species that did not have this issue.

I will be going through my surfaces and translating them into the same plane/orientation as my mean species to help the software align the surfaces.

When you have very disparate morphologies, single template usually is not sufficient. You can use a multi-template approach as described in this preprint (which is coincidentally accepted today to appear on Plos One, yay @chz31 ) Automated Landmarking via Multiple Templates | bioRxiv

If you don’t want to do that, as I recall you had some manual landmark on your brain endocast, you might try using the ProjectSemiLMs utility of SlicerMorph…

After transforming all .ply into the same orientation to help the software align the endocasts I was able to use ALPACA and perform a GPA. Looking at the PCA I think that the landmark placement is still not very accurate as some species plot in unusual spaces. I will try to use MALPACA to place the landmarks and see how that goes (congrats on the newly accepted paper!).

I was able to convert my manual landmarks from an .landmarkascii to a .fcsv using the SlicerMorphR R package. However, the landmarks do not align with my .ply files. They appear to be smaller than the .ply and are shifted ventrolaterally relative to the endocast mesh. As they don’t align, I wont be able to use them with the ProjectSemiLMs module.

Thank you again,

Sometimes it is a problem of coordinate systems. If you can share one or two of your PLY files and the original LM coordinates, I can see if there is an easy fix.

However, the scaling seems of is a concern. Perhaps units are not the same. What software did you use to do the landmarking?

Hello,

I discovered as I was troubleshooting a geomorph surface warping issue that the function I was using to combine multiple landmarks files for a single species (combine.subets: geomorph) applies a transformation to the data (standardizes centroid size). As this is the data I was using to convert my landmarks to a .fscv format it makes sense that it did not align with my .ply file. I have decided to combine these landmarks files by hand rather than using the combine.subsets function which will most likely resolve the issue of the landmarks and the .ply not lining up.

Thank you for all your help,

Maddy

Glad to hear that you are figuring out. In general it is best to do the all data collection, clean and data prep in one platform and after making sure everything is correct to proceed with analysis.

Tjere is a utility in SlicerMorph called MergeMarkups(Tutorials/MergeMarkups at main · SlicerMorph/Tutorials · GitHub), that might be helpful.