def teardown(self, result=0): """ concatenate dtseries, parcellate, create grayplots. :param result: :return: """ fmris = [get_fmriname(fmri) for fmri in self.config.get_bids('func')] fmrisets = list( set([get_taskname(fmri) for fmri in self.config.get_bids('func')])) script = self.script.format(**os.environ) args = self.spec.format(**self.kwargs) cmd = ' '.join((script, args)) cmd += ' --teardown' for fmriset in fmrisets: fmrilist = sorted([fmri for fmri in fmris if fmriset in fmri]) cmd += ' --tasklist ' + ','.join(fmrilist) log_dir = self._get_log_dir() out_log = os.path.join(log_dir, self.__class__.__name__ + '_teardown.out') err_log = os.path.join(log_dir, self.__class__.__name__ + '_teardown.err') result = self.call(cmd, out_log, err_log) super(__class__, self).teardown(result)
def args(self): for fmri in self.config.get_bids('func'): # set ts parameters self.kwargs['fmritcs'] = fmri self.kwargs['fmriname'] = get_fmriname(fmri) self.kwargs['fmriscout'] = None # not implemented if self.kwargs['dcmethod'] == 'TOPUP': self.kwargs['sephasepos'], self.kwargs['sephaseneg'] = \ self._get_intended_sefmaps() else: self.kwargs['sephasepos'] = self.kwargs['sephaseneg'] = None # None to NONE kw = { k: (v if v is not None else "NONE") for k, v in self.kwargs.items() } yield self.spec.format(**kw)
def get_tasklist(self): """ :return: dictionary of task basename: list of task names (with number) """ tasks = self.config.get_bids('func') fmri_names = [get_fmriname(t) for t in tasks] # filter out resting state data pattern = re.compile(r'^((?!rest).)*$') is_task = [pattern.match(t) is not None for t in fmri_names] fmri_names = [t for i, t in enumerate(fmri_names) if is_task[i]] task_names = list( set(get_taskname(t) for i, t in enumerate(tasks) if is_task[i])) task_dictionary = {} for name in task_names: task_dictionary[name] = [t for t in fmri_names if name in t] return task_dictionary
def args(self): for fmri, meta in zip(self.config.get_bids('func'), self.config.get_bids('func_metadata')): # set ts parameters self.kwargs['fmritcs'] = fmri self.kwargs['fmriname'] = get_fmriname(fmri) self.kwargs['fmriscout'] = None # not implemented if self.kwargs['dcmethod'] == 'TOPUP': self.kwargs['seunwarpdir'] = ijk_to_xyz( meta['PhaseEncodingDirection']) self.kwargs['sephasepos'], self.kwargs['sephaseneg'] = \ self._get_intended_sefmaps() else: self.kwargs['sephasepos'] = self.kwargs['sephaseneg'] = None # None to NONE kw = { k: (v if v is not None else "NONE") for k, v in self.kwargs.items() } yield self.spec.format(**kw)
def args(self): for fmri in self.config.get_bids('func'): self.kwargs['fmriname'] = get_fmriname(fmri) yield self.spec.format(**self.kwargs)