示例#1
0
    def implement(self):

        structs = {
            'dwi': self.getUpsamplingImage('dwi'),
            'anat': self.getRegistrationImage('anat',
                                              ['freesurfer', 'resample']),
            'mask': self.getRegistrationImage('mask', 'resample')
        }

        for postfix, image in structs.iteritems():
            util.copy(
                image, self.workingDir,
                self.buildName(self.subject.getName(), postfix, 'nii.gz'))

        for extension in ['bvals', 'bvecs', 'benc']:
            util.copy(self.getUpsamplingImage('grad', None, extension),
                      self.workingDir,
                      self.buildName(self.subject.getName(), None, extension))

        self.__copyMetrics(['mrtrix', 'dipy', 'fsl'], ['fa', 'ad', 'rd', 'md'],
                           'tensor')
        self.__copyMetrics(['mrtrix', 'dipy'], ['nufo', 'csd', 'gfa'], 'hardi')

        self.createMethoHtml()

        self.__finished = True
示例#2
0
 def __copyMetrics(self, softwares, postfixs, method):
     for software in softwares:
         for postfix in postfixs:
             source = getattr(self,
                              "get{}{}Image".format(method,
                                                    software))("dwi",
                                                               postfix)
             target = self.buildName(self.subject.getName(),
                                     [software, postfix], 'nii.gz')
             util.copy(source, self.workingDir, target)
示例#3
0
    def __getConfigFile(self, prefix, defaultFile):

        target = self.getPreparationImage(prefix, None, "json")
        if target:
            util.symlink(target, self.buildName(target, None, "json"))
        else:
            defaultFileName = "{}.json".format(defaultFile)
            defaultFileLink = os.path.join(self.toadDir, "templates", "tractometry", defaultFileName)
            target = defaultFileLink
            util.copy(defaultFileLink, self.workingDir, defaultFileName)
        return target
示例#4
0
    def __getConfigFile(self, prefix, defaultFile):

        target = self.getPreparationImage(prefix, None, 'json')
        if target:
            util.symlink(target, self.buildName(target, None, 'json'))
        else:
            defaultFileName = '{}.json'.format(defaultFile)
            defaultFileLink = os.path.join(
                self.toadDir,
                "templates",
                "tractometry",
                defaultFileName,
            )
            target = defaultFileLink
            util.copy(defaultFileLink, self.workingDir, defaultFileName)
        return target
示例#5
0
文件: 16-results.py 项目: inej/toad
    def implement(self):

        structs = {'dwi': self.getUpsamplingImage('dwi'),
                    'anat': self.getRegistrationImage('anat', ['freesurfer', 'resample']),
                    'mask': self.getRegistrationImage('mask', 'resample'),
                    'brodmann': self.getRegistrationImage('brodmann', 'resample')}

        for postfix, image in structs.iteritems():
           util.copy(image, self.workingDir,  self.buildName(self.subject.getName(), postfix, 'nii.gz'))

        for extension in ['bvals', 'bvecs', 'benc']:
            util.copy(self.getUpsamplingImage('grad', None, extension), self.workingDir, self.buildName(self.subject.getName(), None, extension))

        self.__copyMetrics(['mrtrix', 'dipy', 'fsl'], ['fa','ad','rd','md'], 'tensor')
        self.__copyMetrics(['mrtrix', 'dipy'], ['nufo','csd','gfa'], 'hardi')
        self.__finished = True
示例#6
0
文件: 00-qa.py 项目: kaurousseau/toad
    def implement(self):

        if not os.path.exists(self.qaImagesDir):
            os.makedirs(self.qaImagesDir)

        #Copy logo
        logoName = self.config.get('qa', 'logo')
        logoLink = os.path.join(
                self.toadDir, 'templates', 'files', logoName)
        util.copy(logoLink, self.qaImagesDir, logoName)

        #Copy menu, css & js
        styleFiles = ('menu', 'css', 'jquery', 'js')
        for tag in styleFiles:
            fileName = self.config.get('qa', tag)
            fileLink = os.path.join(
                    self.toadDir, 'templates', 'files', fileName)
            util.copy(fileLink, self.workingDir, fileName)

        #Create index.html
        self.createTaskHtml({}, 'index.html')
示例#7
0
    def implement(self):

        if not os.path.exists(self.qaImagesDir):
            os.makedirs(self.qaImagesDir)

        #Copy logo
        logoName = self.config.get('qa', 'logo')
        logoLink = os.path.join(
                self.toadDir, 'templates', 'files', logoName)
        util.copy(logoLink, self.qaImagesDir, logoName)

        #Copy menu, css & js
        styleFiles = ('menu', 'css', 'jquery', 'js')
        for tag in styleFiles:
            fileName = self.config.get('qa', tag)
            fileLink = os.path.join(
                    self.toadDir, 'templates', 'files', fileName)
            util.copy(fileLink, self.workingDir, fileName)

        #Create index.html
        self.createTaskHtml(
                {'parseHtmlTables':'<div id="metho">Methodology when pipeline is finished</div>'}, 'index.html')
示例#8
0
文件: 00-qa.py 项目: sbrambati/toad
    def implement(self):

        mainTemplate = os.path.join(self.toadDir, 'templates', 'files', 'qa.main.tpl')
        imagesDir = os.path.join(self.workingDir, self.get('qa', 'images_dir'))

        if not os.path.exists(imagesDir):
            os.makedirs(imagesDir)

        #Copy style.css
        styleTemplate = os.path.join(self.toadDir, 'templates', 'files', 'qa.style.tpl')
        util.copy(styleTemplate, self.workingDir, 'style.css')

        #Create menu.html only for tasks with implemented QA
        menuTemplate = os.path.join(self.toadDir, 'templates', 'files', 'qa.menu.tpl')
        util.copy(menuTemplate, self.workingDir, 'menu.html')

        #Create index.html
        tags = {
            'subject':self.__subject.getName(),
            'taskInfo':'',
            'parseHtmlTables':'',
            }
        htmlCode = self.parseTemplate(tags, mainTemplate)
        util.createScript('index.html', htmlCode)
示例#9
0
 def __copyMetrics(self, softwares, postfixs, method):
     for software in softwares:
         for postfix in postfixs:
             source = getattr(self, "get{}{}Image".format(method, software))("dwi", postfix)
             target = self.buildName(self.subject.getName(), [software, postfix], 'nii.gz')
             util.copy(source, self.workingDir, target)