Skip to content

Commit

Permalink
fix(AutoML): added more config parsing for CLI (3D shape, input and o…
Browse files Browse the repository at this point in the history
…utput path)
  • Loading branch information
muellerdo committed Jun 24, 2022
1 parent 7c78357 commit 4a23572
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions aucmedi/automl/parser_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#==============================================================================#
# Author: Dominik Müller #
# Copyright: 2022 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
#==============================================================================#
#-----------------------------------------------------#
# Library imports #
#-----------------------------------------------------#
# External libraries
# Internal libraries
#-----------------------------------------------------#
# Parser - CLI #
#-----------------------------------------------------#
def parse_cli(args):
""" Internal function for parsing CLI arguments to a valid configuration
dictionary.
"""
# Parse argument namespace to config dict
config = vars(args)

# Convert variables
if config["hub"] == "training":
# Handle 3D shape - from str to tuple
config["shape_3D"] = tuple(map(int, config["shape_3D"].split("x")))
else:
# Handle input path
config["input"] = config["path_input"]
del config["path_input"]
# Handle output path
config["output"] = config["path_output"]
del config["path_output"]

# Return valid configs
return config

0 comments on commit 4a23572

Please sign in to comment.