Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
argstr="-s %s",
name_source='in_file',
name_template='%s_metrics.txt',
keep_extension=True,
desc='output metric values (DVARS etc.) file name',
hash_files=False)
out_metric_plot = File(
argstr="-p %s",
name_source='in_file',
name_template='%s_metrics.png',
hash_files=False,
keep_extension=True,
desc='output metric values plot (DVARS etc.) file name')
class MotionOutliersOutputSpec(TraitedSpec):
out_file = File(exists=True)
out_metric_values = File(exists=True)
out_metric_plot = File(exists=True)
class MotionOutliers(FSLCommand):
"""
Use FSL fsl_motion_outliers`http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FSLMotionOutliers`_ to find outliers in timeseries (4d) data.
Examples
--------
>>> from nipype.interfaces.fsl import MotionOutliers
>>> mo = MotionOutliers()
>>> mo.inputs.in_file = "epi.nii"
>>> mo.cmdline # doctest: +ELLIPSIS
'fsl_motion_outliers -i epi.nii -o epi_outliers.txt -p epi_metrics.png -s epi_metrics.txt'
>>> res = mo.run() # doctest: +SKIP
position=-2,
)
resampled_file = File(
argstr="-o %s", desc="output filename", genfile=True, position=-1
)
voxel_size = traits.Tuple(
traits.Float,
traits.Float,
traits.Float,
argstr="-vs %.2f %.2f %.2f",
desc="triplet of output voxel sizes",
mandatory=True,
)
class ResampleOutputSpec(TraitedSpec):
resampled_file = File(exists=True, desc="output filename")
class Resample(FSCommand):
"""Use FreeSurfer mri_convert to up or down-sample image files
Examples
--------
>>> from nipype.interfaces import freesurfer
>>> resampler = freesurfer.Resample()
>>> resampler.inputs.in_file = 'structural.nii'
>>> resampler.inputs.resampled_file = 'resampled.nii'
>>> resampler.inputs.voxel_size = (2.1, 2.1, 2.1)
>>> resampler.cmdline
'mri_convert -vs 2.10 2.10 2.10 -i structural.nii -o resampled.nii'
desc='transformation file(s) to be applied',
mandatory=True,
copyfile=False)
invert_affine = traits.List(
traits.Int,
desc=(
'List of Affine transformations to invert.'
'E.g.: [1,4,5] inverts the 1st, 4th, and 5th Affines '
'found in transformation_series. Note that indexing '
'starts with 1 and does not include warp fields. Affine '
'transformations are distinguished '
'from warp fields by the word "affine" included in their filenames.'
))
class WarpTimeSeriesImageMultiTransformOutputSpec(TraitedSpec):
output_image = File(exists=True, desc='Warped image')
class WarpTimeSeriesImageMultiTransform(ANTSCommand):
"""Warps a time-series from one space to another
Examples
--------
>>> from nipype.interfaces.ants import WarpTimeSeriesImageMultiTransform
>>> wtsimt = WarpTimeSeriesImageMultiTransform()
>>> wtsimt.inputs.input_image = 'resting.nii'
>>> wtsimt.inputs.reference_image = 'ants_deformed.nii.gz'
>>> wtsimt.inputs.transformation_series = ['ants_Warp.nii.gz','ants_Affine.txt']
>>> wtsimt.cmdline
'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii -R ants_deformed.nii.gz ants_Warp.nii.gz \
"length",
"endpointsep",
argstr='-tractstat %s',
units='NA',
xor=['tract_stat'],
desc=('Tract property average to compute in the connectivity matrix. '
'See TractStats for details.'))
output_root = File(
argstr='-outputroot %s',
genfile=True,
desc=('filename root prepended onto the names of the output files. '
'The extension will be determined from the input.'))
class ConmatOutputSpec(TraitedSpec):
conmat_sc = File(exists=True, desc='Connectivity matrix in CSV file.')
conmat_ts = File(desc='Tract statistics in CSV file.')
class Conmat(CommandLine):
"""
Creates a connectivity matrix using a 3D label image (the target image)
and a set of streamlines. The connectivity matrix records how many stream-
lines connect each pair of targets, and optionally the mean tractwise
statistic (eg tract-averaged FA, or length).
The output is a comma separated variable file or files. The first row of
the output matrix is label names. Label names may be defined by the user,
otherwise they are assigned based on label intensity.
Starting from the seed point, we move along the streamline until we find
desc='A value v in the diffusion tensor is scaled to v * s + i. This is '
'applied after any scaling specified by the input image. Default is 1.0.'
)
scaleinter = traits.Float(
argstr='-scaleinter %s',
desc='A value v in the diffusion tensor is scaled to v * s + i. This is '
'applied after any scaling specified by the input image. Default is 0.0.'
)
uppertriangular = traits.Bool(
argstr='-uppertriangular %s',
desc='Specifies input in upper-triangular (VTK style) order.')
class NIfTIDT2CaminoOutputSpec(TraitedSpec):
out_file = File(desc='diffusion tensors data in Camino format')
class NIfTIDT2Camino(CommandLine):
"""
Converts NIFTI-1 diffusion tensors to Camino format. The program reads the
NIFTI header but does not apply any spatial transformations to the data. The
NIFTI intensity scaling parameters are applied.
The output is the tensors in Camino voxel ordering: [exit, ln(S0), dxx, dxy,
dxz, dyy, dyz, dzz].
The exit code is set to 0 unless a background mask is supplied, in which case
the code is 0 in brain voxels and -1 in background voxels.
The value of ln(S0) in the output is taken from a file if one is supplied,
return None
class InvertInput(MINCCommandInputSpec):
in_file = File(position=0, argstr="%s", exists=True, mandatory=True, desc="main input xfm file")
out_file = File(position=2, argstr="%s", desc="output inverted xfm file")
clobber = traits.Bool(argstr="-clobber", usedefault=True, default_value=True, desc="Overwrite output file")
verbose = traits.Bool(argstr="-verbose", usedefault=True, default_value=True, desc="Write messages indicating progress")
class InvertOutput(TraitedSpec):
out_file = File(desc="transformation matrix")
class InvertCommand(MINCCommand, Info):
_cmd = "xfminvert"
_suffix = "_inv"
input_spec = InvertInput
output_spec = InvertOutput
def _parse_inputs(self, skip=None):
if skip is None:
skip = []
if not isdefined(self.inputs.out_file):
self.inputs.out_file = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.xfm')
return super(InvertCommand, self)._parse_inputs(skip=skip)
# optional
template_param = traits.Int(desc="Frame number of the input template")
averages = traits.Int(argstr="-a %d", desc="Average curvature patterns")
out_file = File(
argstr="%s",
exists=False,
position=-1,
name_template="%s.avg_curv",
hash_files=False,
name_source=['in_surf'],
keep_extension=False,
desc="File containing a surface-worth of per-vertex values, " +
"saved in 'curvature' format.")
class PaintOutputSpec(TraitedSpec):
out_file = File(
exists=False,
desc=
"File containing a surface-worth of per-vertex values, saved in 'curvature' format."
)
class Paint(FSCommand):
"""
This program is useful for extracting one of the arrays ("a variable")
from a surface-registration template file. The output is a file
containing a surface-worth of per-vertex values, saved in "curvature"
format. Because the template data is sampled to a particular surface
mesh, this conjures the idea of "painting to a surface".
Examples
traits.Bool,
File(),
hash_files=False,
desc=", name of HDF5 file containing BRAINSConstellationDetector Model file (LLSMatrices, LLSMeans and LLSSearchRadii), ",
argstr="--modelFile %s",
)
landmarkGlobPattern = traits.Str(
desc="Glob pattern to select fcsv files", argstr="--landmarkGlobPattern %s"
)
numberOfThreads = traits.Int(
desc="Explicitly specify the maximum number of threads to use.",
argstr="--numberOfThreads %d",
)
class fcsv_to_hdf5OutputSpec(TraitedSpec):
landmarksInformationFile = File(
desc=", name of HDF5 file to write matrices into, ", exists=True
)
modelFile = File(
desc=", name of HDF5 file containing BRAINSConstellationDetector Model file (LLSMatrices, LLSMeans and LLSSearchRadii), ",
exists=True,
)
class fcsv_to_hdf5(SEMLikeCommandLine):
"""title: fcsv_to_hdf5 (BRAINS)
category: Utilities.BRAINS
description: Convert a collection of fcsv files to a HDF5 format file
return runtime
def _parse_inputs(self, skip=None):
if not isdefined(self.inputs.out_file):
self.inputs.out_file = self.inputs.in_file
return super(e7emhdrCommand, self)._parse_inputs(skip=skip)
def _list_outputs(self):
outputs = self.output_spec().get()
outputs["out_file"] = self.inputs.in_file
return outputs
class eframeOutput(TraitedSpec):
pet_file = File(desc="PET image with correct time frames.")
#out_file_bkp = File(desc="PET image with correct times frames backup.")
class eframeInput(CommandLineInputSpec):
#out_file = File(desc="PET image with correct time frames.")
#out_file_bkp = File(desc="PET image with correct times frames backup.")
pet_file= File(exists=True, argstr="%s", position=-2, desc="PET file")
frame_file = File(exists=True, argstr="%s", position=-1, desc="PET file")
unit = traits.Bool(argstr="-sec", position=-3, usedefault=True, default_value=True, desc="Time units are in seconds.")
silent = traits.Bool(argstr="-s", position=-4, usedefault=True, default_value=True, desc="Silence outputs.")
class eframeCommand(CommandLine):
input_spec = eframeInput
output_spec = eframeOutput
)
flip_x = traits.Bool(
argstr='-flipx',
position=1,
desc=
"assume the transform is supplied assuming a coordinate system with the x-axis reversed relative to the MRtrix convention (i.e. x increases from right to left). This is required to handle transform matrices produced by FSL's FLIRT command. This is only used in conjunction with the -reference option."
)
quiet = traits.Bool(
argstr='-quiet',
position=1,
desc="Do not display information messages or progress status.")
debug = traits.Bool(
argstr='-debug', position=1, desc="Display debugging messages.")
class MRTransformOutputSpec(TraitedSpec):
out_file = File(exists=True, desc='the output image of the transformation')
class MRTransform(CommandLine):
"""
Apply spatial transformations or reslice images
Example
-------
>>> MRxform = MRTransform()
>>> MRxform.inputs.in_files = 'anat_coreg.mif'
>>> MRxform.run() # doctest: +SKIP
"""
_cmd = 'mrtransform'