Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/enh/new_sentry_api' into enh/new…
…_sentry_api
  • Loading branch information
chrisgorgo committed Nov 11, 2018
2 parents e3bfafe + 8c5f336 commit 131baa8
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 77 deletions.
30 changes: 15 additions & 15 deletions .circleci/config.yml
Expand Up @@ -354,10 +354,10 @@ jobs:
at: /tmp
- restore_cache:
keys:
- ds005-anat-v10-{{ .Branch }}-{{ epoch }}
- ds005-anat-v10-{{ .Branch }}
- ds005-anat-v10-master
- ds005-anat-v10-
- ds005-anat-v11-{{ .Branch }}-{{ epoch }}
- ds005-anat-v11-{{ .Branch }}
- ds005-anat-v11-master
- ds005-anat-v11-
- run:
name: Setting up test
command: |
Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:
--sloppy --write-graph --mem_mb 4096 \
--nthreads 2 --anat-only -vv
- save_cache:
key: ds005-anat-v10-{{ .Branch }}-{{ epoch }}
key: ds005-anat-v11-{{ .Branch }}-{{ epoch }}
paths:
- /tmp/ds005/work
- /tmp/ds005/derivatives/fmriprep
Expand Down Expand Up @@ -484,10 +484,10 @@ jobs:
at: /tmp
- restore_cache:
keys:
- ds054-anat-v7-{{ .Branch }}-{{ epoch }}
- ds054-anat-v7-{{ .Branch }}
- ds054-anat-v7-master
- ds054-anat-v7-
- ds054-anat-v8-{{ .Branch }}-{{ epoch }}
- ds054-anat-v8-{{ .Branch }}
- ds054-anat-v8-master
- ds054-anat-v8-
- run:
name: Setting up test
command: |
Expand Down Expand Up @@ -521,7 +521,7 @@ jobs:
--fs-no-reconall --sloppy --write-graph \
--mem_mb 4096 --nthreads 2 --anat-only -vv
- save_cache:
key: ds054-anat-v7-{{ .Branch }}-{{ epoch }}
key: ds054-anat-v8-{{ .Branch }}-{{ epoch }}
paths:
- /tmp/ds054/work
- /tmp/ds054/derivatives
Expand Down Expand Up @@ -602,10 +602,10 @@ jobs:
at: /tmp
- restore_cache:
keys:
- ds210-anat-v5-{{ .Branch }}-{{ epoch }}
- ds210-anat-v5-{{ .Branch }}
- ds210-anat-v5-master
- ds210-anat-v5-
- ds210-anat-v6-{{ .Branch }}-{{ epoch }}
- ds210-anat-v6-{{ .Branch }}
- ds210-anat-v6-master
- ds210-anat-v6-
- run:
name: Setting up test
command: |
Expand Down Expand Up @@ -639,7 +639,7 @@ jobs:
--fs-no-reconall --sloppy --write-graph \
--mem_mb 4096 --nthreads 2 --anat-only -vv
- save_cache:
key: ds210-anat-v5-{{ .Branch }}-{{ epoch }}
key: ds210-anat-v6-{{ .Branch }}-{{ epoch }}
paths:
- /tmp/ds210/work
- /tmp/ds210/derivatives
Expand Down
12 changes: 12 additions & 0 deletions CHANGES.rst
@@ -1,3 +1,15 @@
1.2.2 (November 9, 2018)
========================

Several bug fixes. With thanks to Franz Liem, Nir Jacoby and Markus Handal Sneve for contributions.

