Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the default value for -path-label to match -path-img #106

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions manual_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def get_parser():
description='Manual correction of spinal cord segmentation, gray matter segmentation, MS and SCI lesion '
'segmentation, disc labels, compression labels, ponto-medullary junction (PMJ) label, and '
'centerline. '
'Manually corrected files will be saved under derivatives/ folder (according to BIDS standard).',
'Manually corrected files will be saved under derivatives/labels folder (according to BIDS '
'standard) if not specified otherwise.',
formatter_class=utils.SmartFormatter,
prog=os.path.basename(__file__).strip('.py')
)
Expand Down Expand Up @@ -107,9 +108,8 @@ def get_parser():
metavar="<folder>",
help=
"R|Full path to the folder with labels (BIDS-compliant). "
"\nIf labels are located in the same folder as the images, provide the same path as '-path-img', for example "
"'output/data_processed'."
"\nIf not provided, '-path-img' + 'derivatives/labels' will be used. ",
"\nIf not provided, '-path-img' will be used (assuming that the labels are in the same folder as images). "
"\nIf your labels are already under 'derivatives/labels', provide the full path to this folder. ",
default=''
)
parser.add_argument(
Expand Down Expand Up @@ -758,23 +758,20 @@ def main():
'FILES_CENTERLINE': args.suffix_files_centerline # e.g., _centerline or _label-centerline
}
path_img = utils.get_full_path(args.path_img)

if args.path_label == '':
path_label = os.path.join(path_img, "derivatives/labels")
else:
path_label = utils.get_full_path(args.path_label)

if args.path_out == '':
path_out = os.path.join(path_img, "derivatives/labels")
else:
path_out = utils.get_full_path(args.path_out)

# If labels are in the same folder as the images, set path_label to path_img
path_label = path_img if args.path_label == '' else utils.get_full_path(args.path_label)

# If not specified, output folder for corrected labels is derivatives/labels in the input folder
path_out = os.path.join(path_img, "derivatives/labels") if args.path_out == '' else utils.get_full_path(
args.path_out)

# Print parsed arguments
logging.info("-" * 100)
logging.info("Parsing of arguments:")
logging.info(" Input folder ('-path-img') .............. " + path_img)
logging.info(" Label folder ('-path-label') .............. " + path_label)
logging.info(" Output folder ('-path-out') ............. " + path_out)
logging.info(" Input folder ('-path-img'): " + path_img)
logging.info(" Label folder ('-path-label'): " + path_label)
logging.info(" Output folder ('-path-out'): " + path_out)
logging.info("-" * 100)

# check that output folder exists or create it
Expand Down
Loading