qsirecon.interfaces.images module

Image tools interfaces

class qsirecon.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 qsirecon.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.

qsirecon.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

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