sdcflows.interfaces.utils module

Utilities.

class sdcflows.interfaces.utils.ConvertWarp(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Convert a displacements field from 3dQwarp to ANTS-compatible.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Output of 3dQwarp.

Outputs:

out_file (a pathlike object or string representing an existing file) – The warp converted into ANTs.

class sdcflows.interfaces.utils.DenoiseImage(**inputs)[source]

Bases: DenoiseImage, CopyHeaderInterface

Wrapped executable: DenoiseImage.

Add copy_header capability to DenoiseImage from nipype.

Mandatory Inputs:
  • input_image (a pathlike object or string representing an existing file) – A scalar image is expected as input for noise correction. Maps to a command-line argument: -i %s.

  • save_noise (a boolean) – True if the estimated noise should be saved to file. Mutually exclusive with inputs: noise_image. (Nipype default value: False)

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • copy_header (a boolean) – Copy headers of the original image into the output (corrected) file. (Nipype default value: True)

  • dimension (2 or 3 or 4) – This option forces the image to be treated as a specified-dimensional image. If not specified, the program tries to infer the dimensionality from the input image. Maps to a command-line argument: -d %d.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • noise_image (a pathlike object or string representing a file) – Filename for the estimated noise.

  • noise_model (‘Gaussian’ or ‘Rician’) – Employ a Rician or Gaussian noise model. Maps to a command-line argument: -n %s. (Nipype default value: Gaussian)

  • num_threads (an integer) – Number of ITK threads to use. (Nipype default value: 1)

  • output_image (a pathlike object or string representing a file) – The output consists of the noise corrected version of the input image. Maps to a command-line argument: -o %s.

  • shrink_factor (an integer) – Running noise correction on large images can be time consuming. To lessen computation time, the input image can be resampled. The shrink factor, specified as a single integer, describes this resampling. Shrink factor = 1 is the default. Maps to a command-line argument: -s %s. (Nipype default value: 1)

  • verbose (a boolean) – Verbose output. Maps to a command-line argument: -v.

Outputs:
  • noise_image (a pathlike object or string representing a file)

  • output_image (a pathlike object or string representing an existing file)

class sdcflows.interfaces.utils.Deoblique(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Make a dataset plumb.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – The input dataset potentially oblique.

Optional Inputs:

in_mask (a pathlike object or string representing an existing file) – A binary mask corresponding to the input dataset.

Outputs:
  • out_file (a pathlike object or string representing an existing file) – The input dataset, after correcting obliquity.

  • out_mask (a pathlike object or string representing an existing file) – The input mask, after correcting obliquity.

class sdcflows.interfaces.utils.Flatten(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Flatten a list of 3D and 4D files (and metadata).

Mandatory Inputs:
  • in_data (a list of items which are a pathlike object or string representing an existing file) – List of input data.

  • in_meta (a list of items which are a dictionary with keys which are a string and with values which are any value) – List of metadata.

Optional Inputs:

max_trs (an integer) – Only pick first TRs. (Nipype default value: 50)

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

  • out_list (a list of items which are a tuple of the form: (a pathlike object or string representing an existing file, a dictionary with keys which are a string and with values which are any value)) – List of output files.

  • out_meta (a list of items which are a dictionary with keys which are a string and with values which are any value)

class sdcflows.interfaces.utils.PadSlices(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Check an image for uneven slices, and add an empty slice if necessary

This intends to avoid TOPUP’s segfault without changing the standard configuration

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – 3D or 4D NIfTI image.

Optional Inputs:

axis (an integer) – The axis through which slices are stacked in the input data. (Nipype default value: 2)

Outputs:
  • out_file (a pathlike object or string representing an existing file) – The output file with even number of slices.

  • padded (a boolean) – Indicator if the input image was padded.

class sdcflows.interfaces.utils.PositiveDirectionCosines(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Reorient axes polarity to have all positive direction cosines.

Mandatory Inputs:

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

Outputs:
  • in_orientation (a string)

  • out_file (a pathlike object or string representing a file)

class sdcflows.interfaces.utils.Reoblique(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Make a dataset plumb.

Mandatory Inputs:
  • in_epi (a pathlike object or string representing an existing file) – The original, potentially oblique EPI image.

  • in_field (a pathlike object or string representing an existing file) – The plumb field map, extracted from the displacements field estimated by SyN.

  • in_plumb (a pathlike object or string representing an existing file) – The plumb EPI image.

Optional Inputs:

in_mask (a pathlike object or string representing an existing file) – A binary mask corresponding to the input dataset.

Outputs:
  • out_epi (a pathlike object or string representing an existing file) – The reoblique’d EPI image.

  • out_field (a pathlike object or string representing an existing file) – The reoblique’d EPI image.

  • out_mask (a pathlike object or string representing an existing file) – The input mask, after correcting obliquity.

class sdcflows.interfaces.utils.ReorientImageAndMetadata(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

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

Optional Inputs:
  • pe_dir (a list of items which are ‘i’ or ‘i-’ or ‘j’ or ‘j-’ or ‘k’ or ‘k-’ or ‘x’ or ‘x-’ or ‘y’ or ‘y-’ or ‘z’ or ‘z-’)

  • target_orientation (a string) – Axis codes of coordinate system to reorient to.

Outputs:
  • out_file (a pathlike object or string representing a file) – Reoriented image.

  • pe_dir (a list of items which are ‘i’ or ‘i-’ or ‘j’ or ‘j-’ or ‘k’ or ‘k-’ or ‘x’ or ‘x-’ or ‘y’ or ‘y-’ or ‘z’ or ‘z-’)

class sdcflows.interfaces.utils.UniformGrid(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Ensure all images in input have the same spatial parameters.

Mandatory Inputs:

in_data (a list of items which are a pathlike object or string representing an existing file) – List of input data.

Optional Inputs:

reference (an integer) – Reference index. (Nipype default value: 0)

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

  • reference (a pathlike object or string representing an existing file)