本文整理汇总了Python中lib.images.Images.getData方法的典型用法代码示例。如果您正苦于以下问题:Python Images.getData方法的具体用法?Python Images.getData怎么用?Python Images.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.images.Images
的用法示例。
在下文中一共展示了Images.getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: implement
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import getData [as 别名]
def implement(self):
self.info("Build directories structure for subject: {}".format(os.path.basename(self.workingDir)))
#@TODO add description to that struct
images = Images((self.getSubjectImage('anat'), ""),
(self.getSubjectImage('dwi'), ""),
(self.getSubjectImage('mag',), ""),
(self.getSubjectImage('phase'), ""),
(self.getSubjectImage('aparc_aseg'), ""),
(self.getSubjectImage('anat', 'freesurfer'), ""),
(self.getSubjectImage('lh_ribbon'), ""),
(self.getSubjectImage('rh_ribbon'), ""),
(self.getSubjectImage('brodmann'), ""),
(self.getSubjectImage('b0_ap'), ""),
(self.getSubjectImage('b0_pa'), ""),
(self.getSubjectImage('grad', None, 'b'), ""),
(self.getSubjectImage('grad', None, 'bvals'), ""),
(self.getSubjectImage('grad', None, 'bvecs'), ""),
(self.getSubjectImage('tq_dict', None, 'qry'), ""),
(self.getSubjectImage('queries', None, 'qry'), ""),
(self.getSubjectImage('config', None, 'cfg'), ""),)
for image, description in images.getData():
if image:
self.info("Found {} image: moving it to {} directory".format(description, image, self.workingDir))
shutil.move(image, self.workingDir)
directories = [os.path.join(self.subjectDir, directory) for directory in os.listdir(self.subjectDir) if os.path.isdir(os.path.join(self.subjectDir, directory))]
for directory in directories:
if mriutil.isAfreesurferStructure(directory):
self.info("{} seem\'s a valid freesurfer structure: moving it to {} directory".format(directory, self.workingDir))
shutil.move(directory, self.workingDir)
示例2: implement
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import getData [as 别名]
def implement(self):
self.info("Build directories structure for subject: {}".format(
os.path.basename(self.workingDir)))
#@TODO add description to that struct
images = Images((self.getSubjectImage('anat'), ""),
(self.getSubjectImage('dwi'), ""),
(self.getSubjectImage('mag',), ""),
(self.getSubjectImage('phase'), ""),
(self.getSubjectImage('aparc_aseg'), ""),
(self.getSubjectImage('anat', 'freesurfer'), ""),
(self.getSubjectImage('lh_ribbon'), ""),
(self.getSubjectImage('rh_ribbon'), ""),
(self.getSubjectImage('brodmann'), ""),
(self.getSubjectImage('b0_ap'), ""),
(self.getSubjectImage('b0_pa'), ""),
(self.getSubjectImage('grad', None, 'b'), ""),
(self.getSubjectImage('grad', None, 'bvals'), ""),
(self.getSubjectImage('grad', None, 'bvecs'), ""),
(self.getSubjectImage('tq_dict', None, 'qry'), ""),
(self.getSubjectImage('queries', None, 'qry'), ""),
(self.getSubjectImage('config', None, 'cfg'), ""),)
for image, description in images.getData():
if image:
self.info("Found {} image: moving it to {} directory".format(
description, image, self.workingDir))
shutil.move(image, self.workingDir)
directories = []
for directory in os.listdir(self.subjectDir):
target = os.path.join(self.subjectDir, directory)
if os.path.isdir(target):
directories.append(target)
for directory in directories:
if mriutil.isAfreesurferStructure(directory):
self.info("{} seem\'s a valid freesurfer structure: moving it to {} directory".format(directory, self.workingDir))
if os.path.islink(directory):
os.chdir(self.subjectDir)
# We need to chdir because `directory` is in
# `self.subjectDir` and we need `os.path.abspath` to
# work correctly
fsDirName = os.path.basename(directory)
linkto = os.path.abspath(os.readlink(directory))
newLinkto = os.path.relpath(linkto, self.workingDir)
newTarget = os.path.join(self.workingDir, fsDirName)
os.symlink(newLinkto, newTarget)
os.unlink(directory)
os.chdir(self.workingDir)
else:
shutil.move(directory, self.workingDir)
示例3: implement
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import getData [as 别名]
def implement(self):
dwi = self.getBackupImage('dwi')
bEncs = self.getBackupImage('grad', None, 'b')
bVals = self.getBackupImage('grad', None, 'bvals')
bVecs = self.getBackupImage('grad', None, 'bvecs')
(bEncs, bVecs, bVals) = self.__produceEncodingFiles(bEncs, bVecs, bVals, dwi) # Convert bvecs bval
expectedLayout = self.get('stride_orientation')
if not mriutil.isDataStridesOrientationExpected(dwi, expectedLayout) \
and self.get("force_realign_strides"):
self.warning("Reorienting strides for image {}".format(dwi))
self.__stride4DImage(dwi, bEncs, bVecs, bVals, expectedLayout)
else:
self.info("Linking {} to {}".format(dwi, util.symlink(dwi, self.workingDir)))
images = Images(
(self.getBackupImage('anat'),'high resolution'),
(self.getBackupImage('b0_pa'),'B0 posterior to anterior'),
(self.getBackupImage('b0_ap'),'B0 anterior to posterior'),
(self.getBackupImage('mag'),'MR magnitude'),
(self.getBackupImage('phase'),'MR phase '),
(self.getBackupImage('aparc_aseg'),'parcellation'),
(self.getBackupImage('anat', 'freesurfer'),'freesurfer anatomical'),
(self.getBackupImage('lh_ribbon'),'left hemisphere ribbon'),
(self.getBackupImage('rh_ribbon'),'right hemisphere ribbon'),
(self.getBackupImage('brodmann'),'brodmann'),
)
for image, description in images.getData():
if image:
if not mriutil.isDataStridesOrientationExpected(image, expectedLayout) \
and self.get("force_realign_strides"):
self.info(mriutil.stride3DImage(image, self.buildName(image, "stride"), expectedLayout))
else:
self.info("Found {} image, linking {} to {}".format(description, image, util.symlink(image, self.workingDir)))
for directory in [os.path.join(self.backupDir, directory) for directory in os.listdir(self.backupDir) if os.path.isdir(os.path.join(self.backupDir, directory))]:
if mriutil.isAfreesurferStructure(directory):
self.info("{} seem\'s a valid freesurfer structure: linking to {} directory".format(directory, self.workingDir))
util.symlink(directory, self.workingDir, self.get("parcellation", "id"))
示例4: implement
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import getData [as 别名]
def implement(self):
self.info("Build directories structure for subject: {}".format(os.path.basename(self.workingDir)))
# @TODO add description to that struct
images = Images(
(self.getSubjectImage("anat"), ""),
(self.getSubjectImage("dwi"), ""),
(self.getSubjectImage("mag"), ""),
(self.getSubjectImage("phase"), ""),
(self.getSubjectImage("aparc_aseg"), ""),
(self.getSubjectImage("anat", "freesurfer"), ""),
(self.getSubjectImage("lh_ribbon"), ""),
(self.getSubjectImage("rh_ribbon"), ""),
(self.getSubjectImage("brodmann"), ""),
(self.getSubjectImage("b0_ap"), ""),
(self.getSubjectImage("b0_pa"), ""),
(self.getSubjectImage("grad", None, "b"), ""),
(self.getSubjectImage("grad", None, "bvals"), ""),
(self.getSubjectImage("grad", None, "bvecs"), ""),
(self.getSubjectImage("config", None, "cfg"), ""),
)
for image, description in images.getData():
if image:
self.info("Found {} image: moving it to {} directory".format(description, image, self.workingDir))
shutil.move(image, self.workingDir)
directories = [
os.path.join(self.subjectDir, directory)
for directory in os.listdir(self.subjectDir)
if os.path.isdir(os.path.join(self.subjectDir, directory))
]
for directory in directories:
if mriutil.isAfreesurferStructure(directory):
self.info(
"{} seem's a valid freesurfer structure: moving it to {} directory".format(
directory, self.workingDir
)
)
shutil.move(directory, self.workingDir)