@@ -34,8 +34,10 @@ def create_geometry_map(applies_to_matrix_dimension):
34
34
vertices = ci .Cifti2VertexIndices (np .array (brain_models [1 ][1 ]))
35
35
left_cortex = ci .Cifti2BrainModel (index_offset = 4 , index_count = 5 , model_type = 'CIFTI_MODEL_TYPE_SURFACE' ,
36
36
brain_structure = brain_models [1 ][0 ], vertex_indices = vertices )
37
+ left_cortex .surface_number_of_vertices = number_of_vertices
38
+ volume = ci .Cifti2Volume (dimensions , ci .Cifti2TransformationMatrixVoxelIndicesIJKtoXYZ (- 3 , affine ))
37
39
return ci .Cifti2MatrixIndicesMap (applies_to_matrix_dimension , 'CIFTI_INDEX_TYPE_BRAIN_MODELS' ,
38
- maps = [left_thalamus , left_cortex ])
40
+ maps = [left_thalamus , left_cortex , volume ])
39
41
40
42
41
43
def check_geometry_map (mapping ):
@@ -48,6 +50,7 @@ def check_geometry_map(mapping):
48
50
assert_equal (left_thalamus .model_type , 'CIFTI_MODEL_TYPE_VOXELS' )
49
51
assert_equal (left_thalamus .brain_structure , brain_models [0 ][0 ])
50
52
assert_equal (left_thalamus .vertex_indices , None )
53
+ assert_equal (left_thalamus .surface_number_of_vertices , None )
51
54
assert_equal (left_thalamus .voxel_indices_ijk ._indices , brain_models [0 ][1 ])
52
55
53
56
assert_equal (left_cortex .index_offset , 4 )
@@ -56,7 +59,10 @@ def check_geometry_map(mapping):
56
59
assert_equal (left_cortex .brain_structure , brain_models [1 ][0 ])
57
60
assert_equal (left_cortex .voxel_indices_ijk , None )
58
61
assert_equal (left_cortex .vertex_indices ._indices , brain_models [1 ][1 ])
62
+ assert_equal (left_cortex .surface_number_of_vertices , number_of_vertices )
59
63
64
+ assert_equal (mapping .volume .volume_dimensions , dimensions )
65
+ assert_true ((mapping .volume .transformation_matrix_voxel_indices_ijk_to_xyz .matrix == affine ).all ())
60
66
61
67
parcels = [('volume_parcel' , ([[60 , 60 , 60 ],
62
68
[61 , 59 , 60 ],
@@ -80,6 +86,10 @@ def create_parcel_map(applies_to_matrix_dimension):
80
86
else :
81
87
volume = ci .Cifti2VoxelIndicesIJK (element )
82
88
mapping .append (ci .Cifti2Parcel (name , volume , surfaces ))
89
+
90
+ mapping .extend ([ci .Cifti2Surface ('CIFTI_STRUCTURE_CORTEX_%s' % orientation ,
91
+ number_of_vertices ) for orientation in ['LEFT' , 'RIGHT' ]])
92
+ mapping .volume = ci .Cifti2Volume (dimensions , ci .Cifti2TransformationMatrixVoxelIndicesIJKtoXYZ (- 3 , affine ))
83
93
return mapping
84
94
85
95
@@ -98,14 +108,24 @@ def check_parcel_map(mapping):
98
108
else :
99
109
assert_equal (parcel .voxel_indices_ijk ._indices , element )
100
110
111
+ for surface , orientation in zip (mapping .surfaces , ('LEFT' , 'RIGHT' )):
112
+ assert_equal (surface .brain_structure , 'CIFTI_STRUCTURE_CORTEX_%s' % orientation )
113
+ assert_equal (surface .surface_number_of_vertices , number_of_vertices )
114
+
115
+ assert_equal (mapping .volume .volume_dimensions , dimensions )
116
+ assert_true ((mapping .volume .transformation_matrix_voxel_indices_ijk_to_xyz .matrix == affine ).all ())
117
+
118
+
101
119
scalars = [('first_name' , {'meta_key' : 'some_metadata' }),
102
120
('another name' , {})]
103
121
122
+
104
123
def create_scalar_map (applies_to_matrix_dimension ):
105
124
maps = [ci .Cifti2NamedMap (name , ci .Cifti2MetaData (meta )) for name , meta in scalars ]
106
125
return ci .Cifti2MatrixIndicesMap (applies_to_matrix_dimension , 'CIFTI_INDEX_TYPE_SCALARS' ,
107
126
maps = maps )
108
127
128
+
109
129
def check_scalar_map (mapping ):
110
130
assert_equal (mapping .indices_map_to_data_type , 'CIFTI_INDEX_TYPE_SCALARS' )
111
131
assert_equal (len (list (mapping .named_maps )), 2 )
@@ -134,6 +154,7 @@ def create_label_map(applies_to_matrix_dimension):
134
154
return ci .Cifti2MatrixIndicesMap (applies_to_matrix_dimension , 'CIFTI_INDEX_TYPE_LABELS' ,
135
155
maps = maps )
136
156
157
+
137
158
def check_label_map (mapping ):
138
159
assert_equal (mapping .indices_map_to_data_type , 'CIFTI_INDEX_TYPE_LABELS' )
139
160
assert_equal (len (list (mapping .named_maps )), 2 )
0 commit comments