diff --git a/.ci/build_conda_dist.sh b/.ci/build_conda_dist.sh index 4aadf35054c296b1ba5d7b6814435d42134ad2d9..f4d94d8fa5aa3ec96b53da8e0b6ce2036b54a2cf 100644 --- a/.ci/build_conda_dist.sh +++ b/.ci/build_conda_dist.sh @@ -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 diff --git a/fsl/scripts/atlasq.py b/fsl/scripts/atlasq.py index bd2459490b22ae8628842951fc0655d94b0ef050..502965767c1aa1e972abd46fac89b87ff029ff82 100644 --- a/fsl/scripts/atlasq.py +++ b/fsl/scripts/atlasq.py @@ -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] diff --git a/tests/test_atlases_query.py b/tests/test_atlases_query.py index ea72f6686fcc23d3a3f4cac9eb97b1855ec4a317..29676a09bb81fc0fb280bb602a80e34c8eb72825 100644 --- a/tests/test_atlases_query.py +++ b/tests/test_atlases_query.py @@ -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, diff --git a/tests/test_atlasq_ohi.py b/tests/test_atlasq_ohi.py index 96c61572fd841e6a453cde97343d610a52891dce..c4a0938d5f5e6480411a21d3d77861681ee3fdcb 100644 --- a/tests/test_atlasq_ohi.py +++ b/tests/test_atlasq_ohi.py @@ -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)