Skip to content

Commit

Permalink
Merge pull request #1643 from oesteban/fix/1641
Browse files Browse the repository at this point in the history
FIX: FreeSurfer without adding some ``fs*`` to ``--output-spaces``
  • Loading branch information
oesteban committed May 21, 2019
2 parents eb3c838 + 94b1111 commit 9f21b46
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
26 changes: 25 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ jobs:
- image: docker:18.01.0-ce-git
working_directory: /tmp/src/fmriprep
steps:
- checkout
- run:
name: Check whether build should be skipped
command: |
if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then
echo "Only docs build"
circleci step halt
fi
- run:
name: Install parallel gzip and python3
command: |
Expand All @@ -21,7 +30,6 @@ jobs:
- docker-v3-
paths:
- /tmp/cache/docker.tar.gz
- checkout
- setup_remote_docker
- run:
name: Load Docker image layer cache
Expand Down Expand Up @@ -215,6 +223,10 @@ jobs:
name: Check whether build should be skipped
command: |
cd /home/circleci/src/fmriprep
if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then
echo "Only docs build"
circleci step halt
fi
if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?tests\]' )" != "" ]]; then
echo "Skipping pytest job"
circleci step halt
Expand Down Expand Up @@ -332,6 +344,10 @@ jobs:
name: Check whether build should be skipped
command: |
cd /home/circleci/src/fmriprep
if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then
echo "Only docs build"
circleci step halt
fi
if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?ds005\]' )" != "" ]]; then
echo "Skipping ds000005 build"
circleci step halt
Expand Down Expand Up @@ -482,6 +498,10 @@ jobs:
name: Check whether build should be skipped
command: |
cd /home/circleci/src/fmriprep
if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then
echo "Only docs build"
circleci step halt
fi
if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?ds054\]' )" != "" ]]; then
echo "Skipping ds000054 build"
circleci step halt
Expand Down Expand Up @@ -617,6 +637,10 @@ jobs:
name: Check whether build should be skipped
command: |
cd /home/circleci/src/fmriprep
if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then
echo "Only docs build"
circleci step halt
fi
if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?ds210\]' )" != "" ]]; then
echo "Skipping ds000210 build"
circleci step halt
Expand Down
5 changes: 3 additions & 2 deletions docs/workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,11 @@ Resampling BOLD runs onto standard spaces
from collections import OrderedDict
from fmriprep.workflows.bold import init_bold_std_trans_wf
wf = init_bold_std_trans_wf(
standard_spaces=OrderedDict([('MNI152Lin', {}),
('fsaverage', {'density': '10k'})]),
freesurfer=True,
mem_gb=3,
omp_nthreads=1,
standard_spaces=OrderedDict([('MNI152Lin', {}),
('fsaverage', {'density': '10k'})]),
)

This sub-workflow concatenates the transforms calculated upstream (see
Expand Down
7 changes: 4 additions & 3 deletions fmriprep/workflows/bold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def init_func_preproc_wf(
summary = pe.Node(
FunctionalSummary(
slice_timing=run_stc,
registration='FreeSurfer' if freesurfer else 'FSL',
registration=('FSL', 'FreeSurfer')[freesurfer],
registration_dof=bold2t1w_dof,
pe_direction=metadata.get("PhaseEncodingDirection"),
tr=metadata.get("RepetitionTime")),
Expand Down Expand Up @@ -739,12 +739,13 @@ def init_func_preproc_wf(
# Apply transforms in 1 shot
# Only use uncompressed output if AROMA is to be run
bold_std_trans_wf = init_bold_std_trans_wf(
standard_spaces=std_spaces,
freesurfer=freesurfer,
mem_gb=mem_gb['resampled'],
omp_nthreads=omp_nthreads,
standard_spaces=std_spaces,
name='bold_std_trans_wf',
use_compression=not low_mem,
use_fieldwarp=fmaps is not None,
name='bold_std_trans_wf'
)
workflow.connect([
(inputnode, bold_std_trans_wf, [
Expand Down
20 changes: 11 additions & 9 deletions fmriprep/workflows/bold/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ def select_target(subject_id, space):


def init_bold_std_trans_wf(
standard_spaces,
freesurfer,
mem_gb,
omp_nthreads,
standard_spaces,
name='bold_std_trans_wf',
use_compression=True,
use_fieldwarp=False
Expand All @@ -187,25 +188,28 @@ def init_bold_std_trans_wf(
from collections import OrderedDict
from fmriprep.workflows.bold import init_bold_std_trans_wf
wf = init_bold_std_trans_wf(
standard_spaces=OrderedDict([('MNI152Lin', {}),
('fsaverage', {'density': '10k'})]),
freesurfer=True,
mem_gb=3,
omp_nthreads=1,
standard_spaces=OrderedDict([('MNI152Lin', {}),
('fsaverage', {'density': '10k'})]),
)
**Parameters**
freesurfer : bool
Whether to generate FreeSurfer's aseg/aparc segmentations on BOLD space.
mem_gb : float
Size of BOLD file in GB
omp_nthreads : int
Maximum number of threads an individual process may use
standard_spaces : OrderedDict
Ordered dictionary where keys are TemplateFlow ID strings (e.g.,
``MNI152Lin``, ``MNI152NLin6Asym``, ``MNI152NLin2009cAsym``, or ``fsLR``),
or paths pointing to custom templates organized in a TemplateFlow-like structure.
Values of the dictionary aggregate modifiers (e.g., the value for the key ``MNI152Lin``
could be ``{'resolution': 2}`` if one wants the resampling to be done on the 2mm
resolution version of the selected template).
mem_gb : float
Size of BOLD file in GB
omp_nthreads : int
Maximum number of threads an individual process may use
name : str
Name of workflow (default: ``bold_std_trans_wf``)
use_compression : bool
Expand Down Expand Up @@ -268,8 +272,6 @@ def init_bold_std_trans_wf(

# Filter ``standard_spaces``
vol_std_spaces = [k for k in standard_spaces.keys() if not k.startswith('fs')]
freesurfer = [k for k in standard_spaces.keys()
if k.startswith('fs') and k != 'fsLR']

workflow = Workflow(name=name)

Expand Down

0 comments on commit 9f21b46

Please sign in to comment.