SlicerMorph paper

Congrats to @smrolfe and @muratmaga for getting the SlicerMorph paper published! :+1: :+1: :+1:

Rolfe, S., Pieper, S., Porto, A., Diamond, K., Winchester, J., Shan, S., Kirveslahti, H., Boyer, D., Summers, A. and Maga, A.M. (2021), SlicerMorph: An open and extensible platform to retrieve, visualize and analyze 3D morphology. Methods in Ecology and Evolution. Accepted Author Manuscript.


Very nice! I would recommend to explicitly designate this paper as the paper to cite when somebody uses SlicerMorph (add “How to cite” to SlicerMorph website). This makes it much easier to follow who uses SlicerMorph and for what, and it is also much more impressive to have one paper with 500 citations than 10 papers with 50 citations each. Users of course can cite additional papers, more specific to certain SlicerMorph features (e.g, if they use ALPACA then they should cite the SlicerMorph paper and the ALPACA paper).

1 Like

Congratulations for the great work

1 Like

Thank you all for our help. This wouldn’t be possible without the support of this wonderful group of people around the Slicer platform.

@lassoan We do have how to cite SlicerMorph on the github repo. These were pointing out to the more detailed preprint versions of the paper, but will update with the new DOIs. ALLPACA paper is is also accepted to MEE and should appear shortly.

I’ve opened the SlicerMorph website and searched for “cite” and nothing was found on the page. I have not thought about checking it in the repository’s readme file, and probably I’m not alone. It could be better to duplicate the “How to cite” instructions at both places. I would also recommend considering renaming “Citations” to “How to cite” (because citations may also mean a list of papers that cite SlicerMorph), highlight one single paper to be cited (to accumulate instead of disperse citations), and describe why it is important that they cite (makes it easier to demonstrate impact for securing further funding for development and maintenance).

Yeah, I think we will actually forward the to the repo as oppose to the old pages.

Good suggestion for the Citations, I will rename that to how to cite.

When I searched for SlicerMorph then I got as the first hit. If you don’t want people to use this landing page then it might be better to remove it.

Can SlicerMorph also use the PCA results with a continuous variable such as age for the samples to perform a regression analysis such as that which can be performed in MorphJ?

SlicerMorph and MorphoJ serve different functions. SlicerMorph is a digitization and shape variance visualization tool, whereas MorphoJ is an analytical tool with some function specific to analysis of coordinate data.

At this point SlicerMorph does not feature any analysis features built on latent variables like PC scores. You have two options.

  1. You can explore the available linear model tools in Python, and use them within Slicer/SlicerMorph. We can possibly work with you, if you want to go down that route. These are some examples of packages that offer linear modeling and regression in Python.
  2. You can take the PCA output from SlicerMorph and use R/geomorph package to do your analysis. This tutorial shows the necessary steps

More general question then, as I would prefer to use the functionality of MorphoJ than reinventing the wheel myself with Python tools or with having to format the PCA outputs in R (which in and of itself is slow and cumbersome when doing GMM with landmarks). Does anyone know which files in 3D Slicer or SlicerMorph are responsible for defining the saving system for fiducial files? If so I can modify said file to save in the format necessary for MorphoJ for our purposes to be able to directly import them without all the rigmarole of altering each .fcsv file and then combining them for analysis.

İ (and probably an order of more magnitude more publications that use R based gmm tools for shape analysis instead of morphoj) respectfully disagree with your assessment of functionality of R gmm ecosystem. But if course you are free to do what you want to do.

i don’t think you want to modify the fcsv write functions and rebuild Slicer from scratch, as those would be undoubtedly more work. Fcsvs are simple csv files that you can open in excel and append each other if that’s what you want.

İ do not know what format morphoj expects.

My apologies, I didn’t explain very well. My task is trying to teach medical school students and biologists the process of shape analysis, particularly through GMM. The majority of these students neither have programming experience, nor any interest in learning programming. That is why using R would be slow and cumbersome. I am also not interested in modifying the 3D Slicer process of saving fcsv files, only looking at the architecture, and the process that 3D Slicer uses to save said files so I can replicate it with my own function/script to generate something like a json file, text file, etc, with all of the landmark points listed one after the other, without uncertainty values and such.

Yes, learning GUI driven analysis programs like MorphoJ is somewhat easier to use initially. Particularly if all you ever need is the functionality offered in the package. The main catch is, the moment you need something else you are stuck. It is also much more challenging to export data from those kinds of tools, if you need to generate publication quality images. reformat tables etc… So there are drawbacks to both approach.

