|
@@ -24,10 +24,12 @@ import pytest
|
|
|
from conftest import SUBJECTS_DIR
|
|
|
from freesurfer_stats import CorticalParcellationStats
|
|
|
|
|
|
+
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
('path', 'headers', 'hemisphere',
|
|
|
- 'whole_brain_measurements', 'structural_measurements'),
|
|
|
+ 'whole_brain_measurements', 'structural_measurements_length',
|
|
|
+ 'structural_measurements_subset'),
|
|
|
[(os.path.join(SUBJECTS_DIR, 'fabian', 'stats', 'lh.aparc.DKTatlas.stats.short'),
|
|
|
{'CreationTime': datetime.datetime(2019, 5, 9, 21, 5, 54, tzinfo=datetime.timezone.utc),
|
|
|
'generating_program': 'mris_anatomical_stats',
|
|
@@ -56,6 +58,7 @@ from freesurfer_stats import CorticalParcellationStats
|
|
|
'supratentorial_volume_mm^3': 1172669.548920,
|
|
|
'supratentorial_volume_without_ventricles_mm^3': 1164180.548920,
|
|
|
'estimated_total_intracranial_volume_mm^3': 1670487.274486},
|
|
|
+ 3,
|
|
|
[{'structure_name': 'caudalanteriorcingulate',
|
|
|
'number_of_vertices': 2061,
|
|
|
'surface_area_mm^2': 1472,
|
|
@@ -115,6 +118,7 @@ from freesurfer_stats import CorticalParcellationStats
|
|
|
'supratentorial_volume_mm^3': 1172669.548920,
|
|
|
'supratentorial_volume_without_ventricles_mm^3': 1164180.548920,
|
|
|
'estimated_total_intracranial_volume_mm^3': 1670487.274486},
|
|
|
+ 2,
|
|
|
[{'structure_name': 'bankssts',
|
|
|
'number_of_vertices': 1344,
|
|
|
'surface_area_mm^2': 825,
|
|
@@ -134,9 +138,71 @@ from freesurfer_stats import CorticalParcellationStats
|
|
|
'integrated_rectified_mean_curvature_mm^-1': 0.110,
|
|
|
'integrated_rectified_gaussian_curvature_mm^-2': 0.021,
|
|
|
'folding_index': 3,
|
|
|
- 'intrinsic_curvature_index': 0.6}])],
|
|
|
+ 'intrinsic_curvature_index': 0.6}]),
|
|
|
+ (os.path.join(
|
|
|
+ SUBJECTS_DIR, 'soichi', 'stats', 'rh.aparc.stats'),
|
|
|
+ {'CreationTime': datetime.datetime(2020, 5, 4, 22, 20, 26, tzinfo=datetime.timezone.utc),
|
|
|
+ 'AnnotationFileTimeStamp': datetime.datetime(2020, 5, 4, 21, 58, 13),
|
|
|
+ 'AnnotationFile': '../label/rh.aparc.annot',
|
|
|
+ 'SUBJECTS_DIR': '/N/dc2/scratch/hayashis/bigred3-workflows'
|
|
|
+ '/5eb0689676c10ead933d673c/5eb068b076c10e7b013d673f',
|
|
|
+ 'anatomy_type': 'surface',
|
|
|
+ 'cmdline': 'mris_anatomical_stats -th3 -mgz -cortex ../label/rh.cortex.label '
|
|
|
+ '-f ../stats/rh.aparc.stats -b -a ../label/rh.aparc.annot -c '
|
|
|
+ '../label/aparc.annot.ctab output rh white',
|
|
|
+ 'cvs_version': '7.0.0',
|
|
|
+ 'generating_program': 'mris_anatomical_stats',
|
|
|
+ 'hemi': 'rh',
|
|
|
+ 'hostname': 'nid00762',
|
|
|
+ 'machine': 'x86_64',
|
|
|
+ 'mrisurf.c-cvs_version': '7.0.0',
|
|
|
+ 'subjectname': 'output',
|
|
|
+ 'sysname': 'Linux',
|
|
|
+ 'user': 'hayashis'},
|
|
|
+ 'right',
|
|
|
+ {'white_surface_total_area_mm^2': 83579.2,
|
|
|
+ 'mean_thickness_mm': 2.35815,
|
|
|
+ 'brain_segmentation_volume_mm^3': 1169408.0,
|
|
|
+ 'brain_segmentation_volume_without_ventricles_mm^3': 1157593.0,
|
|
|
+ 'brain_segmentation_volume_without_ventricles_from_surf_mm^3': 1157593.0,
|
|
|
+ 'total_cortical_gray_matter_volume_mm^3': 454587.696158,
|
|
|
+ 'supratentorial_volume_mm^3': 1023873.0,
|
|
|
+ 'supratentorial_volume_without_ventricles_mm^3': 1012058.0,
|
|
|
+ 'estimated_total_intracranial_volume_mm^3': 1420434.160521},
|
|
|
+ 34,
|
|
|
+ [{'structure_name': 'bankssts',
|
|
|
+ 'number_of_vertices': 1094,
|
|
|
+ 'surface_area_mm^2': 757,
|
|
|
+ 'gray_matter_volume_mm^3': 1725,
|
|
|
+ 'average_thickness_mm': 2.215,
|
|
|
+ 'thickness_stddev_mm': 0.544,
|
|
|
+ 'integrated_rectified_mean_curvature_mm^-1': 0.109,
|
|
|
+ 'integrated_rectified_gaussian_curvature_mm^-2': 0.025,
|
|
|
+ 'folding_index': 9,
|
|
|
+ 'intrinsic_curvature_index': 1.1},
|
|
|
+ {'structure_name': 'caudalanteriorcingulate',
|
|
|
+ 'number_of_vertices': 1137,
|
|
|
+ 'surface_area_mm^2': 780,
|
|
|
+ 'gray_matter_volume_mm^3': 2327,
|
|
|
+ 'average_thickness_mm': 2.842,
|
|
|
+ 'thickness_stddev_mm': 0.667,
|
|
|
+ 'integrated_rectified_mean_curvature_mm^-1': 0.116,
|
|
|
+ 'integrated_rectified_gaussian_curvature_mm^-2': 0.021,
|
|
|
+ 'folding_index': 11,
|
|
|
+ 'intrinsic_curvature_index': 1.0},
|
|
|
+ {'structure_name': 'caudalmiddlefrontal',
|
|
|
+ 'number_of_vertices': 3126,
|
|
|
+ 'surface_area_mm^2': 2218,
|
|
|
+ 'gray_matter_volume_mm^3': 5978,
|
|
|
+ 'average_thickness_mm': 2.447,
|
|
|
+ 'thickness_stddev_mm': 0.605,
|
|
|
+ 'integrated_rectified_mean_curvature_mm^-1': 0.122,
|
|
|
+ 'integrated_rectified_gaussian_curvature_mm^-2': 0.024,
|
|
|
+ 'folding_index': 28,
|
|
|
+ 'intrinsic_curvature_index': 3.1}])],
|
|
|
)
|
|
|
-def test_read(path, headers, hemisphere, whole_brain_measurements, structural_measurements):
|
|
|
+def test_read(path, headers, hemisphere, whole_brain_measurements, structural_measurements_length,
|
|
|
+ structural_measurements_subset):
|
|
|
stats = CorticalParcellationStats.read(path)
|
|
|
assert headers == stats.headers
|
|
|
assert hemisphere == stats.hemisphere
|
|
@@ -159,9 +225,10 @@ def test_read(path, headers, hemisphere, whole_brain_measurements, structural_me
|
|
|
'folding_index',
|
|
|
'intrinsic_curvature_index',
|
|
|
]
|
|
|
+ assert len(stats.structural_measurements) == structural_measurements_length
|
|
|
pandas.util.testing.assert_frame_equal(
|
|
|
- left=pandas.DataFrame(structural_measurements),
|
|
|
- right=stats.structural_measurements,
|
|
|
+ left=pandas.DataFrame(structural_measurements_subset),
|
|
|
+ right=stats.structural_measurements.iloc[:3],
|
|
|
check_like=True,
|
|
|
check_dtype=True,
|
|
|
check_names=True,
|