From ab88e1d00d1b9882e52d8a0c3ce7971593a66049 Mon Sep 17 00:00:00 2001 From: karthikmasi Date: Wed, 4 Mar 2020 16:05:52 -0600 Subject: [PATCH] changed get_full_object and list_project_assessors to be called from object interface(xnat) --- bin/Xnat_tools/XnatNDAR | 8 ++++---- bin/Xnat_tools/Xnatdl | 3 +-- bin/Xnat_tools/Xnatinfo | 2 +- bin/Xnat_tools/Xnatsessionupdate | 4 ++-- bin/freesurfer_tools/fs6upload | 2 +- bin/supplemental_tools/Xnatreport_assessor.py | 2 +- bin/supplemental_tools/Xnatreport_assessors.py | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/bin/Xnat_tools/XnatNDAR b/bin/Xnat_tools/XnatNDAR index 2cbd4ac5..3af3eec2 100755 --- a/bin/Xnat_tools/XnatNDAR +++ b/bin/Xnat_tools/XnatNDAR @@ -554,7 +554,7 @@ def get_scan_xnat(options, xnat, directory, subjects): # list of scans and assessors for the full project scan_list = xnat.get_project_scans(options.project) - assessor_list = XnatUtils.list_project_assessors(xnat, options.project) + assessor_list = xnat.list_project_assessors(options.project) # filter to keep only the scan we need and keep the assessor that we need # for the qc Scans @@ -629,7 +629,7 @@ def get_processed_data_xnat(options, xnat, directory, subjects): scan_info, assessor_info = extract_info(proc_info) # list of scans and assessors for the full project - assessor_list = XnatUtils.list_project_assessors(xnat, options.project) + assessor_list = xnat.list_project_assessors(options.project) assessor_list = filter_list(subjects, 'subject_label', assessor_list) # From scan: @@ -769,7 +769,7 @@ def download_scan_file(xnat, directory, scan, resources, fname): if not os.path.exists(res_path): os.makedirs(res_path) # Select the scan: - scan_obj = XnatUtils.get_full_object(xnat, scan) + scan_obj = xnat.get_full_object(scan) for resource in resources: if resource in ['bval', 'bvec']: if scan_obj.resource(resource.lower()).exists(): @@ -817,7 +817,7 @@ def download_assessor_file(xnat, directory, assessor, resources, fname): else: if not os.path.exists(res_path): os.makedirs(res_path) - assessor_obj = XnatUtils.get_full_object(xnat, assessor) + assessor_obj = xnat.get_full_object(assessor) for resource in resources: if resource: res_obj = assessor_obj.out_resource(resource) diff --git a/bin/Xnat_tools/Xnatdl b/bin/Xnat_tools/Xnatdl index aba57378..7902c083 100755 --- a/bin/Xnat_tools/Xnatdl +++ b/bin/Xnat_tools/Xnatdl @@ -186,8 +186,7 @@ download_report.csv if you want to start from scratch.""" for project in projects_list: self.scans.extend(self.xnat.get_project_scans(project)) if XnatUtils.has_dax_datatypes(self.xnat): - self.assessors.extend(XnatUtils.list_project_assessors( - self.xnat, project)) + self.assessors.extend(xnat.list_project_assessors(project)) # Filter using the options if they are set only if full project: self.filter(args) diff --git a/bin/Xnat_tools/Xnatinfo b/bin/Xnat_tools/Xnatinfo index ada80624..217987d9 100755 --- a/bin/Xnat_tools/Xnatinfo +++ b/bin/Xnat_tools/Xnatinfo @@ -176,7 +176,7 @@ def report_project(xnat, project, ignore_scans, ignore_unusable, running, scans_found[scan_dict['type']] = 1 # assessor loop - assessors_list = XnatUtils.list_project_assessors(xnat, project) + assessors_list = xnat.list_project_assessors(project) assessor_number = len(assessors_list) for assessor_dict in assessors_list: # add to dictionary of process diff --git a/bin/Xnat_tools/Xnatsessionupdate b/bin/Xnat_tools/Xnatsessionupdate index 4ef379f2..ab873aba 100755 --- a/bin/Xnat_tools/Xnatsessionupdate +++ b/bin/Xnat_tools/Xnatsessionupdate @@ -143,7 +143,7 @@ def change_date_all(xnat, sessions_list): :return: None """ for session_dict in sessions_list: - session_object = XnatUtils.get_full_object(xnat, session_dict) + session_object = xnat.get_full_object(session_dict) session_object.attrs.set('xnat:mrSessionData/original', ' ') msg = ' ->Session "%s" changed to need update.' print(msg % (session_dict['label'])) @@ -157,7 +157,7 @@ def get_xnat_subject_need_inputs(xnat, project): :param project: project ID on XNAT :return: unique list of sessions labels on XNAT """ - assessors_list = XnatUtils.list_project_assessors(xnat, project) + assessors_list = xnat.list_project_assessors(project) assessors_list = [x for x in assessors_list if x['procstatus'] == 'NEED_INPUTS'] return list(set([x['session_label'] for x in assessors_list])) diff --git a/bin/freesurfer_tools/fs6upload b/bin/freesurfer_tools/fs6upload index 2a68e3c6..f69c1a83 100644 --- a/bin/freesurfer_tools/fs6upload +++ b/bin/freesurfer_tools/fs6upload @@ -129,7 +129,7 @@ if __name__ == '__main__': # print('diff aeg result='+str(res)) # Upload the edits - brainmask, wm, aseg, control.dat,... - assessor_obj = XnatUtils.get_full_object(xnat, fs) + assessor_obj = xnat.get_full_object(fs) resource = assessor_obj.out_resource('EDITS') curtime = time.strftime("%Y%m%d-%H%M%S") brainmask_path = os.path.join( diff --git a/bin/supplemental_tools/Xnatreport_assessor.py b/bin/supplemental_tools/Xnatreport_assessor.py index 71ca63b5..5ea968ac 100755 --- a/bin/supplemental_tools/Xnatreport_assessor.py +++ b/bin/supplemental_tools/Xnatreport_assessor.py @@ -19,7 +19,7 @@ xnat = XnatUtils.get_interface() -Assrs = XnatUtils.list_project_assessors(xnat, project) +Assrs = xnat.list_project_assessors(project) R = list() for assr in Assrs : diff --git a/bin/supplemental_tools/Xnatreport_assessors.py b/bin/supplemental_tools/Xnatreport_assessors.py index 77051390..d60b3678 100755 --- a/bin/supplemental_tools/Xnatreport_assessors.py +++ b/bin/supplemental_tools/Xnatreport_assessors.py @@ -17,7 +17,7 @@ xnat = XnatUtils.get_interface() -Assrs = XnatUtils.list_project_assessors(xnat, args.project) +Assrs = xnat.list_project_assessors(args.project) xnat.disconnect() timestamp = time.strftime("%Y%m%d%H%M%S")