1818 Cifti2MatrixIndicesMap , Cifti2NamedMap , Cifti2Parcel ,
1919 Cifti2Surface , Cifti2TransformationMatrixVoxelIndicesIJKtoXYZ ,
2020 Cifti2Vertices , Cifti2Volume , CIFTI_BRAIN_STRUCTURES ,
21- CIFTI_MODEL_TYPES , _underscore , CIFTI2HeaderError )
21+ CIFTI_MODEL_TYPES , _underscore , Cifti2HeaderError )
2222from .. import xmlutils as xml
2323from ..spatialimages import HeaderDataError
2424from ..externals .six import BytesIO
@@ -186,7 +186,7 @@ def StartElementHandler(self, name, attrs):
186186 matrix = Cifti2Matrix ()
187187 parent = self .struct_state [- 1 ]
188188 if not isinstance (parent , Cifti2Header ):
189- raise CIFTI2HeaderError (
189+ raise Cifti2HeaderError (
190190 'Matrix element can only be a child of the CIFTI2 Header element'
191191 )
192192 parent .matrix = matrix
@@ -197,7 +197,7 @@ def StartElementHandler(self, name, attrs):
197197 meta = Cifti2MetaData ()
198198 parent = self .struct_state [- 1 ]
199199 if not isinstance (parent , (Cifti2Matrix , Cifti2NamedMap )):
200- raise CIFTI2HeaderError (
200+ raise Cifti2HeaderError (
201201 'MetaData element can only be a child of the CIFTI2 Matrix or NamedMap elements'
202202 )
203203
@@ -229,7 +229,7 @@ def StartElementHandler(self, name, attrs):
229229 setattr (mim , _underscore (key ), dtype (attrs [key ]))
230230 matrix = self .struct_state [- 1 ]
231231 if not isinstance (matrix , Cifti2Matrix ):
232- raise CIFTI2HeaderError (
232+ raise Cifti2HeaderError (
233233 'MatrixIndicesMap element can only be a child of the CIFTI2 Matrix element'
234234 )
235235 matrix .append (mim )
@@ -240,7 +240,7 @@ def StartElementHandler(self, name, attrs):
240240 named_map = Cifti2NamedMap ()
241241 mim = self .struct_state [- 1 ]
242242 if not isinstance (mim , Cifti2MatrixIndicesMap ):
243- raise CIFTI2HeaderError (
243+ raise Cifti2HeaderError (
244244 'NamedMap element can only be a child of the CIFTI2 MatrixIndicesMap element'
245245 )
246246 self .struct_state .append (named_map )
@@ -250,13 +250,13 @@ def StartElementHandler(self, name, attrs):
250250 named_map = self .struct_state [- 1 ]
251251 mim = self .struct_state [- 2 ]
252252 if mim .indices_map_to_data_type != "CIFTI_INDEX_TYPE_LABELS" :
253- raise CIFTI2HeaderError (
253+ raise Cifti2HeaderError (
254254 'LabelTable element can only be a child of a MatrixIndicesMap '
255255 'with CIFTI_INDEX_TYPE_LABELS type'
256256 )
257257 lata = Cifti2LabelTable ()
258258 if not isinstance (named_map , Cifti2NamedMap ):
259- raise CIFTI2HeaderError (
259+ raise Cifti2HeaderError (
260260 'LabelTable element can only be a child of the CIFTI2 NamedMap element'
261261 )
262262 self .fsm_state .append ('LabelTable' )
@@ -266,7 +266,7 @@ def StartElementHandler(self, name, attrs):
266266 elif name == 'Label' :
267267 lata = self .struct_state [- 1 ]
268268 if not isinstance (lata , Cifti2LabelTable ):
269- raise CIFTI2HeaderError (
269+ raise Cifti2HeaderError (
270270 'Label element can only be a child of the CIFTI2 LabelTable element'
271271 )
272272 label = Cifti2Label ()
@@ -282,7 +282,7 @@ def StartElementHandler(self, name, attrs):
282282 elif name == "MapName" :
283283 named_map = self .struct_state [- 1 ]
284284 if not isinstance (named_map , Cifti2NamedMap ):
285- raise CIFTI2HeaderError (
285+ raise Cifti2HeaderError (
286286 'MapName element can only be a child of the CIFTI2 NamedMap element'
287287 )
288288
@@ -293,11 +293,11 @@ def StartElementHandler(self, name, attrs):
293293 surface = Cifti2Surface ()
294294 mim = self .struct_state [- 1 ]
295295 if not isinstance (mim , Cifti2MatrixIndicesMap ):
296- raise CIFTI2HeaderError (
296+ raise Cifti2HeaderError (
297297 'Surface element can only be a child of the CIFTI2 MatrixIndicesMap element'
298298 )
299299 if mim .indices_map_to_data_type != "CIFTI_INDEX_TYPE_PARCELS" :
300- raise CIFTI2HeaderError (
300+ raise Cifti2HeaderError (
301301 'Surface element can only be a child of a MatrixIndicesMap '
302302 'with CIFTI_INDEX_TYPE_PARCELS type'
303303 )
@@ -309,7 +309,7 @@ def StartElementHandler(self, name, attrs):
309309 parcel = Cifti2Parcel ()
310310 mim = self .struct_state [- 1 ]
311311 if not isinstance (mim , Cifti2MatrixIndicesMap ):
312- raise CIFTI2HeaderError (
312+ raise Cifti2HeaderError (
313313 'Parcel element can only be a child of the CIFTI2 MatrixIndicesMap element'
314314 )
315315 parcel .name = attrs ["Name" ]
@@ -321,12 +321,12 @@ def StartElementHandler(self, name, attrs):
321321 vertices = Cifti2Vertices ()
322322 parcel = self .struct_state [- 1 ]
323323 if not isinstance (parcel , Cifti2Parcel ):
324- raise CIFTI2HeaderError (
324+ raise Cifti2HeaderError (
325325 'Vertices element can only be a child of the CIFTI2 Parcel element'
326326 )
327327 vertices .brain_structure = attrs ["BrainStructure" ]
328328 if vertices .brain_structure not in CIFTI_BRAIN_STRUCTURES :
329- raise CIFTI2HeaderError (
329+ raise Cifti2HeaderError (
330330 'BrainStructure for this Vertices element is not valid'
331331 )
332332 parcel .append_cifti_vertices (vertices )
@@ -337,7 +337,7 @@ def StartElementHandler(self, name, attrs):
337337 elif name == "VoxelIndicesIJK" :
338338 parent = self .struct_state [- 1 ]
339339 if not isinstance (parent , (Cifti2Parcel , Cifti2BrainModel )):
340- raise CIFTI2HeaderError (
340+ raise Cifti2HeaderError (
341341 'VoxelIndicesIJK element can only be a child of the CIFTI2 '
342342 'Parcel or BrainModel elements'
343343 )
@@ -347,7 +347,7 @@ def StartElementHandler(self, name, attrs):
347347 elif name == "Volume" :
348348 mim = self .struct_state [- 1 ]
349349 if not isinstance (mim , Cifti2MatrixIndicesMap ):
350- raise CIFTI2HeaderError (
350+ raise Cifti2HeaderError (
351351 'Volume element can only be a child of the CIFTI2 MatrixIndicesMap element'
352352 )
353353 dimensions = tuple ([int (val ) for val in
@@ -360,7 +360,7 @@ def StartElementHandler(self, name, attrs):
360360 elif name == "TransformationMatrixVoxelIndicesIJKtoXYZ" :
361361 volume = self .struct_state [- 1 ]
362362 if not isinstance (volume , Cifti2Volume ):
363- raise CIFTI2HeaderError (
363+ raise Cifti2HeaderError (
364364 'TransformationMatrixVoxelIndicesIJKtoXYZ element can only be a child '
365365 'of the CIFTI2 Volume element'
366366 )
@@ -375,12 +375,12 @@ def StartElementHandler(self, name, attrs):
375375 model = Cifti2BrainModel ()
376376 mim = self .struct_state [- 1 ]
377377 if not isinstance (mim , Cifti2MatrixIndicesMap ):
378- raise CIFTI2HeaderError (
378+ raise Cifti2HeaderError (
379379 'BrainModel element can only be a child '
380380 'of the CIFTI2 MatrixIndicesMap element'
381381 )
382382 if mim .indices_map_to_data_type != "CIFTI_INDEX_TYPE_BRAIN_MODELS" :
383- raise CIFTI2HeaderError (
383+ raise Cifti2HeaderError (
384384 'BrainModel element can only be a child of a MatrixIndicesMap '
385385 'with CIFTI_INDEX_TYPE_BRAIN_MODELS type'
386386 )
@@ -392,11 +392,11 @@ def StartElementHandler(self, name, attrs):
392392 if key in attrs :
393393 setattr (model , _underscore (key ), dtype (attrs [key ]))
394394 if model .brain_structure not in CIFTI_BRAIN_STRUCTURES :
395- raise CIFTI2HeaderError (
395+ raise Cifti2HeaderError (
396396 'BrainStructure for this BrainModel element is not valid'
397397 )
398398 if model .model_type not in CIFTI_MODEL_TYPES :
399- raise CIFTI2HeaderError (
399+ raise Cifti2HeaderError (
400400 'ModelType for this BrainModel element is not valid'
401401 )
402402 mim .append (model )
@@ -407,7 +407,7 @@ def StartElementHandler(self, name, attrs):
407407 index = Cifti2VertexIndices ()
408408 model = self .struct_state [- 1 ]
409409 if not isinstance (model , Cifti2BrainModel ):
410- raise CIFTI2HeaderError (
410+ raise Cifti2HeaderError (
411411 'VertexIndices element can only be a child '
412412 'of the CIFTI2 BrainModel element'
413413 )
0 commit comments