本文整理汇总了Python中dax.XnatUtils.get_good_cscans方法的典型用法代码示例。如果您正苦于以下问题:Python XnatUtils.get_good_cscans方法的具体用法?Python XnatUtils.get_good_cscans怎么用?Python XnatUtils.get_good_cscans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dax.XnatUtils
的用法示例。
在下文中一共展示了XnatUtils.get_good_cscans方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_cmds
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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
"""
assessor_label = assessor.label()
proj_label = assessor.parent().parent().parent().label()
subj_label = assessor.parent().parent().label()
sess_label = assessor.parent().label()
csess = XnatUtils.CachedImageSession(assessor._intf, proj_label,
subj_label, sess_label)
gad_cscans = XnatUtils.get_good_cscans(csess, self.gad_type)
gad = self.get_file_path(gad_cscans[0], SCAN_RESOURCE)
vessels_cscans = XnatUtils.get_good_cscans(csess, self.vessels_type)
vessels = self.get_file_path(vessels_cscans, SCAN_RESOURCE)
vessel_ids = [ves.info()['ID'] for ves in vessels_cscans]
cmd = SPIDER_FORMAT.format(spider=self.spider_path,
assr=assessor_label,
dir=jobdir,
exe=self.exe,
gad=','.join(gad),
vessels=','.join(vessels),
vesselsids=','.join(vessel_ids),
number_core=self.ppn,
working_dir=self.working_dir)
return [cmd]
示例2: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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
"""
gad_cscans = XnatUtils.get_good_cscans(csess, self.gad_type)
if not gad_cscans:
LOGGER.debug('Vessel Registration: No GAD scan found.')
return -1, 'No GAD found'
elif len(gad_cscans) > 1:
LOGGER.debug('Vessel Registration: Too many GAD scans found.')
return 0, 'Too many GAD found'
vessels_cscans = XnatUtils.get_good_cscans(csess, self.vessels_type)
if not vessels_cscans:
LOGGER.debug('Vessel Registration: No Vessels scans found.')
return -1, 'No Vessels found'
return 1, None
示例3: get_cmds
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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()
csess = XnatUtils.CachedImageSession(assessor._intf, proj_label,
subj_label, sess_label)
target_cscans = XnatUtils.get_good_cscans(csess, self.target_type)
target_id = target_cscans[0].info()['ID']
source_cscans = XnatUtils.get_good_cscans(csess, self.sources_type)
sources_id = ','.join([sc.info()['ID'] for sc in source_cscans])
cmd = SPIDER_FORMAT.format(spider=self.spider_path,
proj=proj_label,
subj=subj_label,
sess=sess_label,
dir=jobdir,
target=target_id,
sources=sources_id,
regaladin=self.regaladin,
number_core=self.ppn,
suffix_proc=self.suffix_proc)
return [cmd]
示例4: get_cmds
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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()
assr_label = assessor.label()
csess = XnatUtils.CachedImageSession(assessor._intf, proj_label,
subj_label, sess_label)
dti_cscans = XnatUtils.get_good_cscans(csess, self.dtitypes)
dtis = ','.join([cscan.info()['ID'] for cscan in dti_cscans])
gif_cassrs = XnatUtils.get_good_cassr(csess, self.giftypes)
working_dir = os.path.join(self.working_dir, assr_label)
cmd = SPIDER_FORMAT.format(spider=self.spider_path,
proj=proj_label,
subj=subj_label,
sess=sess_label,
dir=jobdir,
suffix_proc=self.suffix_proc,
dti=dtis,
gif=gif_cassrs[0].info()['label'],
exe=self.exe,
gif_path=self.exe_args,
number_core=self.ppn,
working_dir=working_dir)
return [cmd]
示例5: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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
示例6: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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
示例7: get_usable_cscans
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [as 别名]
def get_usable_cscans(csess, stype):
"""
Get only the usable cscans for a csess.
"""
usable_cscans = list()
cscans = XnatUtils.get_good_cscans(csess, stype)
for cscan in cscans:
if cscan.info()['quality'] == 'usable':
usable_cscans.append(cscan)
return usable_cscans
示例8: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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
示例9: has_inputs
# 需要导入模块: from dax import XnatUtils [as 别名]
# 或者: from dax.XnatUtils import get_good_cscans [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