当前位置: 首页>>代码示例>>Python>>正文


Python XnatUtils.list_project_assessors方法代码示例

本文整理汇总了Python中dax.XnatUtils.list_project_assessors方法的典型用法代码示例。如果您正苦于以下问题:Python XnatUtils.list_project_assessors方法的具体用法?Python XnatUtils.list_project_assessors怎么用?Python XnatUtils.list_project_assessors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dax.XnatUtils的用法示例。


在下文中一共展示了XnatUtils.list_project_assessors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import list_project_assessors [as 别名]
HOST = 'http://cmic-xnat.cs.ucl.ac.uk'
PROJECT = 'Prisma_upgrade'
OLD_RESOURCE = 'VOLUME'
NEW_RESOURCE = 'STATS'
ASSESSOR = None
TMP_DIR = '/Users/byvernault/data/tempGIF/'

try:
    xnat = XnatUtils.get_interface(host=HOST)

    if ASSESSOR:
        li_assessors = [XnatUtils.select_assessor(xnat, ASSESSOR)]
        sys.stdout.write('Renaming resources %s to %s for assessor %s'
                         % (OLD_RESOURCE, NEW_RESOURCE, ASSESSOR))
    else:
        li_assessors = XnatUtils.list_project_assessors(xnat, PROJECT)
        sys.stdout.write('Renaming resources %s to %s for assessor type %s\n'
                         % (OLD_RESOURCE, NEW_RESOURCE, ASSESSOR_TYPE))

    for assessor in li_assessors:
        sys.stdout.write(' - assessor: %s ...\n' % assessor['label'])
        assessors = XnatUtils.get_full_object(xnat, assessor)
        old_res = assessors.resource(OLD_RESOURCE)
        files = None
        if old_res.exists():
            files = XnatUtils.download_files_from_obj(TMP_DIR, old_res)
            if files:
                new_res = assessors.resource(NEW_RESOURCE)
                XnatUtils.upload_files_to_obj(files, new_res)
                if new_res.exists():
                    old_res.delete()
开发者ID:byvernault,项目名称:scripts,代码行数:33,代码来源:Rename_resources_assessors.py

示例2: xnat

# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import list_project_assessors [as 别名]
            HOST = ARGS.host
        else:
            HOST = os.environ['XNAT_HOST']
        if ARGS.username:
            MSG = ("Please provide the password for user <%s> on xnat(%s):"
                   % (ARGS.username, HOST))
            PWD = getpass.getpass(prompt=MSG)
        else:
            PWD = None

        if not os.path.isdir(ARGS.tmpdir):
            os.makedirs(ARGS.tmpdir)
        print 'INFO: connection to xnat <%s>:' % (HOST)
        XNAT = XnatUtils.get_interface(host=ARGS.host, user=ARGS.username,
                                       pwd=PWD)
        li_assessors = XnatUtils.list_project_assessors(XNAT, ARGS.project)
        li_assessors = XnatUtils.filter_list_dicts_regex(
                                li_assessors, 'proctype',
                                ['GIF_Parcellation_v2'])
        li_assessors = XnatUtils.filter_list_dicts_regex(
                                li_assessors, 'procstatus',
                                ['COMPLETE'])
        li_assessors = filter(lambda x: 'WHOLEBRAIN' not in x['resources'],
                              li_assessors)
        li_assessors = sorted(li_assessors, key=lambda k: k['session_label'])
        start = False
        for assessor in li_assessors:
            if ARGS.session:
                if assessor['session_label'] == ARGS.session:
                    start = True
            else:
开发者ID:byvernault,项目名称:scripts,代码行数:33,代码来源:run_b_masking_whole.py

示例3: print

# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import list_project_assessors [as 别名]
import pandas
import pyxnat
import argparse
import time
from dax import XnatUtils
from dax import utilities

# Specify and parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('project',help='Project name')
args = parser.parse_args()
print('Project: {}'.format(args.project))


xnat = XnatUtils.get_interface()
Assrs = XnatUtils.list_project_assessors(xnat, args.project)
xnat.disconnect()

timestamp = time.strftime("%Y%m%d%H%M%S")
outfile1 = 'status_by_assessor_{}_{}.csv'.format(args.project,timestamp)
outfile2 = 'status_by_session_{}_{}.csv'.format(args.project,timestamp)

R = list()
for assr in Assrs :

    #print(assr['assessor_label'])

    # Get desired fields
    thisR = {}
    for key in ('project_label','subject_label','session_label','proctype',
                'assessor_id','procstatus','qcstatus','assessor_label') :
开发者ID:VUIIS,项目名称:dax,代码行数:33,代码来源:Xnatreport_assessors.py

示例4: len

# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import list_project_assessors [as 别名]
__author__ = 'damons'
__purpose__ = 'set the assessor quality  on xnat'

from dax import XnatUtils
import sys
XNAT_STATUS_LIST = ['Passed', 'Good', 'OK', 'Poor', 'Rerun', 'Needs QA', 'Needs Edits', 'Bad', 'Failed']
if __name__ == '__main__':

    XNAT = XnatUtils.get_interface()
    ASSESSORS = XnatUtils.list_project_assessors(XNAT, 'WOODWARD_TCP')

    if len(sys.argv) != 4:
        print len(sys.argv)
        sys.stderr.write('ERROR: args must be <ASSESSOR_LABEL> <STATUS> <COMMENTS>')
        sys.exit()
    MY_ASSESSOR = sys.argv[1]
    STATUS = sys.argv[2]
    COMMENTS = sys.argv[3]
    if STATUS not in XNAT_STATUS_LIST:
        sys.stderr.write('ERROR: Status "%s" not in known list: %s\n'
                         %(STATUS, ','.join(XNAT_STATUS_LIST)))

    for ASSESSOR in ASSESSORS:
        if ASSESSOR['label'] == MY_ASSESSOR:
            print "Setting QC of assessor %s to %s" % (MY_ASSESSOR,
                                                       STATUS)
            OBJECT = XnatUtils.get_full_object(XNAT, ASSESSOR)
            if not MY_ASSESSOR.endswith('-x-FS'):
                OBJECT.attrs.set('proc:genProcData/validation/status', STATUS)
                OBJECT.attrs.set('proc:genProcData/validation/notes', COMMENTS)
            else:
开发者ID:VUIIS,项目名称:VUIIS_DAX_SUPPORT,代码行数:33,代码来源:set_assessor_quality.py


注:本文中的dax.XnatUtils.list_project_assessors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。