Ejemplo n.º 1
0
    def test_ward_spatial_real_data(self):
        from pyhrf.glm import glm_nipy_from_files

        fn = 'subj0_parcellation.nii.gz'
        mask_file = pyhrf.get_data_file_name(fn)

        bold = 'subj0_bold_session0.nii.gz'
        bold_file = pyhrf.get_data_file_name(bold)

        paradigm_csv_file = pyhrf.get_data_file_name('paradigm_loc_av.csv')
        output_dir = self.tmp_dir
        output_file = op.join(output_dir,
                              'parcellation_output_test_real_data.nii')

        tr = 2.4
        bet = glm_nipy_from_files(bold_file, tr,
                                  paradigm_csv_file, output_dir,
                                  mask_file, session=0,
                                  contrasts=None,
                                  hrf_model='Canonical',
                                  drift_model='Cosine', hfcut=128,
                                  residuals_model='spherical',
                                  fit_method='ols', fir_delays=[0])[0]

        logger.info('betas_files: %s', ' '.join(bet))

        cmd = 'pyhrf_parcellate_glm -m %s %s -o %s -v %d -n %d '\
            '-t ward_spatial ' \
            % (mask_file, ' '.join(bet), output_file,
               logger.getEffectiveLevel(), 10)

        if os.system(cmd) != 0:
            raise Exception('"' + cmd + '" did not execute correctly')
        logger.info('cmd: %s', cmd)
Ejemplo n.º 2
0
    def test_glm_with_files(self):

        output_dir = self.tmp_dir

        bold_name = 'subj0_bold_session0.nii.gz'
        bold_file = pyhrf.get_data_file_name(bold_name)
        tr = 2.4

        paradigm_name = 'paradigm_loc_av.csv'
        paradigm_file = pyhrf.get_data_file_name(paradigm_name)

        mask_name = 'subj0_parcellation.nii.gz'
        mask_file = pyhrf.get_data_file_name(mask_name)

        from pyhrf.glm import glm_nipy_from_files
        glm_nipy_from_files(bold_file, tr, paradigm_file, output_dir,
                            mask_file)

        self.assertTrue(op.exists(output_dir))
Ejemplo n.º 3
0
    def test_glm_with_files(self):

        output_dir = self.tmp_dir

        bold_name = 'subj0_bold_session0.nii.gz'
        bold_file = pyhrf.get_data_file_name(bold_name)
        tr = 2.4

        paradigm_name = 'paradigm_loc_av.csv'
        paradigm_file = pyhrf.get_data_file_name(paradigm_name)

        mask_name = 'subj0_parcellation.nii.gz'
        mask_file = pyhrf.get_data_file_name(mask_name)

        from pyhrf.glm import glm_nipy_from_files
        glm_nipy_from_files(bold_file, tr, paradigm_file, output_dir,
                            mask_file)

        self.assertTrue(op.exists(output_dir))