Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pyxnat/core/derivatives/bamos_arterial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
XNAT_RESOURCE_NAME = 'BAMOS_ARTERIAL'


def stats(self):
""" Collects descriptive statistics based on the segmented lesions of the
white matter, including volumes and number of lesions per arterial
territory. A voxel is considered as a part of a lesion if it has a
value higher than 0.5."""
import pandas as pd
from io import StringIO

f = self.file('bamos_arterial_stats.csv')
uri = f._uri
res = self._intf.get(uri).text
text = StringIO(res)
df = pd.read_csv(text)
return df
7 changes: 7 additions & 0 deletions pyxnat/tests/test_resource_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,10 @@ def test_alps_fa_md_alps():
fa_assoc, md_assoc = fa_md.mean_assoc
assert fa_proj > md_proj
assert fa_assoc > md_assoc


def test_bamos_arterial_stats():
from math import isclose
r = e1.resource('BAMOS_ARTERIAL')
v = r.stats()
assert isclose(sum(v['volume']), 32995.6548)
Loading