本文整理汇总了Python中dax.XnatUtils.get_good_scans方法的典型用法代码示例。如果您正苦于以下问题:Python XnatUtils.get_good_scans方法的具体用法?Python XnatUtils.get_good_scans怎么用?Python XnatUtils.get_good_scans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dax.XnatUtils
的用法示例。
在下文中一共展示了XnatUtils.get_good_scans方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pre_run
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_scans [as 别名]
def pre_run(self):
"""Method to download data from XNAT.
:param argument_parse: argument parser object return by parse_args()
"""
resource = 'ACQ' # resource to download from the scan on XNAT
folder = os.path.join(self.jobdir, 'inputs')
os.makedirs(folder)
assessor_label = '-x-'.join([self.xnat_project,
self.xnat_subject,
self.xnat_session,
self.proctype])
xnat = XnatUtils.get_interface()
a = xnat.select('/projects/%s/subjects/%s/experiments/%s/assessors/%s'
% (self.xnat_project, self.xnat_subject,
self.xnat_session, assessor_label))
for nb_acq in range(1, self.nb_acquisition+1):
res_name = '%s%d' % (resource, nb_acq)
self.time_writer('Download resource: %s' % res_name)
file_gzip = XnatUtils.download_file_from_obj(
folder, a.out_resource(res_name))
self.time_writer('Unzip file: %s' % file_gzip)
XnatUtils.gunzip_file(file_gzip)
self.inputs[nb_acq] = file_gzip[:-3]
sc = XnatUtils.get_good_scans(a.parent(), DICOM_SCAN_TYPE)[0]
dcm_file = XnatUtils.download_file_from_obj(
folder, sc.resource('DICOM'))
self.inputs['dcm'] = dcm_file
xnat.disconnect()