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


Python Images.getData方法代码示例

本文整理汇总了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)
开发者ID:arnaudbore,项目名称:toad,代码行数:34,代码来源:00-backup.py

示例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)
开发者ID:UNFmontreal,项目名称:toad,代码行数:55,代码来源:00-backup.py

示例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"))
开发者ID:UNFmontreal,项目名称:toad,代码行数:47,代码来源:01-preparation.py

示例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)
开发者ID:kaurousseau,项目名称:toad,代码行数:42,代码来源:00-backup.py


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