You don’t necessarily learn to program in R, if all you all you do is to use a package like geomorph. You replace teaching keyboard shortcuts and menu selections with function names and parameters to pass them, which the student can learn to program if they choose to so in future. But you dont necessarily need to learn to program anything in R. Just learn function names and be able to write things in a script. It is a bit more upfront investment, but in the long run it pays off, particularly for students.

Going back to your original inquiry, I see morphoJ takes a text input (but they provide no description of what fields are necessary). Probably that would be your simplest option. If you get an example of what that looks like, we can help you to reformat the fcsv into that.

This piece of R code seem to convert the fcsv to the basic text format MorphoJ expects as far as I can tell. You can test with the sample data in SlicerMorph. First download the gorilla skulls data, then run them via SlicerMorph’s GPA function (only to create the analysis.log file) that we use the pull the data. Then in R, run this script.

if (!require(devtools)) install.packages('devtools')
if (!require(SlicerMorphR)) devtools::install_github('SlicerMorph/SlicerMorphR')

#navigate to the analysis.log file saved into the output folder.

#function to convert 2D matrix of coordinates to a row of coordinate 
vectorize = function(X){

lms = NULL
for (i in 1:length(dat$files)) lms = rbind(lms, vectorize(dat$LM[,,i]))
#append the subject IDs
rownames(lms) = dat$ID
#write to disk
write.table(lms, file="c:/users/amaga/Desktop/test.txt", quote=FALSE, sep=",", row.names = TRUE, col.names = FALSE)

So the text document really just has the each line with the sample name, followed by each x, y, and z coordinate of those landmarks relating to said sample. I just want a way to automatically save this easily so that the students don’t have to save each file and pull that info out individually and save them. It also can be any forma of text document including csv, fcsv, text, or tsv. It just can’t contain the uncertainty values of the landmark and all the extra fields that are in fcsv files.

This conversion needs to be done separately. I am not inclined to support any format that is not native to Slicer within SlicerMorph, as if people start using those formats to keep their data in, that will break our functionality (or formats don’t have things that we care or need, like units or coordinate systems).

Did you try the code example above? If you are more comfortable with excel, I am sure a short visualbasic script would do that too.

Since the markups json file is practically a database. You can use that as a data source in Excel, you can read the markups json file into a spreadsheet directly, just using the GUI. It is not a one-time import, but it is a live query, which allows refreshing of the spreadsheet from the json file.

So, I get the feeling that I am not communicating what I am looking for properly. I am not trying to get an official change to the slicerMorph software, only create a new module that I can then add to either slicer or slicerMorph that will enable me to save a single file with the said format. The R code would be useful if I wanted to have the students run the code, but I have dealt with students who want absolutely nothing to do with any type of programming in this course, even if it is a single instance of pulling up the program and just running the script. Plus the said script would convert the fcsv to a text file and not pull out just the intended data for the purpose of using morphoJ. The excel file system would also require saving individual fcsv files, and pulling them into Excel, then editing it which is just time consuming. That is why I would like to look at the code for slicer or slicerMorph on how it saves fcsv files and maybe even the markups module to be able to access the list of fiducials to print out the text, json, csv, etc file for access in morphoJ. I realize this is an irregular use case but people make new modules for slicer all the time and I am just trying to do that.

In addition, I also realize that it would be better to just work in R, but as said I have dealt with medical, dental, anthropology, and biology students who refuse to learn coding of any kind and who will not use coding softwares. They have left very negative reviews about courses instructing them on how to use said softwares, and/or been unable to produce results because they fail to understand the directions. Even adding too many softwares is a problem which is why I was originally looking at slicerMorph in the beginning because it calculates the PCs for future analysis.

You can develop a simple python module that will essentially replicate the R code I posted. There is nothing in SlicerMorph, that writes these landmarks files (neither for FCSV, nor in JSON). We are simply using the built-in functionality in Slicer to save them.

More important in Slice/SlicerMorph, we keep the landmarks per subject. Whereas the format you want to keep them essentially compiles all the subjects together in a single file. So after your students are done in Slicer/SlicerMorph landmarking their specimens, they can copy all fcsv/json files in a folder, and your module can read all of them, do the flattening and save a single text file out of them.

The closest piece of code I can show from SlicerMorph, is a module that does the reverse of what you ask, read an obscure format and import them as fcsv. SlicerMorph/ at master · SlicerMorph/SlicerMorph · GitHub.

I can provide some sample python code to do this if that would be helpful. If possible can you share an example file?