Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyNutil
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Harry Carey
PyNutil
Commits
723d42ad
Commit
723d42ad
authored
1 year ago
by
Harry Carey
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
https://github.com/Neural-Systems-at-UIO/PyNutil
parents
10061f03
9024ecb2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
PyNutil/read_and_write.py
+7
-0
7 additions, 0 deletions
PyNutil/read_and_write.py
PyNutil/visualign_deformations.py
+21
-2
21 additions, 2 deletions
PyNutil/visualign_deformations.py
with
28 additions
and
2 deletions
PyNutil/read_and_write.py
+
7
−
0
View file @
723d42ad
...
...
@@ -32,8 +32,15 @@ def load_visualign_json(filename):
# save with .json extension need to see if i can remove this
with
open
(
filename
.
replace
(
"
.waln
"
,
"
.json
"
).
replace
(
"
.wwrp
"
,
"
.json
"
),
"
w
"
)
as
f
:
json
.
dump
(
lz_compat_file
,
f
,
indent
=
4
)
for
slice
in
slices
:
if
"
markers
"
in
slice
:
slice
[
"
markers
"
]
=
[
[
marker
[
"
x
"
],
marker
[
"
y
"
],
marker
[
"
nx
"
],
marker
[
"
ny
"
]
]
for
marker
in
slice
[
"
markers
"
]
]
else
:
slices
=
vafile
[
"
slices
"
]
slices
=
propagate
(
slices
)
return
slices
...
...
This diff is collapsed.
Click to expand it.
PyNutil/visualign_deformations.py
+
21
−
2
View file @
723d42ad
"""
This code was written by Gergely Csucs and Rembrandt Bakker
"""
import
numpy
as
np
from
scipy.spatial
import
Delaunay
def
triangulate
(
w
,
h
,
markers
):
vertices
=
[
...
...
@@ -10,6 +9,7 @@ def triangulate(w, h, markers):
[
-
0.1
*
w
,
1.1
*
h
,
-
0.1
*
w
,
1.1
*
h
],
[
1.1
*
w
,
1.1
*
h
,
1.1
*
w
,
1.1
*
h
],
]
edges
=
[
0
]
*
((
len
(
markers
)
+
4
)
*
(
len
(
markers
)
+
4
-
1
)
//
2
)
triangles
=
[
Triangle
(
0
,
1
,
2
,
vertices
,
edges
),
Triangle
(
1
,
2
,
3
,
vertices
,
edges
)]
edges
[
0
]
=
edges
[
1
]
=
edges
[
4
]
=
edges
[
5
]
=
2
...
...
@@ -233,3 +233,22 @@ class Triangle:
+
(
self
.
B
[
1
]
-
self
.
A
[
1
])
*
uv1
[
ok
,
0
]
+
(
self
.
C
[
1
]
-
self
.
A
[
1
])
*
uv1
[
ok
,
1
]
)
##below this is a test
vertices
=
[[
0
,
0
,
43.54623148539514
,
26.174656909777603
],
[
0
,
0
,
90.8065913697207
,
46.20231798893295
],
[
0
,
0
,
56.29635559428633
,
51.23696264352707
],
[
0
,
0
,
90.87928419178107
,
15.497996125973435
],
[
0
,
0
,
33.966820908745454
,
11.999395004637503
],
[
0
,
0
,
37.29543353675751
,
79.4420010252766
]]
triangulation
=
triangulate
(
100
,
100
,
vertices
)
new_coords
=
transform
(
triangulation
,
new_coords
[
0
],
new_coords
[
1
])
from
scipy.spatial
import
Delaunay
# assuming you have a list of points called "points"
tri
=
Delaunay
(
points
)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment