Skip to content

[ENH] Ensure that headers are consistent along the process #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7796de8
refactor MultiApplyTransforms interface, remove joblib dep, update ni…
oesteban Oct 6, 2017
03595c0
fix reference xforms
oesteban Oct 7, 2017
553d4ca
pin to a current niworkflows commit
oesteban Oct 7, 2017
fe1b3b2
Merge remote-tracking branch 'upstream/master' into fix/710
oesteban Oct 7, 2017
868aaa5
Merge remote-tracking branch 'upstream/master' into fix/710
oesteban Oct 7, 2017
43856ef
remove joblib import
oesteban Oct 7, 2017
7f031c4
remove Parallel
oesteban Oct 7, 2017
8865d90
fix passing parameters on _mat2itk
oesteban Oct 7, 2017
6d404d6
Merge branch 'master' into fix/710
effigies Oct 7, 2017
007e0e8
Merge remote-tracking branch 'upstream/master' into fix/710
oesteban Oct 8, 2017
5f40706
update niworkflows pin
oesteban Oct 8, 2017
fee6bbe
store antsApplyTransform command lines
oesteban Oct 8, 2017
594aee6
remove input in time
oesteban Oct 8, 2017
6a1704b
update niworkflows pin
oesteban Oct 9, 2017
ff66b17
change n_procs and variants to num_threads where necessary
oesteban Oct 9, 2017
84a4e2e
update niworkflows pin
oesteban Oct 9, 2017
3ea9c54
Use GenerateSamplingReference from niworkflows
oesteban Oct 9, 2017
9f262b0
Merge branch 'fix/710' of github.com:oesteban/fmriprep into fix/710
oesteban Oct 9, 2017
3172195
update niworkflows pin
oesteban Oct 9, 2017
854e056
fix error in MultiApplyTransforms
oesteban Oct 9, 2017
3234261
FIX: Convert LTA to ITK by way of FSL
effigies Oct 10, 2017
ba6db66
pin latest niworkflows
oesteban Oct 10, 2017
d2d2018
import SimpleInterface from nipype
oesteban Oct 10, 2017
256e9af
update niworkflows dependency
oesteban Oct 10, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fmriprep/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@
'grabbit',
'pybids>=0.3',
'nitime',
'niworkflows>=0.1.7',
'niworkflows>=0.1.8',
'statsmodels',
'nipype',
'seaborn',
'joblib',
]

LINKS_REQUIRES = []
LINKS_REQUIRES = [
]

TESTS_REQUIRES = [
"mock",
Expand Down
7 changes: 3 additions & 4 deletions fmriprep/interfaces/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# @Author: oesteban
# @Date: 2016-06-03 09:35:13
# @Last Modified by: oesteban
# @Last Modified time: 2017-02-13 11:44:23
# @Last Modified time: 2017-10-10 15:37:47
"""
Interfaces for handling BIDS-like neuroimaging structures
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -35,11 +35,10 @@
from niworkflows.nipype import logging
from niworkflows.nipype.interfaces.base import (
traits, isdefined, TraitedSpec, BaseInterfaceInputSpec,
File, Directory, InputMultiPath, OutputMultiPath, Str
File, Directory, InputMultiPath, OutputMultiPath, Str,
SimpleInterface
)

from niworkflows.interfaces.base import SimpleInterface

LOGGER = logging.getLogger('interface')
BIDS_NAME = re.compile(
'^(.*\/)?(?P<subject_id>sub-[a-zA-Z0-9]+)(_(?P<session_id>ses-[a-zA-Z0-9]+))?'
Expand Down
4 changes: 2 additions & 2 deletions fmriprep/interfaces/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import pandas as pd
from niworkflows.nipype import logging
from niworkflows.nipype.interfaces.base import (
traits, TraitedSpec, BaseInterfaceInputSpec, File, Directory, isdefined
traits, TraitedSpec, BaseInterfaceInputSpec, File, Directory, isdefined,
SimpleInterface
)
from niworkflows.interfaces.base import SimpleInterface

LOGGER = logging.getLogger('interface')

Expand Down
4 changes: 2 additions & 2 deletions fmriprep/interfaces/fmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from niworkflows.nipype import logging
from niworkflows.nipype.utils.filemanip import fname_presuffix
from niworkflows.nipype.interfaces.base import (
BaseInterfaceInputSpec, TraitedSpec, File, isdefined, traits)
from niworkflows.interfaces.base import SimpleInterface
BaseInterfaceInputSpec, TraitedSpec, File, isdefined, traits,
SimpleInterface)

LOGGER = logging.getLogger('interface')

Expand Down
3 changes: 1 addition & 2 deletions fmriprep/interfaces/freesurfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
isdefined, InputMultiPath, BaseInterfaceInputSpec, TraitedSpec, File, traits, Directory
)
from niworkflows.nipype.interfaces import freesurfer as fs

from niworkflows.interfaces.base import SimpleInterface
from niworkflows.nipype.interfaces.base import SimpleInterface


class StructuralReference(fs.RobustTemplate):
Expand Down
39 changes: 1 addition & 38 deletions fmriprep/interfaces/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,11 @@
traits, TraitedSpec, BaseInterfaceInputSpec,
File, InputMultiPath, OutputMultiPath)
from niworkflows.nipype.interfaces import fsl
from niworkflows.interfaces.base import SimpleInterface

from niworkflows.nipype.interfaces.base import SimpleInterface

LOGGER = logging.getLogger('interface')


class GenerateSamplingReferenceInputSpec(BaseInterfaceInputSpec):
fixed_image = File(exists=True, mandatory=True, desc='the reference file')
moving_image = File(exists=True, mandatory=True, desc='the pixel size reference')


class GenerateSamplingReferenceOutputSpec(TraitedSpec):
out_file = File(exists=True, desc='one file with all inputs flattened')


class GenerateSamplingReference(SimpleInterface):
"""
Generates a reference grid for resampling one image keeping original resolution,
but moving data to a different space (e.g. MNI)
"""

input_spec = GenerateSamplingReferenceInputSpec
output_spec = GenerateSamplingReferenceOutputSpec

def _run_interface(self, runtime):
self._results['out_file'] = _gen_reference(self.inputs.fixed_image,
self.inputs.moving_image)
return runtime


class IntraModalMergeInputSpec(BaseInterfaceInputSpec):
in_files = InputMultiPath(File(exists=True), mandatory=True,
desc='input files')
Expand Down Expand Up @@ -468,18 +443,6 @@ def _flatten_split_merge(in_files):
return merged, flat_split


def _gen_reference(fixed_image, moving_image, out_file=None):
if out_file is None:
out_file = fname_presuffix(fixed_image, suffix='_reference', newpath=os.getcwd())
new_zooms = nli.load_img(moving_image).header.get_zooms()[:3]
# Avoid small differences in reported resolution to cause changes to
# FOV. See https://github.com/poldracklab/fmriprep/issues/512
new_zooms_round = np.round(new_zooms, 3)
nli.resample_img(fixed_image, target_affine=np.diag(new_zooms_round),
interpolation='nearest').to_filename(out_file)
return out_file


def extract_wm(in_seg, wm_label=3):
import os.path as op
import nibabel as nb
Expand Down
Loading