aslprep.workflows.asl.outputs module
Workflows for writing out derivative files.
- init_asl_fit_reports_wf(*, sdc_correction: bool, freesurfer: bool, output_dir: str, name='asl_fit_reports_wf') Workflow [source]
Set up a battery of datasinks to store reports in the right location.
Copied from fMRIPrep’s init_bold_fit_reports_wf. Modifications include changes to fields and variable names, which aren’t important, and DerivativesDataSink suffixes, which are.
- Parameters:
- Inputs:
source_file – Input BOLD images
std_t1w – T1w image resampled to standard space
std_mask – Mask of skull-stripped template
subject_dir – FreeSurfer SUBJECTS_DIR
subject_id – FreeSurfer subject ID
t1w_conform_report – Conformation report
t1w_preproc – The T1w reference map, which is calculated as the average of bias-corrected and preprocessed T1w images, defining the anatomical space.
t1w_dseg – Segmentation in T1w space
t1w_mask – Brain (binary) mask estimated by brain extraction.
template – Template space and specifications
- init_ds_asl_native_wf(*, bids_root: str, output_dir: str, asl_output: bool, metadata: List[dict], cbf_3d: List[str], cbf_4d: List[str], att: List[str], name='ds_asl_native_wf') Workflow [source]
Write out aslref-space outputs.
- init_ds_aslref_wf(*, bids_root, output_dir, desc: str, name='ds_aslref_wf') Workflow [source]
Write out aslref image.
- init_ds_ciftis_wf(*, bids_root: str, output_dir: str, metadata: List[dict], cbf_3d: List[str], cbf_4d: List[str], att: List[str], omp_nthreads: int, name: str = 'ds_ciftis_wf') Workflow [source]
Apply transforms from reference to fsLR space and write out derivatives.
- init_ds_volumes_wf(*, bids_root: str, output_dir: str, metadata: List[dict], cbf_3d: List[str], cbf_4d: List[str], att: List[str], name: str = 'ds_volumes_wf') Workflow [source]
Apply transforms from reference to anatomical/standard space and write out derivatives.
- prepare_timing_parameters(metadata: dict)[source]
Convert initial timing metadata to post-realignment timing metadata.
In particular, SliceTiming metadata is invalid once STC or any realignment is applied, as a matrix of voxels no longer corresponds to an acquisition slice. Therefore, if SliceTiming is present in the metadata dictionary, and a sparse acquisition paradigm is detected, DelayTime or AcquisitionDuration must be derived to preserve the timing interpretation.
Examples
If SliceTiming metadata is absent, then the only change is to note that STC has not been applied:
>>> prepare_timing_parameters(dict(RepetitionTime=2)) {"RepetitionTime": 2, "SliceTimingCorrected": False} >>> prepare_timing_parameters(dict(RepetitionTime=2, DelayTime=0.5)) {"RepetitionTime": 2, "DelayTime": 0.5, "SliceTimingCorrected": False} >>> prepare_timing_parameters(dict(VolumeTiming=[0.0, 1.0, 2.0, 5.0, 6.0, 7.0], ... AcquisitionDuration=1.0)) {"VolumeTiming": [0.0, 1.0, 2.0, 5.0, 6.0, 7.0], "AcquisitionDuration": 1.0, "SliceTimingCorrected": False}
When SliceTiming is available and used, then
SliceTimingCorrected
isTrue
and theStartTime
indicates a series offset.>>> with mock.patch("fmriprep.config.workflow.ignore", []): ... prepare_timing_parameters(dict(RepetitionTime=2, SliceTiming=[0.0, 0.2, 0.4, 0.6])) {"RepetitionTime": 2, "SliceTimingCorrected": True, "DelayTime": 1.2, "StartTime": 0.3} >>> with mock.patch("fmriprep.config.workflow.ignore", []): ... prepare_timing_parameters( ... dict(VolumeTiming=[0.0, 1.0, 2.0, 5.0, 6.0, 7.0], ... SliceTiming=[0.0, 0.2, 0.4, 0.6, 0.8])) {"VolumeTiming": [0.0, 1.0, 2.0, 5.0, 6.0, 7.0], "SliceTimingCorrected": True, "AcquisitionDuration": 1.0, "StartTime": 0.4}
When SliceTiming is available and not used, then
SliceTimingCorrected
isFalse
and TA is indicated withDelayTime
orAcquisitionDuration
.>>> with mock.patch("fmriprep.config.workflow.ignore", ["slicetiming"]): ... prepare_timing_parameters(dict(RepetitionTime=2, SliceTiming=[0.0, 0.2, 0.4, 0.6])) {"RepetitionTime": 2, "SliceTimingCorrected": False, "DelayTime": 1.2} >>> with mock.patch("fmriprep.config.workflow.ignore", ["slicetiming"]): ... prepare_timing_parameters( ... dict(VolumeTiming=[0.0, 1.0, 2.0, 5.0, 6.0, 7.0], ... SliceTiming=[0.0, 0.2, 0.4, 0.6, 0.8])) {"VolumeTiming": [0.0, 1.0, 2.0, 5.0, 6.0, 7.0], "SliceTimingCorrected": False, "AcquisitionDuration": 1.0}
If SliceTiming metadata is present but empty, then treat it as missing:
>>> with mock.patch("fmriprep.config.workflow.ignore", []): ... prepare_timing_parameters(dict(RepetitionTime=2, SliceTiming=[])) {"RepetitionTime": 2, "SliceTimingCorrected": False} >>> with mock.patch("fmriprep.config.workflow.ignore", []): ... prepare_timing_parameters(dict(RepetitionTime=2, SliceTiming=[0.0])) {"RepetitionTime": 2, "SliceTimingCorrected": False}