* [FIX] Do not show --debug deprecation warning unless used (#1361) @effigies
* [FIX] Select consistent parcellation for producing aparcaseg derivatives (#1369) @nirjacoby
* [FIX] Count non-steady-state volumes even if sbref is passed (#1373) @effigies
* [ENH] Respect SliceEncodingDirection metadata (#1350) @fliem
* [ENH] Set maximum MELODIC components to 200 by default (#1366) @markushs
* [TEST] Verify LegacyMultiProc functionality (#1368) @effigies

1.2.1 (November 1, 2018)
========================

Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Expand Up @@ -144,11 +144,13 @@ ENV MKL_NUM_THREADS=1 \
WORKDIR /root/

# Precaching atlases
ENV CRN_SHARED_DATA /niworkflows_data
ENV CRN_SHARED_DATA /templateflow
ADD docker/scripts/get_templates.sh get_templates.sh
RUN mkdir $CRN_SHARED_DATA && \
/root/get_templates.sh && \
chmod -R a+rX $CRN_SHARED_DATA
find $CRN_SHARED_DATA -type d -exec chmod 555 {} \; && \
find $CRN_SHARED_DATA -type f -exec chmod 444 {} \; && \
chmod +w $CRN_SHARED_DATA

# Installing dev requirements (packages that are not in pypi)
ADD requirements.txt requirements.txt
Expand Down
14 changes: 5 additions & 9 deletions docker/scripts/get_templates.sh
@@ -1,13 +1,11 @@
#!/bin/bash

MNI_TEMPLATE="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/580705eb594d9001ed622649"
MNI_SHA256="608b1d609255424d51300e189feacd5ec74b04e244628303e802a6c0b0f9d9db"
ASYM_09C_TEMPLATE_OLD="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/580705089ad5a101f17944a9"
ASYM_09C_SHA256_OLD="a24699ba0d13f72d0f8934cc211cb80bfd9c9a077b481d9b64295cf5275235a9"
MNI_TEMPLATE="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5bc984f8ccdb6b0018abb993"
MNI_SHA256="9bb06ab27d45d21e7f8b2bc2ca27227f081ecb051bbd438a0bfbc56ddc089cac"
ASYM_09C_TEMPLATE="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5b0dbce20f461a000db8fa3d"
ASYM_09C_SHA256="2851302474359c2c48995155aadb48b861e5dcf87aefda71af8010f671e8ed66"
OASIS_TEMPLATE="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/584123a29ad5a1020913609d"
OASIS_SHA256="d87300e91346c16f55baf6f54f5f990bc020b61e8d5df9bcc3abb0cc4b943113"
OASIS_TEMPLATE="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5b0dbce34c28ef0012c7f788"
OASIS_SHA256="b7202abbca2c69b514a68b8457e3f718a57ccac2c2990fcf7f27ab12f1698645"
NKI_TEMPLATE="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5bc3fad82aa873001bc5a553"
NKI_SHA256="9c08713d067bcf13baa61b01a9495e526b55d1f148d951da01e082679f076fa9"
OASIS_DKT31_TEMPLATE="https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5b16f17aeca4a80012bd7542"
Expand All @@ -30,10 +28,8 @@ GET(){
}

set -e
echo "Getting MNI template"
echo "Getting MNI152Lin template"
GET "$MNI_TEMPLATE" "$MNI_SHA256"
echo "Getting (deprecated version of) MNI152NLin2009cAsym template"
GET "$ASYM_09C_TEMPLATE_OLD" "$ASYM_09C_SHA256_OLD"
echo "Getting MNI152NLin2009cAsym template"
GET "$ASYM_09C_TEMPLATE" "$ASYM_09C_SHA256"
echo "Getting OASIS template"
Expand Down
4 changes: 2 additions & 2 deletions docs/environment.yml
Expand Up @@ -21,13 +21,13 @@ dependencies:
- python-dateutil
- pydot>=1.2.3
- cython
- nipype>=1.1.1
- nipype>=1.1.5

- pip:
- sphinx-argparse
- doctest-ignore-unicode
- svgutils
- nitime
- nilearn
- niworkflows==0.4.4
- git+https://github.com/nipy/nipype.git@67d6212a9cabd395ee74f7818d09d8ea6c8426a4#egg=nipype
- niworkflows==0.5.1
2 changes: 1 addition & 1 deletion fmriprep/__about__.py
Expand Up @@ -98,7 +98,7 @@
'pybids==0.6.5',
'nitime',
'nipype>=1.1.5',
'niworkflows==0.4.4',
'niworkflows==0.5.1',
'statsmodels',
'seaborn',
'indexed_gzip>=0.8.2',
Expand Down
48 changes: 19 additions & 29 deletions fmriprep/workflows/anatomical.py
Expand Up @@ -20,8 +20,6 @@
"""

import os.path as op

from pkg_resources import resource_filename as pkgr

from nipype.pipeline import engine as pe
Expand Down Expand Up @@ -50,12 +48,8 @@
)
from ..utils.misc import fix_multi_T1w_source_name, add_suffix
from ..interfaces.freesurfer import (
PatchedLTAConvert as LTAConvert,
PatchedRobustRegister as RobustRegister)

TEMPLATE_MAP = {
'MNI152NLin2009cAsym': 'mni_icbm152_nlin_asym_09c',
}
PatchedLTAConvert as LTAConvert,
PatchedRobustRegister as RobustRegister)


# pylint: disable=R0914
Expand Down Expand Up @@ -337,10 +331,10 @@ def init_anat_preproc_wf(skull_strip_template, output_spaces, template, debug,
)

if 'template' in output_spaces:
template_str = TEMPLATE_MAP[template]
ref_img = op.join(nid.get_dataset(template_str), '1mm_T1.nii.gz')
ref_img = str(nid.get_template(template) /
('tpl-%s_space-MNI_res-01_T1w.nii.gz' % template))

t1_2_mni.inputs.template = template_str
t1_2_mni.inputs.template = template
mni_mask.inputs.reference_image = ref_img
mni_seg.inputs.reference_image = ref_img
mni_tpms.inputs.reference_image = ref_img
Expand Down Expand Up @@ -614,7 +608,7 @@ def init_skullstrip_ants_wf(skull_strip_template, debug, omp_nthreads,
Reportlet visualizing quality of skull-stripping
"""
from niworkflows.data.getters import get_dataset
from niworkflows.data.getters import get_template, TEMPLATE_ALIASES

if skull_strip_template not in ['OASIS', 'NKI']:
raise ValueError("Unknown skull-stripping template; select from {OASIS, NKI}")
Expand All @@ -625,20 +619,10 @@ def init_skullstrip_ants_wf(skull_strip_template, debug, omp_nthreads,
(ANTs {ants_ver}), using {skullstrip_tpl} as target template.
""".format(ants_ver=BrainExtraction().version or '<ver>', skullstrip_tpl=skull_strip_template)

# Grabbing the appropriate template elements
template_dir = get_dataset('ants_%s_template_ras' % skull_strip_template.lower())
brain_probability_mask = op.join(
template_dir, 'T_template0_BrainCerebellumProbabilityMask.nii.gz')

# TODO: normalize these names so this is not necessary
if skull_strip_template == 'OASIS':
brain_template = op.join(template_dir, 'T_template0.nii.gz')
extraction_registration_mask = op.join(
template_dir, 'T_template0_BrainCerebellumRegistrationMask.nii.gz')
elif skull_strip_template == 'NKI':
brain_template = op.join(template_dir, 'T_template.nii.gz')
extraction_registration_mask = op.join(
template_dir, 'T_template_BrainCerebellumExtractionMask.nii.gz')
# Account for template aliases
template_name = TEMPLATE_ALIASES.get(skull_strip_template, skull_strip_template)
# Template path
template_dir = get_template(template_name)

inputnode = pe.Node(niu.IdentityInterface(fields=['in_file']),
name='inputnode')
Expand All @@ -651,9 +635,15 @@ def init_skullstrip_ants_wf(skull_strip_template, debug, omp_nthreads,
keep_temporary_files=1, use_random_seeding=not skull_strip_fixed_seed),
name='t1_skull_strip', n_procs=omp_nthreads)

t1_skull_strip.inputs.brain_template = brain_template
t1_skull_strip.inputs.brain_probability_mask = brain_probability_mask
t1_skull_strip.inputs.extraction_registration_mask = extraction_registration_mask
# Set appropriate inputs
t1_skull_strip.inputs.brain_template = str(
template_dir / ('tpl-%s_res-01_T1w.nii.gz' % template_name))
t1_skull_strip.inputs.brain_probability_mask = str(
template_dir /
('tpl-%s_res-01_class-brainmask_probtissue.nii.gz' % template_name))
t1_skull_strip.inputs.extraction_registration_mask = str(
template_dir /
('tpl-%s_res-01_label-BrainCerebellumExtraction_roi.nii.gz' % template_name))

workflow.connect([
(inputnode, t1_skull_strip, [('in_file', 'anatomical_image')]),
Expand Down
12 changes: 6 additions & 6 deletions fmriprep/workflows/bold/confounds.py
Expand Up @@ -9,13 +9,12 @@
.. autofunction:: init_ica_aroma_wf
"""
import os
from nipype.pipeline import engine as pe
from nipype.interfaces import utility as niu, fsl
from nipype.interfaces.nilearn import SignalExtraction
from nipype.algorithms import confounds as nac

from niworkflows.data import get_mni_icbm152_linear, get_mni_icbm152_nlin_asym_09c
from niworkflows.data import get_template
from niworkflows.interfaces.segmentation import ICA_AROMARPT
from niworkflows.interfaces.masks import ROIsPlot
from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms
Expand Down Expand Up @@ -358,8 +357,9 @@ def init_carpetplot_wf(mem_gb, metadata, name="bold_carpet_wf"):
# Warp segmentation into EPI space
resample_parc = pe.Node(ApplyTransforms(
float=True,
input_image=os.path.join(
get_mni_icbm152_nlin_asym_09c(), '1mm_parc.nii.gz'),
input_image=str(
get_template('MNI152NLin2009cAsym') /
'tpl-MNI152NLin2009cAsym_space-MNI_res-01_label-carpet_atlas.nii.gz'),
dimension=3, default_value=0, interpolation='MultiLabel'),
name='resample_parc')

Expand Down Expand Up @@ -533,8 +533,8 @@ def init_ica_aroma_wf(template, metadata, mem_gb, omp_nthreads,
template=template,
mem_gb=mem_gb,
omp_nthreads=omp_nthreads,
template_out_grid=os.path.join(get_mni_icbm152_linear(),
'2mm_T1.nii.gz'),
template_out_grid=str(
get_template('MNI152Lin') / 'tpl-MNI152Lin_space-MNI_res-02_T1w.nii.gz'),
use_compression=False,
use_fieldwarp=use_fieldwarp,
name='bold_mni_trans_wf'
Expand Down
28 changes: 16 additions & 12 deletions fmriprep/workflows/bold/resampling.py
Expand Up @@ -10,14 +10,11 @@
.. autofunction:: init_bold_preproc_trans_wf
"""
import os.path as op


from nipype.pipeline import engine as pe
from nipype.interfaces import utility as niu, freesurfer as fs
from nipype.interfaces.fsl import Split as FSLSplit

from niworkflows import data as nid
from niworkflows.data import get_template, TEMPLATE_ALIASES
from niworkflows.interfaces.utils import GenerateSamplingReference
from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms

Expand All @@ -30,7 +27,6 @@
PatchedConcatenateLTA as ConcatenateLTA,
PatchedLTAConvert as LTAConvert
)
from ..anatomical import TEMPLATE_MAP

from .util import init_bold_reference_wf

Expand Down Expand Up @@ -263,8 +259,13 @@ def _aslist(in_value):

gen_ref = pe.Node(GenerateSamplingReference(), name='gen_ref',
mem_gb=0.3) # 256x256x256 * 64 / 8 ~ 150MB)
template_str = TEMPLATE_MAP[template]
gen_ref.inputs.fixed_image = op.join(nid.get_dataset(template_str), '1mm_T1.nii.gz')
# Account for template aliases
template_name = TEMPLATE_ALIASES.get(template, template)
# Template path
template_dir = get_template(template_name)

gen_ref.inputs.fixed_image = str(
template_dir / ('tpl-%s_space-MNI_res-01_T1w.nii.gz' % template_name))

mask_mni_tfm = pe.Node(
ApplyTransforms(interpolation='MultiLabel', float=True),
Expand Down Expand Up @@ -322,11 +323,14 @@ def _aslist(in_value):
(gen_ref, mask_mni_tfm, [('out_file', 'reference_image')]),
(gen_ref, bold_to_mni_transform, [('out_file', 'reference_image')]),
])
elif template_out_grid == '1mm' or template_out_grid == '2mm':
mask_mni_tfm.inputs.reference_image = op.join(
nid.get_dataset(template_str), '%s_brainmask.nii.gz' % template_out_grid)
bold_to_mni_transform.inputs.reference_image = op.join(
nid.get_dataset(template_str), '%s_T1.nii.gz' % template_out_grid)
elif template_out_grid in ['1mm', '2mm']:
res = int(template_out_grid[0])
mask_mni_tfm.inputs.reference_image = str(
template_dir /
('tpl-%s_space-MNI_res-%02d_brainmask.nii.gz' % (template_name, res)))
bold_to_mni_transform.inputs.reference_image = str(
template_dir /
('tpl-%s_space-MNI_res-%02d_T1w.nii.gz' % (template_name, res)))
else:
mask_mni_tfm.inputs.reference_image = template_out_grid
bold_to_mni_transform.inputs.reference_image = template_out_grid
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,4 +1,4 @@
niworkflows==0.4.4
niworkflows==0.5.1
grabbit==0.2.3
pybids==0.6.5
versioneer
Expand Down

0 comments on commit 131baa8

Please sign in to comment.