1414from numpy .testing import assert_equal , assert_raises , dec , assert_allclose
1515
1616from .. import (read_geometry , read_morph_data , read_annot , read_label ,
17- write_geometry , write_morph_data , write_annot )
17+ write_geometry , write_morph_data , write_annot ,
18+ read_aseg_stats )
1819
1920from ...tests .nibabel_data import get_nibabel_data , needs_nibabel_data
2021from ...fileslice import strided_scalar
@@ -145,6 +146,18 @@ def test_morph_data():
145146 assert_equal (curv2 , curv )
146147
147148
149+ @freesurfer_test
150+ def test_aseg_stats ():
151+ """Test reader for stats/aseg.stats """
152+ stats_path = pjoin (data_path , "stats" , "aseg.stats" )
153+
154+ stats = read_aseg_stats (stats_path , volumes_only = True )
155+ assert_true (np .alltrue (np .isfinite (stats )))
156+
157+ seg_name , seg_index , seg_stats = read_aseg_stats (stats_path , volumes_only = False )
158+
159+
160+
148161def test_write_morph_data ():
149162 """Test write_morph_data edge cases"""
150163 values = np .arange (20 , dtype = '>f4' )
@@ -222,3 +235,5 @@ def test_label():
222235 labels , scalars = read_label (label_path , True )
223236 assert_true (np .all (labels == label ))
224237 assert_true (len (labels ) == len (scalars ))
238+
239+ test_aseg_stats ()
0 commit comments