Commit 670630ec authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'test/new_atlas' into 'master'

Updates to atlases

See merge request fsl/fslpy!51
parents 0801c756 1198b13e
Pipeline #1964 passed with stages
in 13 minutes and 55 seconds
......@@ -6,7 +6,7 @@ name=$1
version=$2
# add any extra channels that are needed
for channel in $CONDA_CHANNELS; do
for channel in $FSL_CONDA_CHANNELS; do
conda config --append channels $channel
done
......
......@@ -275,17 +275,27 @@ def ohi(namespace):
dumpatlases()
return
# atlasquery always uses 2mm atlas
# versions when a 2mm is available
reses = [p[0] for p in atlasDesc.pixdims]
if 2 in reses: res = 2
else: res = max(reses)
# Mask query.
if namespace.ohiMask is not None:
# atlasquery always uses 2mm atlas versions
mask = fslimage.Image(namespace.ohiMask)
labels, props = maskQuery(atlasDesc, [mask], resolution=2)
labels, props = maskQuery(atlasDesc, [mask], resolution=res)
labels = labels[0]
props = props[ 0]
for lbl, prop in zip(labels, props):
lbl = atlasDesc.labels[int(lbl)].name
if atlasDesc.atlasType == 'probabilistic':
lbl = atlasDesc.labels[int(lbl)].name
elif atlasDesc.atlasType == 'label':
lbl = atlasDesc.find(value=int(lbl)).name
print('{}:{:0.4f}'.format(lbl, prop))
# Coordinate query
......@@ -295,7 +305,7 @@ def ohi(namespace):
labels, props = coordQuery(atlasDesc,
[coord],
False,
resolution=2)
resolution=res)
labels = labels[0]
props = props[ 0]
......
......@@ -41,7 +41,7 @@ def _get_atlas(atlasID, res, summary=False):
atlas = _atlases.get((atlasID, res, summary), default=None)
if atlas is None:
if summary or atlasID in ('talairach', 'striatum-structural',
'jhu-labels'):
'jhu-labels', 'smatt'):
kwargs = {}
else:
kwargs = {'loadData' : False,
......
......@@ -155,8 +155,8 @@ def test_mask(seed):
exp = []
for lbl, prop in zip(labels, props):
exp.append('{}:{:0.4f}'.format(desc.labels[int(lbl)].name,
prop))
name = desc.find(value=int(lbl)).name
exp.append('{}:{:0.4f}'.format(name, prop))
return '\n'.join(exp)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment