Skip to content
Snippets Groups Projects
Commit 670630ec authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Merge branch 'test/new_atlas' into 'master'

Updates to atlases

See merge request fsl/fslpy!51
parents 0801c756 1198b13e
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -6,7 +6,7 @@ name=$1 ...@@ -6,7 +6,7 @@ name=$1
version=$2 version=$2
# add any extra channels that are needed # 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 conda config --append channels $channel
done done
......
...@@ -275,17 +275,27 @@ def ohi(namespace): ...@@ -275,17 +275,27 @@ def ohi(namespace):
dumpatlases() dumpatlases()
return 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. # Mask query.
if namespace.ohiMask is not None: if namespace.ohiMask is not None:
# atlasquery always uses 2mm atlas versions
mask = fslimage.Image(namespace.ohiMask) mask = fslimage.Image(namespace.ohiMask)
labels, props = maskQuery(atlasDesc, [mask], resolution=2) labels, props = maskQuery(atlasDesc, [mask], resolution=res)
labels = labels[0] labels = labels[0]
props = props[ 0] props = props[ 0]
for lbl, prop in zip(labels, props): 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)) print('{}:{:0.4f}'.format(lbl, prop))
# Coordinate query # Coordinate query
...@@ -295,7 +305,7 @@ def ohi(namespace): ...@@ -295,7 +305,7 @@ def ohi(namespace):
labels, props = coordQuery(atlasDesc, labels, props = coordQuery(atlasDesc,
[coord], [coord],
False, False,
resolution=2) resolution=res)
labels = labels[0] labels = labels[0]
props = props[ 0] props = props[ 0]
......
...@@ -41,7 +41,7 @@ def _get_atlas(atlasID, res, summary=False): ...@@ -41,7 +41,7 @@ def _get_atlas(atlasID, res, summary=False):
atlas = _atlases.get((atlasID, res, summary), default=None) atlas = _atlases.get((atlasID, res, summary), default=None)
if atlas is None: if atlas is None:
if summary or atlasID in ('talairach', 'striatum-structural', if summary or atlasID in ('talairach', 'striatum-structural',
'jhu-labels'): 'jhu-labels', 'smatt'):
kwargs = {} kwargs = {}
else: else:
kwargs = {'loadData' : False, kwargs = {'loadData' : False,
......
...@@ -155,8 +155,8 @@ def test_mask(seed): ...@@ -155,8 +155,8 @@ def test_mask(seed):
exp = [] exp = []
for lbl, prop in zip(labels, props): for lbl, prop in zip(labels, props):
exp.append('{}:{:0.4f}'.format(desc.labels[int(lbl)].name, name = desc.find(value=int(lbl)).name
prop)) exp.append('{}:{:0.4f}'.format(name, prop))
return '\n'.join(exp) return '\n'.join(exp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment