MALPACA on several species - issue?

Operating system: IOS
Slicer version: 5.6.2

Hello Community!

I am new to slicer and ALPACA and I would like to apply a Multi-template (MALPACA) to my data for GMM analysis.
Some context: I am working with 4 modern species and archaeological specimens. My objective is to create a template with modern specimens to test the phenotypic/taxonomic potential of the bone that I use and also to compare these modern specimens to archaeological ones. I decided to choose this automatic approach because of the good repeatability, avoid operator effect, open source AND especially because it is very complicated to find homologous landmarks on the bone that I use…!

My issue:
Firstly, I was trying to test MALPACA on my 4 modern species and I have some troubles applying multi-template.

Explanations: I was trying to generate a “ kmeans_selected_templates” on a sample composed of all my specimens of the 4 species mixed together. The idea is to obtain the better representative template of these 4 species, to apply MALPACA on all these modern specimens, to observe the potential of a phenotype/taxonomical signal on modern specimens. The next objective is to apply and test these same (modern) templates on my archaeological specimens. The goal is to see how the both diversities (modern and archaeological) are interacting in statistical analysis.

BUT, I am stuck at the first step with the determination of the Kmeans samples… as I said before, I am not able to create a “ kmeans_selected_templates” when I am mixing all my modern specimens of the 4 species. The step 1 of “generetate reference Point cloud” never really works and I never had acces to the step 4 of “ Multi templates selection” etc…

SO, I made a test on 1 species only and it seems that in this case it works because step 1 and 2 works and I was able to obtain the “Generate Point clouds matched to reference”. So, I deduced that my 4 species are maybe too different to generate a multi template together?

Consequently, I was thinking to generate a “kmeans_selected_templates” from each (4) species separately, and, after, groups all these templates together in a same file (one for landmarks points and one for ply models) in order to use them in the MALPACA batch processing “Method” and “Source landmarks” files. Like this, I will be able to obtain more “representative templates” for my modern and archaeological data.

Nevertheless, I am not sure if this procedure is not “too much” and maybe artificial? Before to test, I would like to know,

  • if someone already proceeds like this?
  • or have advice from colleagues who are more familiar with these tools. And/or, maybe suggest other procedures…

I really thank you in advance for your help!

I’m surprise that step 1 generating reference pcd did not work when you mix 4 species. All it does is pick up the first specimen in your folder by default and downsample it.

If you could proceed to step 2, did the text box print out any information? I think you are probably right that the 4 species are too different. If so, the text box should print out that there are many specimens have much less unique points sampled, thus very high error rates. See the tutorial: Tutorials/MALPACA/K-means_templates_selection.md at main ¡ SlicerMorph/Tutorials ¡ GitHub. The matched point clouds are also stored in your output finder,
The multi-species sample we used was chimps, gorilla and orangs.

The generate correspondent point cloud step simply uses the reference point cloud to fetch closest points from other specimens after rigid registration. If specimens are too different, rigid registration won’t perform well (even morphometric analysis may not do well either).

In that case, it is better to do an ALPACA/MALPACA for the four species separately. MALPACA would use each template to landmark each specimen. If the templates from other species are too different, landmarking won’t be accurate. If only one template yields outliers, the impact might be small, since MALPACA would take the median output. MALPACA might still be able to pick up the optimal estimates in most cases (see our sample ape data). You might need to do a small pilot tests to see if MALPACA is able to pick up the better estimate.

Is it possible to know what these four species are and perhaps have some sample data?

To answer some of these question, it really would help if you can share some of your data or at least screenshot of how different these four species are.

Are there any error messages when you try to run the kmeans template selection? You may need to open the log file (CTRL+0) and look into it.

I thank you very much for your both answers. Maybe it is just me who do something wrong too.

I am working with complicated species, taxonomy is a big deal: the four south American camelids (lama, alpaca (ahah), guanaco and vicuna). Usually I use common landmarks/curves GMM, but i would like to try these automatic approach.

I am also working with a complicated bone: the first phalanges who can be mixed (fore/hind) in my samples. I know there is a lot of “difficulties” but I would like to be more closer as I can to the archaeological samples. To obtain commun tool for zooarchaeologists. But Maybe it is not possible.

I come back to you with my “error messages” and a samples of data.

