aslprep.workflows.asl.util module
Utility workflows.
- init_asl_reference_wf(asl_file=None, aslcontext=None, sbref_files=None, pre_mask=False, name='asl_reference_wf', gen_report=False)[source]
Build a workflow that generates reference ASL images for a series.
The raw reference image is the target of HMC, and a contrast-enhanced reference is the subject of distortion correction, as well as boundary-based registration to T1w and template spaces.
- Workflow Graph
- Parameters:
asl_file (
str
) – ASL series NIfTI filesbref_files (
list
orbool
) – Single band (as opposed to multi band) reference NIfTI file. IfTrue
is passed, the workflow is built to accommodate SBRefs, but the input is left undefined (i.e., it is left open for connection)pre_mask (
bool
) – Indicates whether thepre_mask
input will be set (and thus, step 1 should be skipped).name (
str
) – Name of workflow (default:asl_reference_wf
)gen_report (
bool
) – Whether a mask report node should be appended in the end
- Inputs:
asl_file (str) – ASL series NIfTI file
asl_mask (bool) – A tentative brain mask to initialize the workflow (requires
pre_mask
parameter setTrue
).dummy_scans (int or None) – Number of non-steady-state volumes specified by user at beginning of
asl_file
sbref_file (str) – single band (as opposed to multi band) reference NIfTI file
- Outputs:
asl_file (str) – Validated ASL series NIfTI file
raw_ref_image (str) – Reference image to which ASL series is motion corrected
skip_vols (int) – Number of non-steady-state volumes selected at beginning of
asl_file
algo_dummy_scans (int) – Number of non-steady-state volumes agorithmically detected at beginning of
asl_file
ref_image (str) – Contrast-enhanced reference image
ref_image_brain (str) – Skull-stripped reference image
asl_mask (str) – Skull-stripping mask of reference image
validation_report (str) – HTML reportlet indicating whether
asl_file
had a valid affine
- Subworkflows
init_enhance_and_skullstrip_wf()
- init_enhance_and_skullstrip_asl_wf(pre_mask=False, name='enhance_and_skullstrip_asl_wf')[source]
Enhance and run brain extraction on an ASL image.
This workflow takes in an ASL average/summary (e.g., a reference image averaging non-steady-state timepoints), and sharpens the histogram with the application of the N4 algorithm for removing the INU bias field and calculates a signal mask.
Steps of this workflow are:
Calculate a tentative mask by registering (9-parameters) to fMRIPrep’s EPI -aslref template, which is in MNI space. The tentative mask is obtained by resampling the MNI template’s brainmask into aslref-space.
Binary dilation of the tentative mask with a sphere of 3mm diameter.
Run ANTs’
N4BiasFieldCorrection
on the input ASL average, using the mask generated in 1) instead of the internal Otsu thresholding.Calculate a loose mask using FSL’s
bet
, with one mathematical morphology dilation of one iteration and a sphere of 6mm as structuring element.Mask the INU-corrected image with the latest mask calculated in 3), then use AFNI’s
3dUnifize
to standardize the T2* contrast distribution.Calculate a mask using AFNI’s
3dAutomask
after the contrast enhancement of 4).Calculate a final mask as the intersection of 4) and 6).
Apply final mask on the enhanced reference.
Step 1 can be skipped if the
pre_mask
argument is set toTrue
and a tentative mask is passed in to the workflow throught thepre_mask
Nipype input.- Workflow graph
- Parameters:
pre_mask (bool) – Indicates whether the
pre_mask
input will be set (and thus, step 1 should be skipped).name (str) – Name of workflow (default:
enhance_and_skullstrip_asl_wf
)
- Inputs:
in_file (str) – ASL image (single volume)
pre_mask (bool) – A tentative brain mask to initialize the workflow (requires
pre_mask
parameter setTrue
).
- Outputs:
bias_corrected_file (str) – the
in_file
after N4BiasFieldCorrectionskull_stripped_file (str) – the
bias_corrected_file
after skull-strippingmask_file (str) – mask of the skull-stripped input file
out_report (str) – reportlet for the skull-stripping
- init_validate_asl_wf(asl_file=None, name='validate_asl_wf')[source]
Build a workflow to validate an ASL file.
This was split out of
init_asl_reference_wf()
, as that workflow only takes in a subset of the ASL run (typically the M0 scans).- Workflow Graph
- Parameters:
- Inputs:
asl_file (
str
) – ASL series NIfTI file- Outputs: