From be73315cf6b30e4a0903c34811bc463b823dd20e Mon Sep 17 00:00:00 2001 From: valosekj Date: Fri, 2 Feb 2024 08:14:55 -0500 Subject: [PATCH] `Manually corrected` --> `Manual` Context: https://github.com/spinalcordtoolbox/manual-correction/pull/76#issuecomment-1922454576 --- manual_correction.py | 2 +- tests/test_create_json.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manual_correction.py b/manual_correction.py index 646f6ec..ce3cb98 100644 --- a/manual_correction.py +++ b/manual_correction.py @@ -525,7 +525,7 @@ def update_json(fname_nifti, name_rater, modified): # If the label was modified, add "Name": "Manual" to the JSON sidecar if modified: - json_dict['GeneratedBy'].append({'Name': 'Manually corrected', + json_dict['GeneratedBy'].append({'Name': 'Manual', 'Author': name_rater, 'Date': time.strftime('%Y-%m-%d %H:%M:%S')}) # If the was not modified, add "Name": ""Visually verified"" to the JSON sidecar diff --git a/tests/test_create_json.py b/tests/test_create_json.py index db70129..43b5ac7 100644 --- a/tests/test_create_json.py +++ b/tests/test_create_json.py @@ -26,7 +26,7 @@ def test_create_json_modified_true(tmp_path): # Check that the JSON file was created and contains the expected metadata expected_metadata = {'SpatialReference': 'orig', - 'GeneratedBy': [{'Name': 'Manually corrected', + 'GeneratedBy': [{'Name': 'Manual', 'Author': "Test Rater", 'Date': time.strftime('%Y-%m-%d %H:%M:%S')}]} json_file = tmp_path / fname_label.replace(".nii.gz", ".json") @@ -74,7 +74,7 @@ def test_update_json_modified_true(tmp_path): json_file = tmp_path / fname_label.replace(".nii.gz", ".json") with open(str(json_file), "w") as f: json.dump({'SpatialReference': 'orig', - 'GeneratedBy': [{'Name': 'Manually corrected', + 'GeneratedBy': [{'Name': 'Manual', 'Author': "Test Rater 1", 'Date': "2023-01-01 00:00:00"}]}, f) @@ -83,10 +83,10 @@ def test_update_json_modified_true(tmp_path): # Check that the JSON file was created and contains the expected metadata expected_metadata = {'SpatialReference': 'orig', - 'GeneratedBy': [{'Name': 'Manually corrected', + 'GeneratedBy': [{'Name': 'Manual', 'Author': "Test Rater 1", 'Date': "2023-01-01 00:00:00"}, - {'Name': 'Manually corrected', + {'Name': 'Manual', 'Author': "Test Rater 2", 'Date': time.strftime('%Y-%m-%d %H:%M:%S')}]} json_file = tmp_path / fname_label.replace(".nii.gz", ".json") @@ -109,7 +109,7 @@ def test_update_json_modified_false(tmp_path): json_file = tmp_path / fname_label.replace(".nii.gz", ".json") with open(str(json_file), "w") as f: json.dump({'SpatialReference': 'orig', - 'GeneratedBy': [{'Name': 'Manually corrected', + 'GeneratedBy': [{'Name': 'Manual', 'Author': "Test Rater 1", 'Date': "2023-01-01 00:00:00"}]}, f) @@ -118,7 +118,7 @@ def test_update_json_modified_false(tmp_path): # Check that the JSON file was created and contains the expected metadata expected_metadata = {'SpatialReference': 'orig', - 'GeneratedBy': [{'Name': 'Manually corrected', + 'GeneratedBy': [{'Name': 'Manual', 'Author': "Test Rater 1", 'Date': "2023-01-01 00:00:00"}, {'Name': 'Visually verified',