niworkflows.interfaces.nibabel module

Nibabel-based interfaces.

class niworkflows.interfaces.nibabel.ApplyMask(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Mask the input given a mask.

Mandatory Inputs
  • in_file (a pathlike object or string representing an existing file) – An image.

  • in_mask (a pathlike object or string representing an existing file) – A mask.

Optional Inputs

threshold (a float) – A threshold to the mask, if it is nonbinary. (Nipype default value: 0.5)

Outputs

out_file (a pathlike object or string representing an existing file) – Masked file.

class niworkflows.interfaces.nibabel.Binarize(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Binarizes the input image applying the given thresholds.

Mandatory Inputs
  • in_file (a pathlike object or string representing an existing file) – Input image.

  • thresh_low (a float) – Non-inclusive lower threshold.

Outputs
  • out_file (a pathlike object or string representing an existing file) – Masked file.

  • out_mask (a pathlike object or string representing an existing file) – Output mask.

class niworkflows.interfaces.nibabel.DemeanImage(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Mandatory Inputs
  • in_file (a pathlike object or string representing an existing file) – Image to be demeaned.

  • in_mask (a pathlike object or string representing an existing file) – Mask where median will be calculated.

Optional Inputs

only_mask (a boolean) – Demean only within mask. (Nipype default value: False)

Outputs

out_file (a pathlike object or string representing an existing file) – Demeaned image.

class niworkflows.interfaces.nibabel.FilledImageLike(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Mandatory Inputs

in_file (a pathlike object or string representing an existing file) – Image to be demeaned.

Optional Inputs
  • dtype (‘float32’ or ‘uint8’) – Force output data type. (Nipype default value: float32)

  • fill_value (a float) – Value to fill. (Nipype default value: 1.0)

Outputs

out_file (a pathlike object or string representing an existing file) – Demeaned image.

class niworkflows.interfaces.nibabel.GenerateSamplingReference(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

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

If the fov_mask optional input is provided, then the abbr:FoV (field-of-view) is cropped to a bounding box containing the brain mask plus an offest of two voxels along all dimensions. The fov_mask should be to the brain mask calculated from the T1w, and should not contain the brain stem. The mask is resampled into target space, and then the bounding box is calculated. Finally, the FoV is adjusted to that bounding box.

Mandatory Inputs
  • fixed_image (a pathlike object or string representing an existing file) – The reference file, defines the FoV.

  • moving_image (a pathlike object or string representing an existing file) – The pixel size reference.

Optional Inputs
  • fov_mask (a pathlike object or string representing an existing file or None) – Mask to clip field of view (in fixed_image space). (Nipype default value: None)

  • keep_native (a boolean) – Calculate a grid with native resolution covering the volume extent given by fixed_image, fast forward fixed_image otherwise. (Nipype default value: True)

  • xform_code (None or 2 or 4) – Force xform code. (Nipype default value: None)

Outputs

out_file (a pathlike object or string representing an existing file) – One file with all inputs flattened.

class niworkflows.interfaces.nibabel.IntensityClip(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Clip the intensity range as prescribed by the percentiles.

Mandatory Inputs

in_file (a pathlike object or string representing an existing file) – 3D file which intensity will be clipped.

Optional Inputs
  • dtype (‘int16’ or ‘float32’ or ‘uint8’) – Output datatype. (Nipype default value: int16)

  • invert (a boolean) – Finalize by inverting contrast. (Nipype default value: False)

  • nonnegative (a boolean) – Whether input intensities must be positive. (Nipype default value: True)

  • p_max (a float) – Percentile for the upper bound. (Nipype default value: 99.98)

  • p_min (a float) – Percentile for the lower bound. (Nipype default value: 35.0)

Outputs

out_file (a pathlike object or string representing an existing file) – File after clipping.

class niworkflows.interfaces.nibabel.MergeSeries(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Merge a series of 3D volumes along the last dimension into a single 4D image.

Optional Inputs
  • allow_4D (a boolean) – Whether 4D images are allowed to be concatenated. (Nipype default value: True)

  • in_files (a list of items which are a pathlike object or string representing an existing file)

Outputs

out_file (a pathlike object or string representing an existing file) – Output 4d image.

class niworkflows.interfaces.nibabel.RegridToZooms(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Change the resolution of an image (regrid).

Mandatory Inputs
  • in_file (a pathlike object or string representing an existing file) – A file whose resolution is to change.

  • zooms (a tuple of the form: (a float, a float, a float)) – The new resolution.

Optional Inputs
  • clip (a boolean) – Clip the data array within the original image’s range. (Nipype default value: True)

  • order (an integer) – Order of interpolator. (Nipype default value: 3)

  • smooth (a boolean or a float) – Apply gaussian smoothing before resampling. (Nipype default value: False)

Outputs

out_file (a pathlike object or string representing an existing file)

class niworkflows.interfaces.nibabel.SplitSeries(from_file=None, resource_monitor=None, **inputs)[source]

Bases: nipype.interfaces.base.core.SimpleInterface

Split a 4D dataset along the last dimension into a series of 3D volumes.

Mandatory Inputs

in_file (a pathlike object or string representing an existing file) – Input 4d image.

Outputs

out_files (a list of items which are a pathlike object or string representing an existing file) – Output list of 3d images.