Suggestion for an R interactor

So, I was wondering if it’s possible for us to get an R interactor in addition to the Python Interactor. My reasoning is that, it would be nice to be able to utilize packages such as RvtkStatismo, geomorph, and shiny, etc within 3D Slicer. I understand that geomorph has an equivalent module to SlicerMorph right now, but it does not do any of the real computation, and it would be nice to generate many of these things within the scene itself. RvtkStatismo can mainly be used within linux systems (as the download for windows is really bad), but it would enable statistical shape modelling, and if we can make slicer compatable with h5 transforms on top of an average shape model, then we can create a statistical shape model from data and display it within the 3D viewer, as well as colorize it.

@muratmaga is more knowledgeable on this idea of going between Python and R options, but I think you will have to rely on installing python packages that call R packages where you’re still using a python 3 interactor instead of an R interactor.

Starting from this post linked below in a really old thread you can read some about why development of R within Slicer is likely not going to be implemented. It’s about most R packages having a GPL license instead of LGPL and Slicer is not wanting to distribute any GPL code in Slicer packages or extensions.

1 Like

You can switch between R and Python inside Jupyter notebooks. Would that be useful, along with using SlicerJupyter?

This cannot happen due to license incompatibilities between these two software.

You can use R through Rpyserve, Rpy2 or various other Integration packages.

But this is not as simple as passing an object between two platforms. For a good integration, you have to consider how you will handle those R objects in Slicer. How you will show the in the scene etc. We will be working towards that in a grant proposal that’s in works.

For the time being the simplest solution is to use SlicermorphR r package to easily import your digitization output into R

As for vtkStatismo, you can either import their pywheel into Slicer (if they have one) or use the VTK functions directly, which are all available directly.

Ah ok. My apologize, I am unfamiliar with how you set up a python interactor. Unfortunately I am not sure how to utilize the principle component values once exported from SlicerMorph to be useful in R.

You can use SlicerMorph derived PC scores in the whichever way you are using PC scores derived from the gm.prcomp function of the geomorph. They are equivalent. This example shows that on sample data.

Another stupid question for you. Did you have a special package which contained your parser function for your code you sent me to? My system is saying that I don’t have the function parser…

in R do
devtools::install_github("SlicerMorph/SlicerMorphR"), then

Ah ok, the code snippet that was on github did not show that you had to use SlicerMorphR as a library, so I was very confused.