|
67 | 67 | These can be concatenated in a single brain model covering the left cortex and thalamus by
|
68 | 68 | simply adding them together
|
69 | 69 |
|
70 |
| ->>> bm_full = bm_cortex + bm_thal # doctest: +SKIP |
| 70 | +>>> bm_full = bm_cortex + bm_thal |
71 | 71 |
|
72 | 72 | Brain models covering the full HCP grayordinate space can be constructed by adding all the
|
73 | 73 | volumetric and surface brain models together like this (or by reading one from an already
|
74 | 74 | existing HCP file).
|
75 | 75 |
|
76 | 76 | Getting a specific brain region from the full brain model is as simple as:
|
77 | 77 |
|
78 |
| ->>> assert bm_full[bm_full.name == 'CIFTI_STRUCTURE_CORTEX_LEFT'] == bm_cortex # doctest: +SKIP |
79 |
| ->>> assert bm_full[bm_full.name == 'CIFTI_STRUCTURE_THALAMUS_LEFT'] == bm_thal # doctest: +SKIP |
| 78 | +>>> assert bm_full[bm_full.name == 'CIFTI_STRUCTURE_CORTEX_LEFT'] == bm_cortex |
| 79 | +>>> assert bm_full[bm_full.name == 'CIFTI_STRUCTURE_THALAMUS_LEFT'] == bm_thal |
80 | 80 |
|
81 | 81 | You can also iterate over all brain structures in a brain model:
|
82 | 82 |
|
83 |
| ->>> for name, slc, bm in bm_full.iter_structures(): ... # doctest: +SKIP |
| 83 | +>>> for name, slc, bm in bm_full.iter_structures(): ... |
84 | 84 |
|
85 | 85 | In this case there will be two iterations, namely:
|
86 | 86 | ('CIFTI_STRUCTURE_CORTEX_LEFT', slice(0, <size of cortex mask>), bm_cortex)
|
|
93 | 93 | ... ('surface_parcel', bm_cortex[:100]), # contains first 100 cortical vertices
|
94 | 94 | ... ('volume_parcel', bm_thal), # contains thalamus
|
95 | 95 | ... ('combined_parcel', bm_full[[1, 8, 10, 120, 127]) # contains selected voxels/vertices
|
96 |
| -... ]) # doctest: +SKIP |
| 96 | +... ]) |
97 | 97 |
|
98 | 98 | Time series are represented by their starting time (typically 0), step size
|
99 | 99 | (i.e. sampling time or TR), and number of elements:
|
100 | 100 |
|
101 |
| ->>> series = cifti2.SeriesAxis(start=0, step=100, size=5000) # doctest: +SKIP |
| 101 | +>>> series = cifti2.SeriesAxis(start=0, step=100, size=5000) |
102 | 102 |
|
103 | 103 | So a header for fMRI data with a TR of 100 ms covering the left cortex and thalamus with
|
104 | 104 | 5000 timepoints could be created with
|
105 | 105 |
|
106 |
| ->>> cifti2.Cifti2Header.from_axes((series, bm_cortex + bm_thal)) # doctest: +SKIP |
| 106 | +>>> cifti2.Cifti2Header.from_axes((series, bm_cortex + bm_thal)) |
107 | 107 |
|
108 | 108 | Similarly the curvature and cortical thickness on the left cortex could be stored using a header
|
109 | 109 | like:
|
110 | 110 |
|
111 | 111 | >>> cifti2.Cifti2Header.from_axes((cifti.ScalarAxis(['curvature', 'thickness'],
|
112 |
| -... bm_cortex)) # doctest: +SKIP |
| 112 | +... bm_cortex)) |
113 | 113 | """
|
114 | 114 | import numpy as np
|
115 | 115 | from . import cifti2
|
|
0 commit comments