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
d6a9b3a9
Commit
d6a9b3a9
authored
2 months ago
by
polarbean
Browse files
Options
Downloads
Patches
Plain Diff
update to use 64 bit floats
parent
3c26a751
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
PyNutil/processing/visualign_deformations.py
+6
-5
6 additions, 5 deletions
PyNutil/processing/visualign_deformations.py
workflows/basic_example_custom_atlas.py
+3
-3
3 additions, 3 deletions
workflows/basic_example_custom_atlas.py
with
9 additions
and
8 deletions
PyNutil/processing/visualign_deformations.py
+
6
−
5
View file @
d6a9b3a9
...
@@ -4,13 +4,14 @@ import numpy as np
...
@@ -4,13 +4,14 @@ import numpy as np
def
triangulate
(
w
,
h
,
markers
):
def
triangulate
(
w
,
h
,
markers
):
vertices
=
[
vertices
=
[
[
-
0.1
*
w
,
-
0.1
*
h
,
-
0.1
*
w
,
-
0.1
*
h
],
[
-
0.1
*
w
,
-
0.1
*
h
,
-
0.1
*
w
,
-
0.1
*
h
],
[
1.1
*
w
,
-
0.1
*
h
,
1.1
*
w
,
-
0.1
*
h
],
[
1.1
*
w
,
-
0.1
*
h
,
1.1
*
w
,
-
0.1
*
h
],
[
-
0.1
*
w
,
1.1
*
h
,
-
0.1
*
w
,
1.1
*
h
],
[
-
0.1
*
w
,
1.1
*
h
,
-
0.1
*
w
,
1.1
*
h
],
[
1.1
*
w
,
1.1
*
h
,
1.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
)
edges
=
[
0
]
*
((
len
(
markers
)
+
4
)
*
(
len
(
markers
)
+
4
-
1
)
//
2
)
triangles
=
[
Triangle
(
0
,
1
,
2
,
vertices
,
edges
),
Triangle
(
1
,
2
,
3
,
vertices
,
edges
)]
triangles
=
[
Triangle
(
0
,
1
,
2
,
vertices
,
edges
),
Triangle
(
1
,
2
,
3
,
vertices
,
edges
)]
edges
[
0
]
=
edges
[
1
]
=
edges
[
4
]
=
edges
[
5
]
=
2
edges
[
0
]
=
edges
[
1
]
=
edges
[
4
]
=
edges
[
5
]
=
2
...
@@ -59,8 +60,8 @@ def transform(triangulation, x, y):
...
@@ -59,8 +60,8 @@ def transform(triangulation, x, y):
def
transform_vec
(
triangulation
,
x
,
y
):
def
transform_vec
(
triangulation
,
x
,
y
):
xPrime
=
np
.
zeros
(
x
.
shape
,
float
)
xPrime
=
np
.
zeros
(
x
.
shape
,
np
.
float
64
)
yPrime
=
np
.
zeros
(
y
.
shape
,
float
)
yPrime
=
np
.
zeros
(
y
.
shape
,
np
.
float
64
)
for
triangle
in
triangulation
:
for
triangle
in
triangulation
:
triangle
.
intriangle_vec
(
x
,
y
,
xPrime
,
yPrime
)
triangle
.
intriangle_vec
(
x
,
y
,
xPrime
,
yPrime
)
return
(
xPrime
,
yPrime
)
return
(
xPrime
,
yPrime
)
...
@@ -82,8 +83,8 @@ def forwardtransform(triangulation, x, y):
...
@@ -82,8 +83,8 @@ def forwardtransform(triangulation, x, y):
# xy: 2-dimensional array with one xy-pair per row
# xy: 2-dimensional array with one xy-pair per row
def
forwardtransform_vec
(
triangulation
,
x
,
y
):
def
forwardtransform_vec
(
triangulation
,
x
,
y
):
xPrime
=
np
.
zeros
(
x
.
shape
,
float
)
xPrime
=
np
.
zeros
(
x
.
shape
,
np
.
float
64
)
yPrime
=
np
.
zeros
(
y
.
shape
,
float
)
yPrime
=
np
.
zeros
(
y
.
shape
,
np
.
float
64
)
for
triangle
in
triangulation
:
for
triangle
in
triangulation
:
triangle
.
inforward_vec
(
x
,
y
,
xPrime
,
yPrime
)
triangle
.
inforward_vec
(
x
,
y
,
xPrime
,
yPrime
)
return
(
xPrime
,
yPrime
)
return
(
xPrime
,
yPrime
)
...
...
This diff is collapsed.
Click to expand it.
workflows/basic_example_custom_atlas.py
+
3
−
3
View file @
d6a9b3a9
...
@@ -15,12 +15,12 @@ from PyNutil import PyNutil
...
@@ -15,12 +15,12 @@ from PyNutil import PyNutil
### get_coordinates, if use_flat=True, place flat files in folder titled "flat_files" at same level as "segmentations" folder
### get_coordinates, if use_flat=True, place flat files in folder titled "flat_files" at same level as "segmentations" folder
pnt
=
PyNutil
(
pnt
=
PyNutil
(
segmentation_folder
=
"
../tests/test_data/
non
linear_allen_mouse/
"
,
segmentation_folder
=
"
../tests/test_data/linear_allen_mouse/
"
,
alignment_json
=
"
../tests/test_data/
non
linear_allen_mouse/alignment.json
"
,
alignment_json
=
"
../tests/test_data/linear_allen_mouse/alignment
_linear
.json
"
,
colour
=
[
0
,
0
,
0
],
colour
=
[
0
,
0
,
0
],
atlas_path
=
"
../tests/test_data/allen_mouse_2017_atlas/annotation_25_reoriented_2017.nrrd
"
,
atlas_path
=
"
../tests/test_data/allen_mouse_2017_atlas/annotation_25_reoriented_2017.nrrd
"
,
label_path
=
"
../tests/test_data/allen_mouse_2017_atlas//allen2017_colours.csv
"
,
label_path
=
"
../tests/test_data/allen_mouse_2017_atlas//allen2017_colours.csv
"
,
)
)
pnt
.
get_coordinates
(
object_cutoff
=
0
,
use_flat
=
False
)
pnt
.
get_coordinates
(
object_cutoff
=
0
,
use_flat
=
False
)
pnt
.
quantify_coordinates
()
pnt
.
quantify_coordinates
()
pnt
.
save_analysis
(
"
../test_result/test_
non
linear_allen_mouse
"
)
pnt
.
save_analysis
(
"
../test_result/test_linear_allen_mouse
"
)
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