@@ -483,27 +483,11 @@ def get_modification_time(fname):
483
483
return datetime .datetime .fromtimestamp (os .path .getmtime (fname ))
484
484
485
485
486
- def check_if_modified (time_one , time_two ):
487
- """
488
- Check if the file was modified by the user. Return True if the file was modified, False otherwise.
489
- :param time_one: modification time of the file before viewing
490
- :param time_two: modification time of the file after viewing
491
- :return:
492
- """
493
- if time_one != time_two :
494
- print ("The label file was modified." )
495
- return True
496
- else :
497
- print ("The label file was not modified." )
498
- return False
499
-
500
-
501
- def update_json (fname_nifti , name_rater , modified ):
486
+ def update_json (fname_nifti , name_rater ):
502
487
"""
503
488
Create/update JSON sidecar with meta information
504
489
:param fname_nifti: str: File name of the nifti image to associate with the JSON sidecar
505
490
:param name_rater: str: Name of the expert rater
506
- :param modified: bool: True if the file was modified by the user
507
491
:return:
508
492
"""
509
493
fname_json = fname_nifti .replace ('.gz' , '' ).replace ('.nii' , '.json' )
@@ -523,16 +507,10 @@ def update_json(fname_nifti, name_rater, modified):
523
507
json_dict = {'SpatialReference' : 'orig' ,
524
508
'GeneratedBy' : []}
525
509
526
- # If the label was modified, add "Name": "Manual" to the JSON sidecar
527
- if modified :
528
- json_dict ['GeneratedBy' ].append ({'Name' : 'Manual' ,
529
- 'Author' : name_rater ,
530
- 'Date' : time .strftime ('%Y-%m-%d %H:%M:%S' )})
531
- # If the was not modified, add "Name": ""Visually verified"" to the JSON sidecar
532
- else :
533
- json_dict ['GeneratedBy' ].append ({'Name' : 'Visually verified' ,
534
- 'Author' : name_rater ,
535
- 'Date' : time .strftime ('%Y-%m-%d %H:%M:%S' )})
510
+ # If the label was modified or just checked, add "Name": "Manual" to the JSON sidecar
511
+ json_dict ['GeneratedBy' ].append ({'Name' : 'Manual' ,
512
+ 'Author' : name_rater ,
513
+ 'Date' : time .strftime ('%Y-%m-%d %H:%M:%S' )})
536
514
537
515
# Write the data to the JSON file
538
516
with open (fname_json , 'w' ) as outfile : # w to overwrite the file
@@ -895,11 +873,10 @@ def main():
895
873
if args .add_seg_only :
896
874
# We are passing modified=True because we are adding a new segmentation and we want
897
875
# to create a JSON file
898
- update_json (fname_out , name_rater , modified = True )
876
+ update_json (fname_out , name_rater )
899
877
# Generate QC report
900
878
else :
901
- modified = check_if_modified (time_one , time_two )
902
- update_json (fname_out , name_rater , modified )
879
+ update_json (fname_out , name_rater )
903
880
# Generate QC report
904
881
generate_qc (fname , fname_out , task , fname_qc , subject , args .config , args .qc_lesion_plane , suffix_dict )
905
882
0 commit comments