Skip to content

Commit

Permalink
changed get_full_object and list_project_assessors to be called from …
Browse files Browse the repository at this point in the history
…object interface(xnat)
  • Loading branch information
KarthikMasi committed Mar 4, 2020
1 parent 7c43cbf commit ab88e1d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions bin/Xnat_tools/XnatNDAR
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions bin/Xnat_tools/Xnatdl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion bin/Xnat_tools/Xnatinfo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions bin/Xnat_tools/Xnatsessionupdate
Original file line number Diff line number Diff line change
Expand Up @@ -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']))
Expand All @@ -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]))
Expand Down
2 changes: 1 addition & 1 deletion bin/freesurfer_tools/fs6upload
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion bin/supplemental_tools/Xnatreport_assessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down
2 changes: 1 addition & 1 deletion bin/supplemental_tools/Xnatreport_assessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ab88e1d

Please sign in to comment.