本文整理汇总了Python中dax.XnatUtils.has_resource方法的典型用法代码示例。如果您正苦于以下问题:Python XnatUtils.has_resource方法的具体用法?Python XnatUtils.has_resource怎么用?Python XnatUtils.has_resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dax.XnatUtils
的用法示例。
在下文中一共展示了XnatUtils.has_resource方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: needs_run
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def needs_run(self, cscan, xnat):
""" needs_run function overridden from base-class
cscan = CacheScan object from XnatUtils
return True or False
"""
scan_info = cscan.info()
if XnatUtils.has_resource(cscan, 'SNAPSHOTS'):
LOGGER.debug('Has snapshot')
return False
if not XnatUtils.has_resource(cscan, self.resourcename):
LOGGER.warn('Preview NIFTI -- '+scan_info['scan_id']+' -- no '+self.resourcename+' resource')
return False
return True
示例2: get_cmds
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def get_cmds(self, assessor, jobdir):
"""Method to generate the spider command for cluster job.
:param assessor: pyxnat assessor object
:param jobdir: jobdir where the job's output will be generated
:return: command to execute the spider in the job script
"""
proj_label = assessor.parent().parent().parent().label()
subj_label = assessor.parent().parent().label()
sess_label = assessor.parent().label()
nb_acq = 1
csess = XnatUtils.CachedImageSession(assessor._intf, proj_label,
subj_label, sess_label)
reg_verdict = ''
for cassr in csess.assessors():
if XnatUtils.is_cassessor_good_type(cassr, [self.proctype]):
reg_verdict = cassr
if XnatUtils.has_resource(reg_verdict, 'ACQ2'):
nb_acq = 2
cmd = SPIDER_FORMAT.format(spider=self.spider_path,
proj=proj_label,
subj=subj_label,
sess=sess_label,
dir=jobdir,
nb_acq=nb_acq,
proctype=self.proctype,
mc=self.mc,
camino=self.camino,
scheme=self.scheme_file,
suffix_proc=self.suffix_proc)
return [cmd]
示例3: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def has_inputs(self, csess):
"""Method overridden from base class.
By definition:
status = 0 -> NEED_INPUTS,
status = 1 -> NEED_TO_RUN
status = -1 -> NO_DATA
qcstatus needs a value only when -1 or 0.
You need to set qcstatus to a short string that explain
why it's no ready to run. e.g: No NIFTI
:param csess: object csess define in dax.XnatUtils
(see XnatUtils in dax for information)
:return: status, qcstatus
"""
# Check that there is only one scan usable with the reference type and
# that the reference file as a NIFTI
verdict_cscans = XnatUtils.get_good_cscans(csess, self.modalities)
if not verdict_cscans:
LOGGER.debug('Processor_Registration_Verdict: \
cannot run at all, no VERDICT image found')
return -1, 'VERDICT not found'
for cscan in verdict_cscans:
if not XnatUtils.has_resource(cscan, 'NIFTI'):
LOGGER.debug('Processor_Registration_Verdict: \
cannot run, no NIFTI found for %s scan', cscan.info()['ID'])
return 0, "Missing NIFTI"
return 1, None
示例4: needs_run
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def needs_run(self, cscan, xnat):
"""needs_run function overridden from base-class.
cscan = CacheScan object from XnatUtils
return True or False
"""
# Check output
if XnatUtils.has_resource(cscan, 'NIFTI'):
LOGGER.debug('Has NIFTI')
return False
# Check input
if not XnatUtils.has_resource(cscan, 'DICOM'):
LOGGER.debug('no DICOM resource')
return False
return True
示例5: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def has_inputs(self, csess):
"""Method overridden from base class.
By definition:
status = 0 -> NEED_INPUTS,
status = 1 -> NEED_TO_RUN
status = -1 -> NO_DATA
qcstatus needs a value only when -1 or 0.
You need to set qcstatus to a short string that explain
why it's no ready to run. e.g: No NIFTI
:param csess: object csess define in dax.XnatUtils
(see XnatUtils in dax for information)
:return: status, qcstatus
"""
# Check that there is only one scan usable with the reference type and
# that the reference file as a NIFTI
target_cscans = XnatUtils.get_good_cscans(csess, self.target)
if not target_cscans:
LOGGER.debug('Processor_Registration2Ref: \
cannot run at all, no T2 image found')
return -1, 'T2 not found'
if len(target_cscans) > 1:
LOGGER.debug('Processor_Registration2Ref: \
cannot run at all, too many T2 images found')
return 0, 'Too many T2 scans'
if not XnatUtils.has_resource(target_cscans[0], 'NIFTI'):
LOGGER.debug('Processor_Registration2Ref: \
cannot run, no NIFTI for T2 image')
return 0, "no T2's NIFTI"
source_cscans = XnatUtils.get_good_cscans(csess, self.sources)
if not source_cscans:
LOGGER.debug('Processor_Registration2Ref: \
cannot run at all, no ADC/DCE image found')
return -1, 'ADC/DCE not found'
for cscan in source_cscans:
if not XnatUtils.has_resource(cscan, 'NIFTI'):
LOGGER.debug('Processor_Registration2Ref: \
cannot run, no NIFTI found for %s scan', cscan.info()['ID'])
return 0, "Missing NIFTI"
return 1, None
示例6: needs_run
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def needs_run(self, cscan, xnat):
"""needs_run function overridden from base-class.
:param cscan: CacheScan object from XnatUtils
:return: True if needs to run or False otherwise
"""
# Unusable
if XnatUtils.is_cscan_unusable(cscan):
LOGGER.debug('Scan unusable.')
return False
# Check output
if XnatUtils.has_resource(cscan, 'NIFTI'):
LOGGER.debug('Has NIFTI')
return False
# Check input
if not XnatUtils.has_resource(cscan, 'DICOM'):
LOGGER.debug('no DICOM resource')
return False
return True
示例7: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def has_inputs(self, csess):
"""Method overridden from base class.
By definition:
status = 0 -> NEED_INPUTS,
status = 1 -> NEED_TO_RUN
status = -1 -> NO_DATA
qcstatus needs a value only when -1 or 0.
You need to set qcstatus to a short string that explain
why it's no ready to run. e.g: No NIFTI
:param csess: object csess define in dax.XnatUtils
(see XnatUtils in dax for information)
:return: status, qcstatus
"""
# DTI:
dti_cscans = XnatUtils.get_good_cscans(csess, self.dtitypes)
if not dti_cscans:
LOGGER.debug('Processor_Diffusion_Model_Fitting: \
cannot run at all, no DTI images found')
return -1, 'DTI not found'
for dti_cscan in dti_cscans:
if not XnatUtils.has_resource(dti_cscan, 'NIFTI'):
LOGGER.debug('Processor_Diffusion_Model_Fitting: cannot run, \
no NIFTI found for DTI image %s' % dti_cscan.info()['ID'])
return 0, "no NIFTI for %s" % dti_cscan.info()['ID']
# T1:
t1_cscans = XnatUtils.get_good_cscans(csess, self.t1types)
if not t1_cscans:
LOGGER.debug('Processor_Diffusion_Model_Fitting: \
cannot run at all, no T1 images found')
return -1, 'T1 not found'
# GIF:
gif_cassrs = XnatUtils.get_good_cassr(csess, self.giftypes)
if not gif_cassrs:
LOGGER.debug('Processor_Diffusion_Model_Fitting: \
cannot run, no good GIF Parcellation found')
return 0, 'good GIF not found'
if len(gif_cassrs) > 1:
LOGGER.debug('Processor_Diffusion_Model_Fitting: \
cannot run, no good GIF Parcellation found')
return 0, 'too many good GIF'
return 1, None
示例8: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def has_inputs(self, csess):
"""Method overridden from base class.
By definition:
status = 0 -> NEED_INPUTS,
status = 1 -> NEED_TO_RUN
status = -1 -> NO_DATA
qcstatus needs a value only when -1 or 0.
You need to set qcstatus to a short string that explain
why it's no ready to run. e.g: No NIFTI
:param csess: object csess define in dax.XnatUtils
(see XnatUtils in dax for information)
:return: status, qcstatus
"""
verdict_cscans = XnatUtils.get_good_cscans(csess, self.modalities)
if not verdict_cscans:
LOGGER.debug('Processor_Registration_Verdict: \
cannot run at all, no VERDICT image found')
return -1, 'VERDICT not found'
verdict_cassrs = list()
for cassr in csess.assessors():
if XnatUtils.is_cassessor_good_type(cassr, [self.proctype]):
verdict_cassrs.append(cassr)
if not verdict_cassrs:
LOGGER.debug('Processor_Compute_ADC_Verdict: \
cannot run, no good QA Registration VERDICT found')
return 0, 'Registration missing'
cassr = verdict_cassrs[0]
LOGGER.debug('Processor_Compute_ADC_Verdict: \
good registration assessor found: %s', cassr.info()['label'])
if not XnatUtils.has_resource(cassr, 'ACQ1'):
LOGGER.debug('Processor_Compute_ADC_Verdict: \
cannot run, no ACQ resource found for %s assessor',
cassr.info()['label'])
return 0, "Missing ACQ#"
return 1, None
示例9: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def has_inputs(self, cscan):
"""Method overridden from base class.
By definition:
status = 0 -> NEED_INPUTS,
status = 1 -> NEED_TO_RUN
status = -1 -> NO_DATA
qcstatus needs a value only when -1 or 0.
You need to set qcstatus to a short string that explain
why it's no ready to run. e.g: No NIFTI
:param cscan: object cscan define in dax.XnatUtils
(see XnatUtils in dax for information)
:return: status, qcstatus
"""
if XnatUtils.is_cscan_unusable(cscan):
return -1, 'Scan unusable'
# Check has_resource PARREC or NIFTI
if XnatUtils.has_resource(cscan, 'NIFTI'):
return 1, None
LOGGER.debug('GIF Parcellation: NIFTI not found.')
return 0, 'No NIFTI'
示例10: has_resource
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import has_resource [as 别名]
def has_resource(scan, label):
return XnatUtils.has_resource(scan, label)