From 2e44ab9a2db62de54503fdcaef5e601418fee969 Mon Sep 17 00:00:00 2001 From: valosekj Date: Thu, 12 Dec 2024 14:31:11 -0500 Subject: [PATCH 1/3] Set the default value for -path-label to match -path-img --- manual_correction.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/manual_correction.py b/manual_correction.py index 89a1a0e..2bcb698 100644 --- a/manual_correction.py +++ b/manual_correction.py @@ -107,9 +107,8 @@ def get_parser(): metavar="", 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( @@ -758,16 +757,13 @@ 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) From 34be426341be6c48450dd5d9b329c5b06faea806 Mon Sep 17 00:00:00 2001 From: valosekj Date: Thu, 12 Dec 2024 14:31:45 -0500 Subject: [PATCH 2/3] fix indentation --- manual_correction.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manual_correction.py b/manual_correction.py index 2bcb698..6aa4e52 100644 --- a/manual_correction.py +++ b/manual_correction.py @@ -768,9 +768,9 @@ def main(): # 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 From a43955f3c283dc8fdc11937e9630723e7923f2da Mon Sep 17 00:00:00 2001 From: valosekj Date: Thu, 12 Dec 2024 14:31:56 -0500 Subject: [PATCH 3/3] clarify description --- manual_correction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manual_correction.py b/manual_correction.py index 6aa4e52..0a81351 100644 --- a/manual_correction.py +++ b/manual_correction.py @@ -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') )