FSL

Module contents

Custom interface classes for FSL analyses.

Submodules

django_mri.analysis.interfaces.fsl.fast module

Definition of the FastWrapper class.

class django_mri.analysis.interfaces.fsl.fast.FastWrapper(**inputs)

Bases: nipype.interfaces.fsl.preprocess.FAST

A simple subclass of nipype’s FAST interface, tweaking the run() method’s output slightly to make output specification easier.

run(*args, **kwargs) → dict

Edits the returned results dictionary to simplify the output specification.

Returns:FAST results
Return type:dict

django_mri.analysis.interfaces.fsl.fsl_anat module

Definition of the FslAnat class.

class django_mri.analysis.interfaces.fsl.fsl_anat.FslAnat(weak_bias: bool = False, no_reorient: bool = False, no_crop: bool = False, no_bias: bool = False, no_registration: bool = False, no_nonlinear_registration: bool = False, no_segmentation: bool = False, no_subcortical_segmentation: bool = False, no_search: bool = False, bias_field_smoothing: float = None, image_type: str = 'T1', no_cleanup: bool = False)

Bases: object

Custom interface class for the fsl_anat anatomical preprocessing script.

FLAGS = {'no_nonlinear_registration': 'nononlinreg', 'no_registration': 'noreg', 'no_segmentation': 'noseg', 'no_subcortical_segmentation': 'nosubcortseg'}

Conversion dictionary between the verbose names given to the class initialization keyword arguments and the script’s parameters.

FLAG_ATTRIBUTES = ('weak_bias', 'no_reorient', 'no_crop', 'no_bias', 'no_registration', 'no_nonlinear_registration', 'no_segmentation', 'no_subcortical_segmentation', 'no_search', 'no_cleanup')

“Flags” indicate parameters that are specified without any arguments, i.e. they are a switch for some binary configuration.

FORCED_SUFFIX = '.anat'

A suffix given by fsl_anat and removed by the interface.

OUTPUT_FILES = {'bias_corrected_brain': 'T1_biascorr_brain.nii.gz', 'bias_corrected_brain_mask': 'T1_biascorr_brain_mask.nii.gz', 'csf_partial_volume': 'T1_fast_pve_0.nii.gz', 'fast_bias_correction': 'T1_biascorr.nii.gz', 'grey_matter_partial_volume': 'T1_fast_pve_1.nii.gz', 'linear_registration': 'T1_to_MNI_lin.nii.gz', 'nonlinear_registration': 'T1_to_MNI_nonlin.nii.gz', 'nonlinear_registration_field': 'T1_to_MNI_nonlin_field.nii.gz', 'nonlinear_registration_jacobian': 'T1_to_MNI_nonlin_jac.nii.gz', 'segmentation_summary': 'T1_fast_pveseg.nii.gz', 'subcortical_segmentation_summary': 'T1_subcort_seg.nii.gz', 'volume_scales': 'T1_vols.txt', 'white_matter_partial_volume': 'T1_fast_pve_2.nii.gz'}

A dictionary of the file names expected to be created by running the script.

fix_output_path(destination: pathlib.Path) → None

Removed the forced .anat suffix appended to the destination directory.

Parameters:destination (Path) – Destination directory
generate_command(scan, destination: pathlib.Path = None) → str

Returns the command to be executed in order to run the analysis.

Parameters:
  • scan (NIfTI) – The scan to run the analysis on
  • destination (Path, optional) – The directory in which output files should be created, by default None
Returns:

Command string

Return type:

str

generate_flags() → str

Returns a string containing the various flags configured for this instance.

Returns:Execution command flag parameters
Return type:str
generate_output_dict(destination: pathlib.Path = None) → dict

Returns a dictionary of the run’s output files.

Parameters:destination (Path, optional) – Destination directory, by default None
Returns:Output files by key
Return type:dict
run(scan, destination: pathlib.Path = None) → dict

Runs fsl_anat with the provided scan as input and destination as the destination directory.

Parameters:
  • scan (NIfTI) – Input scan
  • destination (Path, optional) – Destination directory, by default None
Returns:

Output files by key

Return type:

dict

Raises:

RuntimeError – Run failure

django_mri.analysis.interfaces.fsl.topup module

Definition of the TopupWrapper class.

class django_mri.analysis.interfaces.fsl.topup.TopupWrapper(*args, **kwargs)

Bases: nipype.interfaces.fsl.epi.TOPUP

A simple subclass of nipype’s TOPUP interface, tweaking the interface’s __init__() method to make input specification easier.

PHASE_ENCODING_DICT = {'i': 'x', 'j': 'y', 'k': 'z'}
fix_phase_encoding(phase_encoding: str) → str

Converts phase encoding values from i, j, k to x, y, z.

Parameters:phase_encoding (str) – Phase encoding
Returns:Coverted phase encoding
Return type:str