Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jayant Khatkar
tempaware
Commits
54b2c037
Commit
54b2c037
authored
Nov 01, 2021
by
Jayant Khatkar
Browse files
implemented work around for some edge cases
parent
baf8dddd
Changes
1
Hide whitespace changes
Inline
Side-by-side
voxelise.py
View file @
54b2c037
...
@@ -130,7 +130,7 @@ def contour2dict(c):
...
@@ -130,7 +130,7 @@ def contour2dict(c):
return
{
'pos'
:
c
.
pos
,
'time'
:
c
.
time
}
return
{
'pos'
:
c
.
pos
,
'time'
:
c
.
time
}
def
vox_section_area
(
voxels
,
mesh_file_name
):
def
vox_section_area
(
voxels
,
mesh_file_name
,
vox_dim
=
3
):
mesh
=
pv
.
read
(
mesh_file_name
)
mesh
=
pv
.
read
(
mesh_file_name
)
tu
.
transform_to_bed_centre
(
mesh
,
[
110
,
110
,
0
])
tu
.
transform_to_bed_centre
(
mesh
,
[
110
,
110
,
0
])
tu
.
transform_to_z0
(
mesh
)
tu
.
transform_to_z0
(
mesh
)
...
@@ -142,7 +142,6 @@ def vox_section_area(voxels, mesh_file_name):
...
@@ -142,7 +142,6 @@ def vox_section_area(voxels, mesh_file_name):
while
0
in
SecArea
:
while
0
in
SecArea
:
i
=
np
.
where
(
SecArea
==
0
)[
0
][
0
]
i
=
np
.
where
(
SecArea
==
0
)[
0
][
0
]
c
=
voxels
.
iloc
[
i
,
1
:
4
].
to_numpy
()
c
=
voxels
.
iloc
[
i
,
1
:
4
].
to_numpy
()
print
(
c
)
# if new slice required
# if new slice required
if
c
[
2
]
!=
z
:
if
c
[
2
]
!=
z
:
...
@@ -162,10 +161,20 @@ def vox_section_area(voxels, mesh_file_name):
...
@@ -162,10 +161,20 @@ def vox_section_area(voxels, mesh_file_name):
SecArea
[
i
]
=
poly
.
area
SecArea
[
i
]
=
poly
.
area
if
SecArea
[
i
]
==
0
:
if
SecArea
[
i
]
==
0
:
# TODO HACK so it uses neighbour's SecArea
c1
=
voxels
.
iloc
[
i
-
1
,
1
:
4
].
to_numpy
()
SecArea
[
i
]
=
1e7
d1
=
abs
(
sum
(
c
-
c1
))
/
vox_dim
c2
=
voxels
.
iloc
[
i
+
1
,
1
:
4
].
to_numpy
()
d2
=
abs
(
sum
(
c
-
c2
))
/
vox_dim
if
d1
<
1.001
:
SecArea
[
i
]
=
SecArea
[
i
-
1
]
elif
d2
<
1.001
:
SecArea
[
i
]
=
SecArea
[
i
+
1
]
else
:
print
(
"Uh OH rogue voxel"
)
SecArea
[
i
]
=
1e7
if
z
>
3
:
if
z
>
20
:
print
(
set
(
SecArea
))
break
break
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment