# Sliding semilandmarks

**URL:** https://discourse.slicer.org/t/sliding-semilandmarks/39828
**Category:** SlicerMorph
**Created:** [October 23, 2024, 10:50pm UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828 "2024-10-23T22:50:54Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Logan\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/logan_moore/32/69222_2.png) [@Logan\_Moore](https://discourse.slicer.org/u/Logan_Moore)
#### Post date: [October 23, 2024, 10:50pm UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/1 "2024-10-23T22:50:54Z")

</div>

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

```auto
##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:

```auto
DefaultPCA = gm.prcomp(defaultGPA$coords)

```

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

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

```

then

```auto
PDPCA = gm.prcomp(PDGPA$coords)

```

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

```auto
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.

---

<div class="post-metadata">

### Author: ![Logan\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/logan_moore/32/69222_2.png) [@Logan\_Moore](https://discourse.slicer.org/u/Logan_Moore)
#### Post date: [October 23, 2024, 11:53pm UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/2 "2024-10-23T23:53:20Z")

</div>

> [@Logan\_Moore](#):
>
> `geomorph2slicermorph2(gpa=defaultGPA, pca=DefaultPCA, paste0(output.path, "sliding'))`

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”

---

<div class="post-metadata">

### Author: ![Logan\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/logan_moore/32/69222_2.png) [@Logan\_Moore](https://discourse.slicer.org/u/Logan_Moore)
#### Post date: [October 24, 2024, 12:21am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/3 "2024-10-24T00:21:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [October 24, 2024, 12:50am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/4 "2024-10-24T00:50:23Z")

</div>

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

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

```

Just do

```auto
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')).

```

---

<div class="post-metadata">

### Author: ![Logan\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/logan_moore/32/69222_2.png) [@Logan\_Moore](https://discourse.slicer.org/u/Logan_Moore)
#### Post date: [October 29, 2024, 2:02am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/5 "2024-10-29T02:02:24Z")

</div>

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](https://drive.google.com/drive/folders/1QYhMn4o3DRkgmaNVSiaU0QsQBlKkcl6q?usp=drive_link)).

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

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [October 29, 2024, 2:04am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/6 "2024-10-29T02:04:00Z")

</div>

I don’t have permission to download the date.

---

<div class="post-metadata">

### Author: ![Logan\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/logan_moore/32/69222_2.png) [@Logan\_Moore](https://discourse.slicer.org/u/Logan_Moore)
#### Post date: [October 29, 2024, 2:05am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/7 "2024-10-29T02:05:44Z")

</div>

Lets see if this one works: [5PDsliding - Google Drive](https://drive.google.com/drive/folders/1QYhMn4o3DRkgmaNVSiaU0QsQBlKkcl6q?usp=sharing)

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [October 29, 2024, 3:31am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/8 "2024-10-29T03:31:06Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/7/371c974dfa32cf1a8b4cd1fceb22820e6b02d3e0.png)

---

<div class="post-metadata">

### Author: ![Logan\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/logan_moore/32/69222_2.png) [@Logan\_Moore](https://discourse.slicer.org/u/Logan_Moore)
#### Post date: [October 29, 2024, 3:47am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/9 "2024-10-29T03:47:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [October 29, 2024, 4:55am UTC](https://discourse.slicer.org/t/sliding-semilandmarks/39828/10 "2024-10-29T04:55:25Z")

</div>

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!
