Sliding semilandmarks

Hi guys,

I hope you are well, I just want to make sure I am understanding the workflow of Slicermorph and SlicermorphR correctly. Apologies if this seems simple but I must have have an error somewhere and it is driving me

When looking at the SlicermorphR page my code is essentially the same

##set your working directory!
files=dir(patt='json')
fixed.LMs <- 1:2
semi.LMs <- 3:82

#Array is LAND, DIM, IND
#where LAND is the number of landmarks
#where DIM is the number of dimensions
#where INd is the number of individuals

samples=gsub(".json","",fixed=T, files)
LMs <- array(dim=c(82,3,10))

for (i in 1:10) LMs[,,i] = read.markups.json(files[i])
dimnames(LMs) <- list(paste0("LM_",1:82), c("x", "y", "z"), samples)

#read in the curves file
curves<-as.matrix(read.csv("curves.csv", header=FALSE))

#completes a GPA without sliding
defaultGPA<- gpagen(A=LMs, surfaces = semi.LMs, ProcD = TRUE)

This runs and completes without issue, and everything is great, it is sliding that seems to be an issue.

If I understand correctly, I will run a PCA based on the newly acquired GPA.

Something like this:

DefaultPCA = gm.prcomp(defaultGPA$coords)

If I am sliding by Procrustes distance, it would look like this:

PDGPA<- gpagen(A=LMs, curves=curves, surfaces = semi.LMs, ProcD = TRUE)

then

PDPCA = gm.prcomp(PDGPA$coords)

Then, to get it out, it would be the following?

geomorph2slicermorph2(gpa=defaultGPA, pca=DefaultPCA, paste0(output.path, "sliding'))

geomorph2slicermorph2(gpa=PDGPA, pca=PDPCA, paste0(output.path, "PDsliding')).

This then would give me files that I could then put back into Slicermorph to do visual analysis, correct?

Apologies again, I’ve been really wracking my brain on what is going wrong today.

The good news is that its an output path issue, that bad news is that no matter how many times I format the output path, nothing shows up in the folder.

I currently altered it from the example as follows:

output.path=“C:/Users/Logan/Desktop/geomorph”

Alrighty guys, never mind me. I found my error, I was missing a singular “/” and it was dumping the materials to my desktop. Everything is working as intended.

Glad to hear that things are working. BTW the way, first GPA is redundant:

defaultGPA<- gpagen(A=LMs, surfaces = semi.LMs, ProcD = TRUE)

Just do

PDGPA<- gpagen(A=LMs, curves=curves, surfaces = semi.LMs, ProcD = TRUE)
PDPCA = gm.prcomp(PDGPA$coords)
geomorph2slicermorph2(gpa=PDGPA, pca=PDPCA, paste0(output.path, "PDsliding')).

Hi Murat,

I did adjust my code, as you suggested, my collaborates were really big on just wanting to see the output matched, so I did the regular GPA for that reason.

One quick follow-up: do you know why the slide landmarks and analysis won’t load into Slicermorph? I am on Slicer 5.6.2 with Slicermoprh version 5151748 and when I try to load an external analysis from R it just sits there blankly. I have included some data here for you to see (https://drive.google.com/drive/folders/1QYhMn4o3DRkgmaNVSiaU0QsQBlKkcl6q?usp=drive_link).

The original processed data still works, just not the items from Gemoorph2Slicermorph.

I don’t have permission to download the date.

Lets see if this one works: 5PDsliding - Google Drive

1 Like

I successfully loaded this dataset into GPA module, no errors or anything?

I don’t know whether the results make sense, but at least you should be able to get without an issue.

I used a slightly newer version from October 11th. Try with a newer version, particularly if you are using the JSON formatted log files like the one your provided. The GPA in stable version is a bit stale. We are waiting for the new stable to come out in the next few weeks.

1 Like

Ah, yes, thank you! It does seem to be an issue on 5.6.2. The preview build worked immediately. Thanks for the tip!

1 Like

Yes, we need some of the features in the later preview version of Slicer, so SlicerMorph in 5.6.2 doesn’t have all the capability of later versions. A new stable will be out soon!