<commit_before>"""The spm module provides basic functions for interfacing with matlab
and spm to access spm tools.

These functions include:

* SliceTiming: slice timing correction
    
* Realign: within-modality registration

* Coregister: between modality registration
    
* Normalize: non-linear warping to standard space

* Segment: bias correction, segmentation

* NewSegment: new version of segment supporting multimodal and multiclass segmentation

* Smooth: smooth with Gaussian kernel

"""
__docformat__ = 'restructuredtext'

# Standard library imports
from glob import glob
from copy import deepcopy
import os

# Third-party imports
import numpy as np

# Local imports
from nipype.interfaces.base import (OutputMultiPath, TraitedSpec,
                                    traits, InputMultiPath, File)
from nipype.interfaces.spm.base import (SPMCommand, scans_for_fname,
                                        scans_for_fnames, SPMCommandInputSpec)
from nipype.utils.misc import isdefined
from nipype.utils.filemanip import (fname_presuffix, filename_to_list,
                                    list_to_filename, split_filename)

class SliceTimingInputSpec(SPMCommandInputSpec):
    infile = InputMultiPath(File(exists=True), field='scans',
                          desc='list of filenames to apply slice timing',
                          mandatory=True, copyfile=False)
    num_slices = traits.Int(field='nslices',
                              desc='number of slices in a volume')
    time_repetition = traits.Float(field='tr',
                                   desc='time between volume acquisitions ' \
                                       '(start to start time)')
    time_acquisition = traits.Float(field='ta',
                                    desc='time of volume acquisition. usually ' \
                                        'calculated as TR-(TR/num_slices)')
    slice_order = traits.List(traits.Int(), field='so',
                               desc='1-based order in which slices are acquired')
    ref_slice = traits.Int(field='refslice',
                             desc='1-based Number of the reference slice')

class SliceTimingOutputSpec(TraitedSpec):
    timecorrected_files = OutputMultiPath(File(exist=True, desc='slice time corrected files'))

class SliceTiming(SPMCommand):
    """Use spm to perform slice timing correction.

    See SliceTiming().spm_doc() for more information.

    Examples
    --------

    >>> from nipype.interfaces.spm import SliceTiming
    >>> st = SliceTiming()
    >>> st.inputs.infile = 'func.nii'
    >>> st.inputs.num_slices = 32
    >>> st.inputs.time_repetition = 6.0
    >>> st.inputs.time_acquisition = 6. - 6./32.
    >>> st.inputs.slice_order = range(32,0,-1)
    >>> st.inputs.ref_slice = 1 # doctest: +SKIP
    
    """
<commit_msg>added input and output spec to slicetiming for spm<commit_after>"""The spm module provides basic functions for interfacing with matlab
and spm to access spm tools.

These functions include:

* SliceTiming: slice timing correction
    
* Realign: within-modality registration

* Coregister: between modality registration
    
* Normalize: non-linear warping to standard space

* Segment: bias correction, segmentation

* NewSegment: new version of segment supporting multimodal and multiclass segmentation

* Smooth: smooth with Gaussian kernel

"""
__docformat__ = 'restructuredtext'

# Standard library imports
from glob import glob
from copy import deepcopy
import os

# Third-party imports
import numpy as np

# Local imports
from nipype.interfaces.base import (OutputMultiPath, TraitedSpec,
                                    traits, InputMultiPath, File)
from nipype.interfaces.spm.base import (SPMCommand, scans_for_fname,
                                        scans_for_fnames, SPMCommandInputSpec)
from nipype.utils.misc import isdefined
from nipype.utils.filemanip import (fname_presuffix, filename_to_list,
                                    list_to_filename, split_filename)

class SliceTimingInputSpec(SPMCommandInputSpec):
    infile = InputMultiPath(File(exists=True), field='scans',
                          desc='list of filenames to apply slice timing',
                          mandatory=True, copyfile=False)
    num_slices = traits.Int(field='nslices',
                              desc='number of slices in a volume')
    time_repetition = traits.Float(field='tr',
                                   desc='time between volume acquisitions ' \
                                       '(start to start time)')
    time_acquisition = traits.Float(field='ta',
                                    desc='time of volume acquisition. usually ' \
                                        'calculated as TR-(TR/num_slices)')
    slice_order = traits.List(traits.Int(), field='so',
                               desc='1-based order in which slices are acquired')
    ref_slice = traits.Int(field='refslice',
                             desc='1-based Number of the reference slice')

class SliceTimingOutputSpec(TraitedSpec):
    timecorrected_files = OutputMultiPath(File(exist=True, desc='slice time corrected files'))

class SliceTiming(SPMCommand):
    """Use spm to perform slice timing correction.

    See SliceTiming().spm_doc() for more information.

    Examples
    --------

    >>> from nipype.interfaces.spm import SliceTiming
    >>> st = SliceTiming()
    >>> st.inputs.infile = 'func.nii'
    >>> st.inputs.num_slices = 32
    >>> st.inputs.time_repetition = 6.0
    >>> st.inputs.time_acquisition = 6. - 6./32.
    >>> st.inputs.slice_order = range(32,0,-1)
    >>> st.inputs.ref_slice = 1 # doctest: +SKIP
    
    """

    input_spec = SliceTimingInputSpec
    output_spec = SliceTimingOutputSpec
    
{'fraction_non_alphanumeric': 0.08932916232186305, 'fraction_numerical': 0.005213764337851929, 'mean_word_length': 2.4337708830548928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3611291', 'n_tokens_mistral': 1621, 'n_tokens_neox': 1543, 'n_words': 428}