Skip to content

Commit 6184801

Browse files
committed
FIX: aparc() misses side for hemisphere-specific measures (pyxnat#209)
1 parent 18bd208 commit 6184801

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

pyxnat/core/derivatives/freesurfer.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def aparc(self, atlas='desikan-killiany'):
6767

6868
thickness = ['MeanThickness']
6969

70+
# hemisphere-specific measurements in ?h.aparc.stats
71+
hemi_measures = unitless + surfaces + thickness
72+
7073
columns = ['StructName', 'NumVert', 'SurfArea', 'GrayVol', 'ThickAvg',
7174
'ThickStd', 'MeanCurv', 'GausCurv', 'FoldInd', 'CurvInd']
7275

@@ -99,7 +102,12 @@ def aparc(self, atlas='desikan-killiany'):
99102
m = [e for e in res2 if each == e.split(', ')[1]]
100103
if len(m) == 1:
101104
m = float(m[0].split(', ')[-2])
102-
table.append([None, unit, each, m])
105+
# add side only for the hemisphere-specific measures
106+
s = side if each in hemi_measures else None
107+
if s is None and side == 'right':
108+
# avoid registering global measures twice
109+
continue
110+
table.append([s, unit, each, m])
103111

104112
res2 = [e for e in res if not e.startswith('#')]
105113
d2 = [[each for each in e.split(' ') if each != ''] for e in res2]

pyxnat/tests/test_resource_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_freesurfer7_hippoSfVolumes():
131131
def test_freesurfer7_aparc():
132132
r = e1.resource('FREESURFER7')
133133
hv = r.aparc()
134-
assert (hv.shape == (632, 4))
134+
assert (hv.shape == (625, 4))
135135
q = 'region=="supramarginal" & side=="left" & measurement=="CurvInd"'
136136
v = hv.query(q)['value'].tolist()[0]
137137
assert(v == '5.0')

0 commit comments

Comments
 (0)