You can pick up two specimens from two species and use FastModelAlign to test registration. If they are registered well, then ALPACA/MALPACA should be fine: Tutorials/FastModelAlign at main ¡ SlicerMorph/Tutorials ¡ GitHub

ah! maybe it is better to start with that indeed.
I see " distinct sizes because no size reference was provided " in this example… I forgot to think about the scale… my data, indeed, came from several type of scanners… one part from a CT and other part from two Artec spiders… so maybe it is a problem of scale at the beginning. I try this " FastModelalign" and let you know.

Thank you very much!

I think this is why it not working? when I am mixing specimens from two species here one (fore) phalange from a guanaco and one (hind) phalange of vicuna (my most different configuration possible) it seems that it is not possible to registered correctly. Moreover, my scan are bad quality (I’ve had a problem that I can no longer solve and I need to use this data). It certainly doesn’t help.
I add some screens



Hello,
I was trying with a new subsamples of my data (four species)

  • was able to do the two first steps but the generate point cloud seems strange (screen bellow):
    "The reference is mnhn_alp_1907_325_phal_courte_4_1
    The number of points in the downsampled reference pointcloud is 465. The error threshold for finding correspondent points is 1.0%
    {} unique points are sampled from each model to match the template pointcloud "

  • and the last step (kmeans) is not working yet there is this error (more a screen bellow):

" Traceback (most recent call last):
File “/Applications/Slicer.app/Contents/Extensions-32448/SlicerMorph/lib/Slicer-5.6/qt-scripted-modules/ALPACA.py”, line 1153, in onkmeansTemplatesButton
self.scores, self.LM = logic.pcdGPA(pcdFilePaths)
File “/Applications/Slicer.app/Contents/Extensions-32448/SlicerMorph/lib/Slicer-5.6/qt-scripted-modules/ALPACA.py”, line 3225, in pcdGPA
LM.lmOrig, landmarkTypeArray = GPAlogic.loadLandmarks(
File “/Applications/Slicer.app/Contents/Extensions-32448/SlicerMorph/lib/Slicer-5.6/qt-scripted-modules/GPA.py”, line 1827, in loadLandmarks
import pandas
ModuleNotFoundError: No module named ‘pandas’
Traceback (most recent call last):
File “/Applications/Slicer.app/Contents/Extensions-32448/SlicerMorph/lib/Slicer-5.6/qt-scripted-modules/ALPACA.py”, line 1153, in onkmeansTemplatesButton
self.scores, self.LM = logic.pcdGPA(pcdFilePaths)
File “/Applications/Slicer.app/Contents/Extensions-32448/SlicerMorph/lib/Slicer-5.6/qt-scripted-modules/ALPACA.py”, line 3225, in pcdGPA
LM.lmOrig, landmarkTypeArray = GPAlogic.loadLandmarks(
File “/Applications/Slicer.app/Contents/Extensions-32448/SlicerMorph/lib/Slicer-5.6/qt-scripted-modules/GPA.py”, line 1827, in loadLandmarks
import pandas
ModuleNotFoundError: No module named ‘pandas’ "


In python console please type:
pip_install("pandas")
and then retry.

@chz31 kmeans is using GPA logic. GPA relies on pandas, which it installs in its first execution. If people try the kmean module without actually running the GPA ever before, it fails.

Can you add a logic in kmeans to see if pandas is available, and if not, install it.

1 Like

I did not realize it. Thanks for the reminder! I’ll add it.

@MSAC It appears that based on registration, the bones from different species are indeed a bit too different. Perhaps running separate MALPACA/ALPACA can be a solution. It looks like the bones are different phalanges?

Sorry for my delay of answer.

@muratmaga Many thanks! in adding this package in the consol as you suggested, I solve my first issue in the kmean steps! so now I am able to go at the end of the procedure.

@chz31 no it is the same bone, but when I do a “Pseudo LM generator” followed by a single ALPACA between two specimens of two species my bones are correctly aligned.
So I suppose as you suggested that I have to do kmeans by each species separately (with adjustment tests) in order to obtain 4 templates that I will secondly use with MALPACA on my whole sample. I am trying this process.

Thank you very much to both of you for your quick answers, it’s help a lot.

1 Like

If you got the kmeans working, I would use those samples suggested as templates.