|
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(): ... |
| 83 | +>>> for idx, (name, slc, bm) in enumerate(bm_full.iter_structures()): |
| 84 | +... print(name, slc) |
| 85 | +... assert bm == bm_full[slc] |
| 86 | +... assert bm == bm_cortex if idx == 0 else bm_thal |
| 87 | +CIFTI_STRUCTURE_CORTEX_LEFT slice(0, 3, None) |
| 88 | +CIFTI_STRUCTURE_THALAMUS_LEFT slice(3, None, None) |
84 | 89 |
|
85 | 90 | In this case there will be two iterations, namely:
|
86 | 91 | ('CIFTI_STRUCTURE_CORTEX_LEFT', slice(0, <size of cortex mask>), bm_cortex)
|
|
90 | 95 | ParcelsAxis can be constructed from selections of these brain models:
|
91 | 96 |
|
92 | 97 | >>> parcel = cifti2.ParcelsAxis.from_brain_models([
|
93 |
| -... ('surface_parcel', bm_cortex[:100]), # contains first 100 cortical vertices |
| 98 | +... ('surface_parcel', bm_cortex[:2]), # contains first 2 cortical vertices |
94 | 99 | ... ('volume_parcel', bm_thal), # contains thalamus
|
95 |
| -... ('combined_parcel', bm_full[[1, 8, 10, 120, 127]) # contains selected voxels/vertices |
| 100 | +... ('combined_parcel', bm_full[[1, 8, 10]]), # contains selected voxels/vertices |
96 | 101 | ... ])
|
97 | 102 |
|
98 | 103 | Time series are represented by their starting time (typically 0), step size
|
|
103 | 108 | So a header for fMRI data with a TR of 100 ms covering the left cortex and thalamus with
|
104 | 109 | 5000 timepoints could be created with
|
105 | 110 |
|
106 |
| ->>> cifti2.Cifti2Header.from_axes((series, bm_cortex + bm_thal)) |
| 111 | +>>> type(cifti2.Cifti2Header.from_axes((series, bm_cortex + bm_thal))) |
| 112 | +<class 'nibabel.cifti2.cifti2.Cifti2Header'> |
107 | 113 |
|
108 | 114 | Similarly the curvature and cortical thickness on the left cortex could be stored using a header
|
109 | 115 | like:
|
110 | 116 |
|
111 |
| ->>> cifti2.Cifti2Header.from_axes((cifti.ScalarAxis(['curvature', 'thickness'], |
112 |
| -... bm_cortex)) |
| 117 | +>>> type(cifti2.Cifti2Header.from_axes((cifti2.ScalarAxis(['curvature', 'thickness']), |
| 118 | +... bm_cortex))) |
| 119 | +<class 'nibabel.cifti2.cifti2.Cifti2Header'> |
113 | 120 | """
|
114 | 121 | import numpy as np
|
115 | 122 | from . import cifti2
|
|
0 commit comments