當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。