Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qim3d
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QIM
Tools
qim3d
Merge requests
!54
K3d
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
K3d
k3d
into
main
Overview
0
Commits
6
Pipelines
0
Changes
3
Merged
fima
requested to merge
k3d
into
main
1 year ago
Overview
0
Commits
6
Pipelines
0
Changes
3
Basic functionality for k3d plots.
Includes CLI for launching the visualization
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
573118a9
6 commits,
1 year ago
3 files
+
76
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
qim3d/utils/cli.py
+
28
−
1
View file @ 573118a9
Edit in single-file editor
Open in Web IDE
Show full file
import
argparse
import
qim3d
import
webbrowser
from
qim3d.gui
import
data_explorer
,
iso3d
,
annotation_tool
,
local_thickness
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'
Qim3d command-line interface.
'
)
subparsers
=
parser
.
add_subparsers
(
title
=
'
Subcommands
'
,
dest
=
'
subcommand
'
)
#
subcommand
s
#
GUI
s
gui_parser
=
subparsers
.
add_parser
(
'
gui
'
,
help
=
'
Graphical User Interfaces.
'
)
gui_parser
.
add_argument
(
'
--data-explorer
'
,
action
=
'
store_true
'
,
help
=
'
Run data explorer.
'
)
@@ -15,6 +17,11 @@ def main():
gui_parser
.
add_argument
(
'
--host
'
,
default
=
'
0.0.0.0
'
,
help
=
'
Desired host.
'
)
gui_parser
.
add_argument
(
'
--platform
'
,
action
=
'
store_true
'
,
help
=
'
Use QIM platform address
'
)
# K3D
viz_parser
=
subparsers
.
add_parser
(
'
viz
'
,
help
=
'
Volumetric visualization.
'
)
viz_parser
.
add_argument
(
'
--source
'
,
default
=
False
,
help
=
'
Path to the image file
'
)
viz_parser
.
add_argument
(
'
--destination
'
,
default
=
'
k3d.html
'
,
help
=
'
Path to save html file.
'
)
viz_parser
.
add_argument
(
'
--no-browser
'
,
action
=
'
store_true
'
,
help
=
'
Do not launch browser.
'
)
args
=
parser
.
parse_args
()
@@ -47,5 +54,25 @@ def main():
else
:
interface
=
local_thickness
.
Interface
()
interface
.
launch
()
if
args
.
subcommand
==
"
viz
"
:
if
not
args
.
source
:
print
(
"
Please specify a source file using the argument --source
"
)
return
# Load the data
print
(
f
"
Loading data from
{
args
.
source
}
"
)
volume
=
qim3d
.
io
.
load
(
str
(
args
.
source
))
print
(
f
"
Done, volume shape:
{
volume
.
shape
}
"
)
# Make k3d plot
print
(
"
\n
Generating k3d plot...
"
)
qim3d
.
viz
.
vol
(
volume
,
show
=
False
,
save
=
str
(
args
.
destination
))
print
(
f
"
Done, plot available at <
{
args
.
destination
}
>
"
)
if
not
args
.
no_browser
:
print
(
"
Opening in default browser...
"
)
webbrowser
.
open_new_tab
(
args
.
destination
)
if
__name__
==
'
__main__
'
:
main
()
\ No newline at end of file
Loading