aslprep.utils.asl module

Functions for working with ASL data.

determine_multi_pld(metadata)[source]

Determine if a run is multi-delay or not.

Parameters:

metadata (dict) – Dictionary of metadata from the ASL file.

Returns:

True if the data are multi-delay/TI. False if not.

Return type:

bool

estimate_labeling_efficiency(metadata)[source]

Estimate labeling efficiency based on the available metadata.

Parameters:

metadata (dict) – Dictionary of metadata from the ASL file.

Returns:

labeleff – Labeling efficiency.

Return type:

float

Notes

If LabelingEfficiency is defined in the metadata, then this value will be used. Otherwise, efficiency will be estimated based on the ASL type and number of background suppression pulses (if any). PCASL and PASL values come from Alsop et al.[1]. The CASL value comes from Wang et al.[2]. The adjustment based on number of background suppression pulses is not described in any papers, as far as we know, but is apparently widely used.

References

get_bolus_duration(metadata, is_casl)[source]

Determine the appropriate bolus duration for BASIL.

For PASL data, the bolus cutoff delay is the first BolusCutOffDelayTime. For (P)CASL data, it is the labeling duration.

Parameters:
  • metadata (dict) – Dictionary of metadata associated with ASL file.

  • is_casl (bool) – True if the data are (P)CASL. False if the data are PASL.

Returns:

bolus – The bolus value.

Return type:

float

get_inflow_times(metadata, is_casl)[source]

Determine the appropriate inflow times for BASIL.

For PASL data, the inflow time (TI) is just the post-labeling delay (PLD). For (P)CASL data, TI is PLD plus the labeling duration.

Parameters:
  • metadata (dict) – Dictionary of metadata associated with ASL file.

  • is_casl (bool) – True if the data are (P)CASL. False if the data are PASL.

Returns:

1D array of PostLabelingDelay values.

Return type:

numpy.ndarray

infer_m0tr(*, aslcontext, metadata, m0scan_metadata)[source]

Infer the repetition time of the M0 volumes based on metadata.

Parameters:
  • aslcontext (str) – Path to aslcontext file.

  • metadata (dict) – Metadata for ASL file.

  • m0scan_metadata (dict or None) – Metadata for M0 file, if one exists. Otherwise None.

Returns:

m0tr – The TR of the M0 scan, if available.

Return type:

float or None

pcasl_or_pasl(metadata)[source]

Determine if metadata indicates a PCASL or ASL scan.

prepare_basil_kwargs(metadata)[source]

Prepare keyword arguments for BASIL based on slice timing and multiband metadata.

Parameters:

metadata (dict) – Dictionary of metadata from the ASL file.

Returns:

basil_kwargs – Dictionary of keyword arguments to pass to BASILCBF interface.

Return type:

dict

Notes

This function handles slice timing correction for both single-band and multiband acquisitions. For multiband data, it checks that slice times within each band are monotonic and ascending before setting the sliceband and slice_spacing parameters.

reduce_metadata_lists(metadata, n_volumes, keep_idx)[source]

Reduce any volume-wise metadata fields to only contain values for selected volumes.

select_processing_target(aslcontext)[source]

Determine how to handle ASL and M0 data based on dataset configuration.