Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AnalyseMorphologique
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
INSTANCE de PREPROD
Les données peuvent être supprimées à tout moment.
Show more breadcrumbs
Scanner3D
AnalyseMorphologique
Commits
fb884b82
Commit
fb884b82
authored
1 year ago
by
Djalim Simaila
Browse files
Options
Downloads
Patches
Plain Diff
general improvement
parent
f220783a
No related branches found
No related tags found
1 merge request
!8
General improvement
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
main.py
+30
-7
30 additions, 7 deletions
main.py
utils/files/output.py
+1
-1
1 addition, 1 deletion
utils/files/output.py
utils/graph2D/visplot_render.py
+0
-3
0 additions, 3 deletions
utils/graph2D/visplot_render.py
utils/graph3D/visplot_render.py
+0
-1
0 additions, 1 deletion
utils/graph3D/visplot_render.py
with
31 additions
and
12 deletions
main.py
+
30
−
7
View file @
fb884b82
...
@@ -3,8 +3,9 @@ from utils.files import output
...
@@ -3,8 +3,9 @@ from utils.files import output
from
utils.files.input
import
ScannedObject
from
utils.files.input
import
ScannedObject
from
utils.math.position_manipulation
import
verticalise
from
utils.math.position_manipulation
import
verticalise
from
utils.graph3D.visplot_render
import
render3D
from
utils.graph3D.visplot_render
import
render3D
import
time
def
get_raw_data
(
obj
:
ScannedObject
,
ndigits
:
int
)
->
dict
:
def
get_raw_data
(
obj
:
ScannedObject
,
ndigits
:
int
,
delta_z
:
int
=
1
)
->
dict
:
"""
"""
Calculates data from the given object
Calculates data from the given object
...
@@ -23,7 +24,7 @@ def get_raw_data(obj:ScannedObject, ndigits:int)->dict:
...
@@ -23,7 +24,7 @@ def get_raw_data(obj:ScannedObject, ndigits:int)->dict:
data
=
{}
data
=
{}
for
colone
in
colones
:
for
colone
in
colones
:
data
[
colone
]
=
[]
data
[
colone
]
=
[]
for
discrete_values
in
obj
.
get_discrete_vertices
():
for
discrete_values
in
obj
.
get_discrete_vertices
(
delta_z
):
mean_x
,
mean_y
,
mean_z
=
data_extraction
.
get_x_y_z_mean
(
discrete_values
)
mean_x
,
mean_y
,
mean_z
=
data_extraction
.
get_x_y_z_mean
(
discrete_values
)
for
x
,
y
,
z
in
discrete_values
:
for
x
,
y
,
z
in
discrete_values
:
data
[
"
X (en mm)
"
].
append
(
round
(
x
,
ndigits
))
data
[
"
X (en mm)
"
].
append
(
round
(
x
,
ndigits
))
...
@@ -35,7 +36,7 @@ def get_raw_data(obj:ScannedObject, ndigits:int)->dict:
...
@@ -35,7 +36,7 @@ def get_raw_data(obj:ScannedObject, ndigits:int)->dict:
data
[
"
Yi-Ymoy
"
].
append
(
round
(
y
-
mean_y
,
ndigits
))
data
[
"
Yi-Ymoy
"
].
append
(
round
(
y
-
mean_y
,
ndigits
))
return
data
return
data
def
get_discrete_data
(
obj
:
ScannedObject
,
ndigits
:
int
)
->
dict
:
def
get_discrete_data
(
obj
:
ScannedObject
,
ndigits
:
int
,
delta_z
:
int
=
1
)
->
dict
:
"""
"""
Calculates data from the given object
Calculates data from the given object
...
@@ -52,7 +53,7 @@ def get_discrete_data(obj:ScannedObject, ndigits:int)->dict:
...
@@ -52,7 +53,7 @@ def get_discrete_data(obj:ScannedObject, ndigits:int)->dict:
data
=
{}
data
=
{}
for
colone
in
colones
:
for
colone
in
colones
:
data
[
colone
]
=
[]
data
[
colone
]
=
[]
for
discrete_values
in
obj
.
get_discrete_vertices
():
for
discrete_values
in
obj
.
get_discrete_vertices
(
delta_z
):
x
,
y
,
z
=
data_extraction
.
get_x_y_z_mean
(
discrete_values
)
x
,
y
,
z
=
data_extraction
.
get_x_y_z_mean
(
discrete_values
)
data
[
"
X moy (en mm)
"
].
append
(
round
(
x
,
ndigits
))
data
[
"
X moy (en mm)
"
].
append
(
round
(
x
,
ndigits
))
data
[
"
Y moy (en mm)
"
].
append
(
round
(
y
,
ndigits
))
data
[
"
Y moy (en mm)
"
].
append
(
round
(
y
,
ndigits
))
...
@@ -66,12 +67,26 @@ def get_discrete_data(obj:ScannedObject, ndigits:int)->dict:
...
@@ -66,12 +67,26 @@ def get_discrete_data(obj:ScannedObject, ndigits:int)->dict:
def
main
():
def
main
():
# Create an object from the given file
# Create an object from the given file
total_time
=
time
.
time
()
print
(
"
Loading file...
"
)
t
=
time
.
time
()
obj
=
ScannedObject
.
from_obj_file
(
"
datasets/Barette/1 - BARETTE.obj
"
)
obj
=
ScannedObject
.
from_obj_file
(
"
datasets/Barette/1 - BARETTE.obj
"
)
print
(
"
File loaded in {} seconds
"
.
format
(
time
.
time
()
-
t
))
t
=
time
.
time
()
print
(
"
Verticalising object...
"
)
verticalise
(
obj
)
verticalise
(
obj
)
print
(
"
Object verticalised in {} seconds
"
.
format
(
time
.
time
()
-
t
))
t
=
time
.
time
()
print
(
"
Normalising object...
"
)
obj
.
normalise
()
obj
.
normalise
()
print
(
"
Object normalised in {} seconds
"
.
format
(
time
.
time
()
-
t
))
# Calculate raw data and save it in a file
# Calculate raw data and save it in a file
data
=
get_raw_data
(
obj
,
6
)
t
=
time
.
time
()
data
=
get_raw_data
(
obj
,
6
,
2
)
print
(
"
Raw data calculated in {} seconds
"
.
format
(
time
.
time
()
-
t
))
t
=
time
.
time
()
print
(
"
Saving data...
"
)
output
.
save_output_file
(
'
analyse_brute.txt
'
,
output
.
save_output_file
(
'
analyse_brute.txt
'
,
output
.
format_data
(
data
,
output
.
format_data
(
data
,
'
\t
'
,
'
\t
'
,
...
@@ -82,9 +97,15 @@ def main():
...
@@ -82,9 +97,15 @@ def main():
"
rayon (en mm)
"
,
"
rayon (en mm)
"
,
"
Xi-Xmoy
"
,
"
Xi-Xmoy
"
,
"
Yi-Ymoy
"
]
))
"
Yi-Ymoy
"
]
))
print
(
"
Data saved in {} seconds
"
.
format
(
time
.
time
()
-
t
))
# Calculate discrete data and save it in a file
# Calculate discrete data and save it in a file
data
=
get_discrete_data
(
obj
,
6
)
t
=
time
.
time
()
print
(
"
Calculating discrete data...
"
)
data
=
get_discrete_data
(
obj
,
6
,
2
)
print
(
"
Discrete data calculated in {} seconds
"
.
format
(
time
.
time
()
-
t
))
t
=
time
.
time
()
print
(
"
Saving data...
"
)
output
.
save_output_file
(
'
analyse_rayon.txt
'
,
output
.
save_output_file
(
'
analyse_rayon.txt
'
,
output
.
format_data
(
data
,
output
.
format_data
(
data
,
'
\t
'
,
'
\t
'
,
...
@@ -94,6 +115,8 @@ def main():
...
@@ -94,6 +115,8 @@ def main():
"
Delta z(en mm)
"
,
"
Delta z(en mm)
"
,
"
Rayon moyen (en mm)
"
,
"
Rayon moyen (en mm)
"
,
"
Rayon ecart type (en mm)
"
]
))
"
Rayon ecart type (en mm)
"
]
))
print
(
"
Data saved in {} seconds
"
.
format
(
time
.
time
()
-
t
))
print
(
"
Total time : {} seconds
"
.
format
(
time
.
time
()
-
total_time
))
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
main
()
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
utils/files/output.py
+
1
−
1
View file @
fb884b82
...
@@ -32,7 +32,7 @@ def format_data(data:dict, separator:str, selected_columns:list = None) -> str:
...
@@ -32,7 +32,7 @@ def format_data(data:dict, separator:str, selected_columns:list = None) -> str:
output
+=
'
\n
'
output
+=
'
\n
'
for
i
in
range
(
len
(
data
[
selected_columns
[
0
]])):
for
i
in
range
(
len
(
data
[
selected_columns
[
0
]])):
for
column
in
selected_columns
:
for
column
in
selected_columns
:
output
+=
str
(
data
[
column
][
i
]).
ljust
(
len
(
column
))
+
separator
output
+=
str
(
data
[
column
][
i
]).
ljust
(
len
(
column
)
if
len
(
column
)
>
6
else
7
)
+
separator
output
+=
'
\n
'
output
+=
'
\n
'
return
output
return
output
...
...
This diff is collapsed.
Click to expand it.
utils/graph2D/visplot_render.py
+
0
−
3
View file @
fb884b82
import
vispy.plot
as
vp
import
vispy.plot
as
vp
import
numpy
as
np
import
numpy
as
np
def
render2D
(
values
:
list
):
def
render2D
(
values
:
list
):
fig
=
vp
.
Fig
(
size
=
(
600
,
500
),
show
=
False
)
fig
=
vp
.
Fig
(
size
=
(
600
,
500
),
show
=
False
)
plotwidget
=
fig
[
0
,
0
]
plotwidget
=
fig
[
0
,
0
]
...
@@ -11,7 +9,6 @@ def render2D(values:list):
...
@@ -11,7 +9,6 @@ def render2D(values:list):
plotwidget
.
colorbar
(
position
=
"
top
"
,
cmap
=
"
autumn
"
)
plotwidget
.
colorbar
(
position
=
"
top
"
,
cmap
=
"
autumn
"
)
fig
.
show
(
run
=
True
)
fig
.
show
(
run
=
True
)
def
cross_section
(
x
:
list
,
y
:
list
):
def
cross_section
(
x
:
list
,
y
:
list
):
color
=
(
0.3
,
0.5
,
0.8
)
color
=
(
0.3
,
0.5
,
0.8
)
fig
=
vp
.
Fig
(
show
=
False
)
fig
=
vp
.
Fig
(
show
=
False
)
...
...
This diff is collapsed.
Click to expand it.
utils/graph3D/visplot_render.py
+
0
−
1
View file @
fb884b82
import
numpy
as
np
import
numpy
as
np
from
vispy
import
app
,
scene
from
vispy
import
app
,
scene
from
vispy.scene.visuals
import
Mesh
from
vispy.scene.visuals
import
Mesh
from
vispy.scene
import
transforms
from
vispy.visuals.filters
import
ShadingFilter
,
WireframeFilter
from
vispy.visuals.filters
import
ShadingFilter
,
WireframeFilter
from
utils.files.input
import
ScannedObject
from
utils.files.input
import
ScannedObject
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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