qsiprep.interfaces.images module

Image tools interfaces

class qsiprep.interfaces.images.ChooseInterpolator(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

If the requested output resolution is more than 10% smaller than the input, use BSpline.

Mandatory Inputs:
  • dwi_files (a list of items which are a pathlike object or string representing an existing file)

  • output_resolution (a float)

Optional Inputs:

sloppy (a boolean) – (Nipype default value: False)

Outputs:

interpolation_method (‘LanczosWindowedSinc’ or ‘BSpline’ or ‘NearestNeighbor’ or ‘Linear’)

class qsiprep.interfaces.images.Conform(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Conform a series of T1w images to enable merging.

Performs two basic functions:

  1. Orient to LPS (right-left, anterior-posterior, inferior-superior)

  2. Resample to target zooms (voxel sizes) and shape (number of voxels)

Mandatory Inputs:

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

Optional Inputs:
  • deoblique_header (a boolean)

  • target_shape (a tuple of the form: (an integer, an integer, an integer)) – Target shape information.

  • target_zooms (a tuple of the form: (a float, a float, a float)) – Target zoom information.

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

  • transform (a pathlike object or string representing an existing file) – Conformation transform.

class qsiprep.interfaces.images.ConformDwi(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Conform a series of dwi images to enable merging. Performs three basic functions: #. Orient image to requested orientation #. Validate the qform and sform, set qform code to 1 #. Flip bvecs accordingly #. Do nothing to the bvals Note: This is not as nuanced as fmriprep’s version

Mandatory Inputs:

dwi_file (a pathlike object or string representing a file) – Dwi image.

Optional Inputs:
  • bval_file (a pathlike object or string representing an existing file)

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

  • orientation (‘LPS’ or ‘LAS’) – (Nipype default value: LPS)

Outputs:
  • bval_file (a pathlike object or string representing an existing file) – Conformed bval file.

  • bvec_file (a pathlike object or string representing an existing file) – Conformed bvec file.

  • dwi_file (a pathlike object or string representing an existing file) – Conformed dwi image.

  • out_report (a pathlike object or string representing an existing file) – HTML segment containing warning.

class qsiprep.interfaces.images.ExtractWM(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

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

Optional Inputs:
  • allow_fallback_mask (a boolean) – (Nipype default value: True)

  • wm_label (an integer) – (Nipype default value: 3)

Outputs:

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

class qsiprep.interfaces.images.IntraModalMerge(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

in_files (a list of items which are a pathlike object or string representing an existing file) – Input files.

Optional Inputs:
  • hmc (a boolean) – (Nipype default value: True)

  • to_lps (a boolean) – (Nipype default value: True)

  • zero_based_avg (a boolean) – (Nipype default value: True)

Outputs:
  • out_avg (a pathlike object or string representing an existing file) – Average image.

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

  • out_mats (a list of items which are a pathlike object or string representing an existing file) – Output matrices.

  • out_movpar (a list of items which are a pathlike object or string representing an existing file) – Output movement parameters.

class qsiprep.interfaces.images.SplitDWIsBvals(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Optional Inputs:
  • b0_threshold (an integer) – Maximum b-value that can be considered a b0. (Nipype default value: 50)

  • bval_file (a pathlike object or string representing a file) – The bval file.

  • bvec_file (a pathlike object or string representing a file) – The bvec file.

  • deoblique_bvecs (a boolean) – Write LPS+ world coordinate bvecs. (Nipype default value: False)

  • split_files (a list of items which are any value) – Pre-split DWI images.

Outputs:
  • b0_images (a list of items which are a pathlike object or string representing an existing file) – Just the b0s.

  • b0_indices (a list of items which are any value) – List of original indices for each b0 image.

  • bval_files (a list of items which are a pathlike object or string representing an existing file) – Single volume bvals.

  • bvec_files (a list of items which are a pathlike object or string representing an existing file) – Single volume bvecs.

class qsiprep.interfaces.images.SplitDWIsFSL(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Optional Inputs:
  • b0_threshold (an integer) – Maximum b-value that can be considered a b0. (Nipype default value: 50)

  • bval_file (a pathlike object or string representing a file) – The bval file.

  • bvec_file (a pathlike object or string representing a file) – The bvec file.

  • deoblique_bvecs (a boolean) – Write LPS+ world coordinate bvecs. (Nipype default value: False)

  • dwi_file (a pathlike object or string representing a file) – The dwi image.

Outputs:
  • b0_images (a list of items which are a pathlike object or string representing an existing file) – Just the b0s.

  • b0_indices (a list of items which are any value) – List of original indices for each b0 image.

  • bval_files (a list of items which are a pathlike object or string representing an existing file) – Single volume bvals.

  • bvec_files (a list of items which are a pathlike object or string representing an existing file) – Single volume bvecs.

  • dwi_files (a list of items which are a pathlike object or string representing an existing file) – Single volume dwis.

class qsiprep.interfaces.images.TSplit(**inputs)[source]

Bases: AFNICommand

Wrapped executable: 3dTsplit4D.

Converts a 3D + time dataset into multiple 3D volumes (one volume per file). For complete details, see the 3dTsplit4D Documentation.

Mandatory Inputs:
  • in_file (a pathlike object or string representing a file) – Input file to 3dTsplit4D. Maps to a command-line argument: %s (position: -1).

  • out_name (a pathlike object or string representing a file) – Output image file name. Maps to a command-line argument: -prefix %s.nii.

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

  • digits (an integer) – Number of digits to include in split file names. Maps to a command-line argument: -digits %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: {})

  • num_threads (an integer) – Set number of threads. (Nipype default value: 1)

  • out_file (a pathlike object or string representing a file) – Output image file name. Maps to a command-line argument: -prefix %s.

  • outputtype (‘NIFTI’ or ‘AFNI’ or ‘NIFTI_GZ’) – AFNI output filetype.

Outputs:

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

class qsiprep.interfaces.images.ValidateImage(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Check the correctness of x-form headers (matrix and code) This interface implements the following logic: +——————-+——————+——————+——————+————————————————+ | valid quaternions | qform_code > 0 | sform_code > 0 | qform == sform | actions | +===================+==================+==================+==================+================================================+ | True | True | True | True | None | +——————-+——————+——————+——————+————————————————+ | True | True | False | * | sform, scode <- qform, qcode | +——————-+——————+——————+——————+————————————————+ | * | * | True | False | qform, qcode <- sform, scode | +——————-+——————+——————+——————+————————————————+ | * | False | True | * | qform, qcode <- sform, scode | +——————-+——————+——————+——————+————————————————+ | * | False | False | * | sform, qform <- best affine; scode, qcode <- 1 | +——————-+——————+——————+——————+————————————————+ | False | * | False | * | sform, qform <- best affine; scode, qcode <- 1 | +——————-+——————+——————+——————+————————————————+

Mandatory Inputs:

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

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

  • out_report (a pathlike object or string representing an existing file) – HTML segment containing warning.

qsiprep.interfaces.images.bvec_to_rasb(bval_file, bvec_file, img_file, workdir)[source]

Use mrinfo to convert a bvec to RAS+ world coordinate reference frame

qsiprep.interfaces.images.reorient(in_file, newpath=None)[source]

Reorient Nifti files to LPS.

qsiprep.interfaces.images.reorient_to(in_file, orientation='LPS', newpath=None)[source]
qsiprep.interfaces.images.split_bvals_bvecs(bval_file, bvec_file, img_files, deoblique, working_dir)[source]

Split bvals and bvecs into one text file per image.

qsiprep.interfaces.images.to_lps(input_img, new_axcodes=('L', 'P', 'S'))[source]