MALPACA + slicerMorphR --> correct files for quality control pipeline in R

Slicer version: 5.1.0-2022-06-01 r30987 / 177f3b3

Hi,

currently I’m trying to get familiar with the new great features of “MALPACA” of the SlicerMorph module.

I followed the steps according to the Appendix given in the manuscript:
https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0278035

MALPACA works fine using the downloaded sample data (mice & apes).
Also the quality control pipeline using slicerMorphR worked out as described in the Appendix (IV. Landmarking Quality Control Pipeline)

Next I tried MALPACA with my data.
In a final step, the QC pipeline was also tested with the new data in R.

Unfortunately the data could not be loaded in R, resulting in the following error message in R:

Error in file(file, “rt”) : cannot open the connection
In addition: Warning message:
In file(file, “rt”) :
cannot open file ‘…/output_target_landmarks/individualEstimates/NA’: No such file or directory

Next I have compared the *.fcsv files of the example data with my data.

  • in the example *.fcsv file: the “relation” is given as “associatedNodeID” “template - subject”

columns = id,x,y,z,ow,ox,oy,oz,vis,sel,lock,label,desc,associatedNodeID
vtkMRMLMarkupsFiducialNode_0,-72.8187,-127.5815,50.494,0,0,0,1,1,1,1,USNM084655_LM1-1,

I guess this information is needed to relate the resulting median & the individual landmarks in order to perform the post hoc QC.

  • this kind of description is missing in the data which was generated using MALPACA with my own data

columns = id,x,y,z,ow,ox,oy,oz,vis,sel,lock,label,desc,associatedNodeID
1,-7.591875076293945,-4.460249423980713,26.58815574645996,0,0,0,1,1,1,0,1 , , , 2,0

Could this be the reason why SlicerMorphR causes an error when trying to perform the post-hoc QC?
That an “meaningful” description of the “associatedNodeID” is required?

Thanks!

Best,
Markus

1 Like

Please try updating your SlicerMorphR package. I believe this (extra fields in fcsv files) already fixed. Going forward, I suggest using JSON format as output to avoid these fidelity issues. You can now set the output of ALPACA/MALPACA to be json.

Hi,

the following version of SlicerMorphR ist used:

  • Package SlicerMorphR version 0.0.0.9000

The software 3D Slicer was updated, now running:

  • 3D Slicer 5.2.1 r31317 / 77da381

Regarding the format of the landmarks, now using:

  • *.mrk.json format

Unfortunately SlicerMorphR still returns an error when trying to read the
estimated landmarks:

LMs ← read.malpaca.estimates(MALPACA_outputDir = MAL_outDir_git, templates_Dir = templates_path_git)
results in:

  • Error in [.data.frame(temp, , 2:4) : undefined columns selected

Data used: 2 templates, 3 targets

Any idea how to solve this?

Thanks!

Best,
Markus

You need to share your MALPACA output for us to see what the issue is.

Thanks for pointing out the issues and trying our methods. When we just finished the MALPACA output loading functions and the manuscript, we were using the older version of Slicer. Therefore, we tentatively put these functions in my own repository of the development version of SlicerMorphR, which is also listed in the supplementary materials of the manuscript.

For the current Slicer, saving landmarks in fcsv creates an extra empty column at the end. The updated main SlicerMorphR, which can be installed using devtools::install_github('SlicerMorph/SlicerMorphR'), should be able to resolve the loading fscv issue you mentioned with the function read.markups.fcsv. Can you give it a try?

Meanwhile, I am doing some tests and updates about MALPACA results loading functions in my own repo of the development versison of the SlicerMorphR. I’ll then merge it into the main repository. It should be quick.

I have updated the SlicerMorphR package. Can you please install it via devtools::install_github('SlicerMorph/SlicerMorphR') a try? The landmark files generated by the new MALPACA/ALPACA module should be in mrk.json format. The new update should work with both mrk.json and fcsv.

1 Like

Dear Chi,

thanks for your quick response!

The following steps were tried:

  • SlicerMorphR was updated `devtools::install_github(‘SlicerMorph/SlicerMorphR’)

Outcome:

  • fcsv AND mrk.json data can be imported

Minor issue:

  • help/SlicerMorphR.rdb is corrupt

This might be due to the fact that my R version is 4.2.1 and “jsonlite” was compiled/generated
using R version 4.2.2 ??? (not sure)

Anyway. The post-hoc QC can be performed, e.g. using 2 templates, outliers$estimates_no_out[4:6, , 1, 7] results in:

       x         y        z

4 -7.163967 -4.116971 17.13764
5 -13.477526 -5.081557 16.88782
6 -10.627498 -3.185812 16.92243

outliers$estimates_no_out[4:6, , 2, 7] results in:

       x         y        z

4 -7.248554 -4.241855 16.97166
5 -13.474133 -5.052335 16.82217
6 -10.607809 -3.201885 17.07043

(templates are quiet similar, this is known…)

Thanks!

Best regards,
Markus

2 Likes

Hi Markus,

That’s great! I’ll look into the SlicerMorphR.rdb corrupt issue. What you suggested might be right. Thanks again for trying our method!

Best,
Chi

1 Like