sdcflows.interfaces.fmap module#

Interfaces to deal with the various types of fieldmap sources.

class sdcflows.interfaces.fmap.CheckB0Units(from_file=None, resource_monitor=None, **inputs)[source]#

Bases: SimpleInterface

Ensure the input fieldmap is given in Hz.

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

  • units (‘Hz’ or ‘rad/s’) – Fieldmap units.

Outputs:

out_file (a pathlike object or string representing an existing file) – Output fieldmap in Hz.

class sdcflows.interfaces.fmap.CheckRegister(from_file=None, resource_monitor=None, **inputs)[source]#

Bases: SimpleInterface

Check registration of one or more images and paired files

Use cases:

Phase1 + Phase2:

>>> fmap_files = ['*_phase1.nii.gz', '*_phase2.nii.gz']
>>> mag_files = ['*_magnitude1.nii.gz', '*_magnitude2.nii.gz']

Phasediff (2 magnitude):

>>> fmap_files = ['*_phasediff.nii.gz']
>>> mag_files = ['*_magnitude1.nii.gz', '*_magnitude2.nii.gz']

Phasediff (1 magnitude):

>>> fmap_files = ['*_phasediff.nii.gz']
>>> mag_files = ['*_magnitude1.nii.gz']

Fieldmap (1 magnitude):

>>> fmap_files = ['*_fieldmap.nii.gz']
>>> mag_files = ['*_magnitude.nii.gz']

In general, we expect all files to have the same affine and shape, and this will be a pass-through interface. If there are two magnitude files where the affine differs, then we will register them and inspect the registration parameters for evidence of significantly different FoV. The default values of 0.02rad and 1mm both correspond to shifts of 1mm (assuming 50mm radius brain).

This may run mri_robust_register, so should not be run without submitting.

Mandatory Inputs:
  • fmap_files (a list of from 1 to 2 items which are a pathlike object or string representing an existing file) – Phase(diff) or fieldmap image(s) to update affines.

  • mag_files (a list of from 1 to 2 items which are a pathlike object or string representing an existing file) – Magnitude image(s) to verify registration.

  • rot_thresh (a float) – Rotation threshold in radians. (Nipype default value: 0.02)

  • trans_thresh (a float) – Translation threshold in mm. (Nipype default value: 1.0)

Outputs:
  • fmap_files (a list of items which are a pathlike object or string representing a file) – Fieldmap files with consistent affines.

  • mag_files (a list of items which are a pathlike object or string representing a file) – Magnitude image(s) verified to be in register, with consistent affines.

class sdcflows.interfaces.fmap.DisplacementsField2Fieldmap(from_file=None, resource_monitor=None, **inputs)[source]#

Bases: SimpleInterface

Convert from a transform to a B0 fieldmap in Hz.

Mandatory Inputs:
  • epi (a pathlike object or string representing an existing file) – Source EPI image.

  • pe_dir (‘j-’ or ‘j’ or ‘i’ or ‘i-’ or ‘k’ or ‘k-’) – Phase encoding direction.

  • ro_time (a float) – Total readout time.

  • transform (a pathlike object or string representing an existing file) – Input displacements field.

Optional Inputs:
  • demean (a boolean) – Regress field to the mean. (Nipype default value: False)

  • itk_transform (a boolean) – Whether this is an ITK/ANTs transform. (Nipype default value: True)

Outputs:

out_file (a pathlike object or string representing an existing file) – Output fieldmap in Hz.

class sdcflows.interfaces.fmap.PhaseMap2rads(from_file=None, resource_monitor=None, **inputs)[source]#

Bases: SimpleInterface

Convert a phase map given in a.u. (e.g., 0-4096) to radians.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Input (wrapped) phase map.

Outputs:

out_file (a pathlike object or string representing a file) – The phase map in the range 0 - 6.28.

class sdcflows.interfaces.fmap.Phasediff2Fieldmap(from_file=None, resource_monitor=None, **inputs)[source]#

Bases: SimpleInterface

Convert a phase difference map into a fieldmap in Hz.

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

  • metadata (a dictionary with keys which are any value and with values which are any value) – BIDS metadata dictionary.

Outputs:

out_file (a pathlike object or string representing a file) – The output fieldmap.

class sdcflows.interfaces.fmap.SubtractPhases(from_file=None, resource_monitor=None, **inputs)[source]#

Bases: SimpleInterface

Calculate a phase difference map.

Optional Inputs:
  • in_meta (a list of items which are a dictionary with keys which are any value and with values which are any value) – Metadata corresponding to the inputs.

  • in_phases (a list of items which are a pathlike object or string representing an existing file) – Input phase maps.

Outputs:
  • metadata (a dictionary with keys which are any value and with values which are any value) – Output metadata.

  • phase_diff (a pathlike object or string representing an existing file) – Phase difference map.