Here we show how to regress out confound signals, in particular using statistical CompCor. * Y. Behzadi et al. `A Component Based Noise Correction Method (CompCor) for BOLD and Perfusion Based fMRI <https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2214855/>`_, NeuroImage Vol 37 (2007), p. 90-101 """ ############################################################################## # Statistical CompCor # ---------------------------------------------- # Retrieve the data from one subject from sammba import data_fetchers test_retest = data_fetchers.fetch_zurich_test_retest(subjects=[1]) fmri_filename = test_retest.func[0] ############################################################################### # We perform a PCA to extract the 98% most variant components. # This is done by the function **nilearn.image.high_variance_confounds**, from nilearn import image hv_array = image.high_variance_confounds(fmri_filename) print('Computed {0} confounds array.'.format(hv_array.shape[1])) ############################################################################### # Do my counfounds model noise properly? Voxel-to-voxel connectivity tells! # ------------------------------------------------------------------------- # Check the relevance of chosen confounds: The distribution of voxel-to-voxel # correlations should be tight and approximately centered to zero.
Here we show how to create a template from multiple anatomical scans and register all of them to it. Initially, registration is of extracted brains. Once these are reasonably aligned, whole heads are registered, weighted by masks that, if parameters are chosen well, include some scalp. The amount of scalp is hopefully enough to help in differentiating the brain-scalp boundary without including so much head tissue that it starts to contaminate the registration with the highly variable head tissue. """ ############################################################################## # Retrieve the data # ----------------- from sammba import data_fetchers retest = data_fetchers.fetch_zurich_test_retest(subjects=[0, 1, 2], correct_headers=True) ############################################################################## # retest contains paths to images and data description print(retest.anat) ############################################################################## # Define the writing directory # ---------------------------- import os write_dir = os.path.join(os.getcwd(), 'zurich_common') if not os.path.exists(write_dir): os.makedirs(write_dir) ##############################################################################
""" ICA on mouse ============ Independent components analysis on 5 mice. """ ############################################################################## # Retrieve the fMRI data # ---------------------- from sammba import data_fetchers retest = data_fetchers.fetch_zurich_test_retest(subjects=range(5), correct_headers=True) ############################################################################## # Load the template and its brain mask # ------------------------------------ dorr = data_fetchers.fetch_atlas_dorr_2008(downsample='100') dorr_masks = data_fetchers.fetch_masks_dorr_2008(downsample='100') print('Path to template is {} and to the brain mask is {}'.format( dorr.t2, dorr_masks.brain)) ############################################################################## # Register to the template # ------------------------ import os from sammba.registration import TemplateRegistrator registrator = TemplateRegistrator(brain_volume=400, caching=True, template=dorr.t2,