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
Commits
86c301c5
Commit
86c301c5
authored
1 year ago
by
Christian Kento Rasmussen
Browse files
Options
Downloads
Patches
Plain Diff
added convert options to command line
parent
160662cc
No related branches found
No related tags found
1 merge request
!102
Conv zarr tiff folders
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
qim3d/io/convert.py
+3
-2
3 additions, 2 deletions
qim3d/io/convert.py
qim3d/utils/cli.py
+3
-1
3 additions, 1 deletion
qim3d/utils/cli.py
with
6 additions
and
3 deletions
qim3d/io/convert.py
+
3
−
2
View file @
86c301c5
...
...
@@ -184,13 +184,14 @@ class Convert:
save
(
nifti_path
,
z
,
compression
=
compression
)
def
convert
(
input_path
:
str
,
output_path
:
str
,
chunk_shape
:
tuple
=
(
64
,
64
,
64
)):
def
convert
(
input_path
:
str
,
output_path
:
str
,
chunk_shape
:
tuple
=
(
64
,
64
,
64
)
,
base_name
:
str
=
None
):
"""
Convert a file to another format without loading the entire file into memory
Args:
input_path (str): path to the input file
output_path (str): path to the output file
chunk_shape (tuple, optional): chunk size for the zarr file. Defaults to (64, 64, 64).
base_name (str, optional): base name for the tiff stack. Defaults to None.
"""
converter
=
Convert
(
chunk_shape
=
chunk_shape
)
converter
=
Convert
(
chunk_shape
=
chunk_shape
,
base_name
=
base_name
)
converter
.
convert
(
input_path
,
output_path
)
This diff is collapsed.
Click to expand it.
qim3d/utils/cli.py
+
3
−
1
View file @
86c301c5
...
...
@@ -84,6 +84,8 @@ def main():
preview_parser
=
subparsers
.
add_parser
(
'
convert
'
,
help
=
'
Convert files to different formats without loading the entire file into memory
'
)
preview_parser
.
add_argument
(
'
input_path
'
,
type
=
str
,
metavar
=
'
Input path
'
,
help
=
'
Path to image that will be converted
'
)
preview_parser
.
add_argument
(
'
output_path
'
,
type
=
str
,
metavar
=
'
Output path
'
,
help
=
'
Path to save converted image
'
)
preview_parser
.
add_argument
(
'
chunk_shape
'
,
type
=
tuple
,
metavar
=
'
Chunk shape
'
,
help
=
'
Chunk size for the zarr file
'
,
default
=
(
64
,
64
,
64
))
preview_parser
.
add_argument
(
'
base_name
'
,
type
=
str
,
metavar
=
'
Base name
'
,
help
=
'
Base name for the zarr file
'
,
default
=
None
)
args
=
parser
.
parse_args
()
...
...
@@ -171,7 +173,7 @@ def main():
print
(
"
\n
"
)
elif
args
.
subcommand
==
'
convert
'
:
qim3d
.
io
.
convert
(
args
.
input_path
,
args
.
output_path
)
qim3d
.
io
.
convert
(
args
.
input_path
,
args
.
output_path
,
args
.
chunk_shape
,
args
.
base_name
)
if
__name__
==
"
__main__
"
:
...
...
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