Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
navipy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
Olivier Bertrand
navipy
Commits
56ff818e
Commit
56ff818e
authored
6 years ago
by
Olivier Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Improve loading of the image in database
parent
182b80f0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
navipy/database/__init__.py
+14
-0
14 additions, 0 deletions
navipy/database/__init__.py
navipy/scripts/blend_alongtraj.py
+12
-2
12 additions, 2 deletions
navipy/scripts/blend_alongtraj.py
navipy/scripts/blendnavipy.py
+14
-4
14 additions, 4 deletions
navipy/scripts/blendnavipy.py
with
40 additions
and
6 deletions
navipy/database/__init__.py
+
14
−
0
View file @
56ff818e
...
@@ -704,6 +704,20 @@ class DataBase():
...
@@ -704,6 +704,20 @@ class DataBase():
WHERE (rowid=?)
WHERE (rowid=?)
"""
.
format
(
tablename
),
(
rowid
,))
"""
.
format
(
tablename
),
(
rowid
,))
image
=
self
.
db_cursor
.
fetchone
()[
0
]
image
=
self
.
db_cursor
.
fetchone
()[
0
]
# Check image size
# and try to correct it whenever possible
if
not
isinstance
(
image
,
np
.
ndarray
):
msg
=
'
image must be np.array
'
self
.
_logger
.
exception
(
msg
)
raise
TypeError
(
msg
)
if
len
(
image
.
shape
)
>
3
:
if
np
.
all
(
image
.
shape
[
3
:]
==
np
.
ones_like
(
image
.
shape
[
3
:])):
image
=
image
[:,
:,
:,
0
]
# Other dim are useless
if
len
(
image
.
shape
)
!=
3
:
msg
=
'
image should be 3D array
'
msg
+=
'
image size is {}
'
.
format
(
image
.
shape
)
self
.
_logger
.
exception
(
msg
)
raise
Exception
(
msg
)
# Read cmaxminrange
# Read cmaxminrange
tablename
=
'
normalisation
'
tablename
=
'
normalisation
'
cmaxminrange
=
pd
.
read_sql_query
(
cmaxminrange
=
pd
.
read_sql_query
(
...
...
This diff is collapsed.
Click to expand it.
navipy/scripts/blend_alongtraj.py
+
12
−
2
View file @
56ff818e
...
@@ -56,7 +56,12 @@ def parser_blend_alongtraj():
...
@@ -56,7 +56,12 @@ def parser_blend_alongtraj():
type
=
str
,
type
=
str
,
default
=
None
,
default
=
None
,
help
=
arghelp
)
help
=
arghelp
)
arghelp
=
'
To ignore the autocheck of python version
'
arghelp
+=
'
and blender
'
parser
.
add_argument
(
'
--ignorepycheck
'
,
default
=
0
,
help
=
arghelp
,
action
=
'
count
'
)
return
parser
return
parser
...
@@ -100,14 +105,19 @@ def main():
...
@@ -100,14 +105,19 @@ def main():
tfile
.
write
(
'
except Exception:
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
except Exception:
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
sys.exit(1)
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
sys.exit(1)
\n
'
.
encode
(
encoding
))
tfile
.
seek
(
0
)
tfile
.
seek
(
0
)
if
args
.
ignorepycheck
==
0
:
ignorepyversion
=
''
else
:
ignorepyversion
=
'
--ignorepycheck
'
command
=
'
blendnavipy --background
'
command
=
'
blendnavipy --background
{}
'
.
format
(
ignorepyversion
)
command
+=
'
--blender-world {} --python-script {}
'
command
+=
'
--blender-world {} --python-script {}
'
command
=
command
.
format
(
args
.
blender_world
,
tfile
.
name
)
command
=
command
.
format
(
args
.
blender_world
,
tfile
.
name
)
if
args
.
blender_command
is
not
None
:
if
args
.
blender_command
is
not
None
:
command
+=
'
--blender-command {}
'
.
format
(
args
.
blender_command
)
command
+=
'
--blender-command {}
'
.
format
(
args
.
blender_command
)
for
_
in
range
(
args
.
verbose
):
for
_
in
range
(
args
.
verbose
):
command
+=
'
-v
'
command
+=
'
-v
'
print
(
command
)
os
.
system
(
command
)
os
.
system
(
command
)
...
...
This diff is collapsed.
Click to expand it.
navipy/scripts/blendnavipy.py
+
14
−
4
View file @
56ff818e
...
@@ -82,6 +82,13 @@ def parser_blendnavipy():
...
@@ -82,6 +82,13 @@ def parser_blendnavipy():
action
=
'
count
'
,
action
=
'
count
'
,
default
=
0
,
default
=
0
,
help
=
arghelp
)
help
=
arghelp
)
arghelp
=
'
To ignore the autocheck of python version
'
arghelp
+=
'
and blender
'
parser
.
add_argument
(
'
--ignorepycheck
'
,
default
=
0
,
help
=
arghelp
,
action
=
'
count
'
)
return
parser
return
parser
...
@@ -120,14 +127,17 @@ def main():
...
@@ -120,14 +127,17 @@ def main():
with
tempfile
.
NamedTemporaryFile
()
as
tfile
:
with
tempfile
.
NamedTemporaryFile
()
as
tfile
:
# Start of file
# Start of file
tfile
.
write
(
header
.
encode
(
encoding
))
tfile
.
write
(
header
.
encode
(
encoding
))
# Check blender version
tfile
.
write
(
'
# check blender version
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
# check blender version
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
import sys
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
import sys
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
import os
\n
'
.
encode
(
encoding
))
tfile
.
write
(
'
import os
\n
'
.
encode
(
encoding
))
for
line
in
inspect
.
getsourcelines
(
blender_version
)[
0
]:
if
args
.
ignorepycheck
==
0
:
for
line
in
inspect
.
getsourcelines
(
blender_version
)[
0
]:
tfile
.
write
(
line
.
encode
(
encoding
))
tfile
.
write
(
'
\n\n
'
.
encode
(
encoding
))
line
=
'
blender_version({})
\n
'
.
format
(
pyver
)
tfile
.
write
(
line
.
encode
(
encoding
))
tfile
.
write
(
line
.
encode
(
encoding
))
tfile
.
write
(
'
\n\n
'
.
encode
(
encoding
))
# Load venv
line
=
'
blender_version({})
\n
'
.
format
(
pyver
)
tfile
.
write
(
line
.
encode
(
encoding
))
if
venv_path
is
not
None
:
if
venv_path
is
not
None
:
tfile
.
write
(
tfile
.
write
(
'
# activate virtualenv within blender
\n
'
.
encode
(
encoding
))
'
# activate virtualenv within blender
\n
'
.
encode
(
encoding
))
...
...
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