create_slice_timing

bidsaid.metadata.create_slice_timing(nifti_file_or_img, tr=None, slice_axis=None, slice_acquisition_method='interleaved', ascending=True, interleaved_pattern='odd', multiband_factor=None, verbose=False)[source]

Create slice timing dictionary mapping the slice index to its acquisition time.

Important

For Philips, single-package is assumed.

Parameters

nifti_file_or_imgstr, Path, or Nifti1Image

Path to the NIfTI file or a NIfTI image.

trfloat or int

Repetition time in seconds. If None, the repetition time is extracted from the NIfTI header.

slice_axisLiteral["i", "j", "k"] or None, default=None

Axis the image slices were collected in. If None, determines the slice axis using metadata (“slice_end”) from the NIfTI header.

slice_acquisition_methodLiteral["sequential", "interleaved", "central", "reversed_central"], default=”interleaved”

Method used for acquiring slices.

Note

  • “interleaved” is the common interleaving pattern (e.g [0, 2, 4, 6, 1, 3, 5, 7]), which is also equivalent to Philips’ “default”.

  • “central” is an order for Philips scanners that collect the middle slice first, then the remaining slices are selected in a ping pong order (e.g. [2, 1, 3, 0, 4] or [3, 2, 4, 1, 5, 0]).

  • “reversed_central” is an order for Philips scanners that collect the outer slice (starting at 0) first, then the remaining slices follow a ping pong order to the middle slice (e.g. [0, 4, 1, 3, 2] or [0, 5, 1, 4, 2, 3])

ascendingbool, default=True

If slices were collected in ascending order (True) or descending order (False).

Important

ascending always set to True when slice_acquisition_method is “central” and “reversed_central” to prevent numpy.flip from.

interleaved_patternLiteral["even", "odd", "philips"], default=”odd”

If slices for interleaved acquisition were collected by acquiring the “even” or “odd” slices first. For “philips” (the interleaved implementation by Philips’), slices are acquired by a step factor equivalent to the rounded square root of the total slices mode (e.g. [0, 3, 6, 9, 1, 4, 7, 2, 5, 8]; rounded sqrt of 10 is 3).

Important

Philips’ “default” mode is equivalent to “interleave” with the pattern set to “odd”, and ascending set to True.

multiband_factorint or None, default=None

The multiband acceleration factor, which is the number of slices acquired simultaneously during multislice acquisition. Slice ordering is created using a step factor equivalent to n_slices / multiband_factor. For instance, if n_slices is 12 and slice_acquisition_method is “interleaved” with multiband_factor of 3, then the traditional interleaved order using the “odd” first ascending pattern is [0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11]. This order is then grouped into sets of 3 with a step of 4 (12 slices divided by multiband factor of 3), resulting in slice groups: (0, 4, 8), (2, 6, 10), (1, 5, 9), (3, 7, 11). The final slice timing order is [0, 4, 8, 2, 6, 10, 1, 5, 9, 3, 7, 11].

Important

  • Parameter not used for “central” and “reversed_central” as there is no reference to assure ordering in multiband acquisition.

verbosebool, default=False

Logs “INFO” level information if True.

Returns

list[float]

List containing the slice timing acquisition.

References

Parker, David, et al. “Optimal Slice Timing Correction and Its Interaction with FMRI Parameters and Artifacts.” Medical Image Analysis, vol. 35, Jan. 2017, pp. 434–445, https://doi.org/10.1016/j.media.2016.08.006. Accessed 28 Jan. 2022.

SPM/Slice Timing - Wikibooks, open books for an open world. (2022). Wikibooks.org. https://en.wikibooks.org/wiki/SPM/Slice_Timing