Skip to content


Repository files navigation

Rapid head‐pose detection for automated slice prescription of fetal‐brain MRI

Fetal-brain geometry reconstruction


This project includes an automated fetal-head pose detection from a full-uterus scout scan acquired as a stack of echo planar imaging (EPI) slices. Specifically, the algorithm derives the left-right, posterior-anterior and inferior-superior axes of the arbitrarily oriented fetal brain, which enables automatic prescription of a subsequent scan in standard anatomical planes. The brain and eyes are identified by detecting maximally stable extremal regions (MSER) on each slice of the scout and combining them in 3D space. The location and shape of these landmarks provide sufficient information to fully determine the head pose.


In fetal-brain magnetic resonance imaging (MRI), head-pose changes between prescription and acquisition present a challenge to obtaining the standard sagittal, coronal and axial views needed for clinical assessment. Unfortunately, subject motion limits acquisitions to thick slices that preclude retroactive resampling to provide standard planes. Throughout the session, technologists therefore repeat incrementally rotated stacks of slices, deducing the head pose from the previous stack until they obtain appropriately oriented images. The algorithm seeks to address this inefficient workflow.


MATLAB version 9.1/R2016b or later is required. If needed, the pre-compiled MEX function for MSER detection can be rebuilt by running mex -output mser mser/mser.cpp mexmser.cpp in MATLAB.

Where to start

For a demo showcasing the different stages of the algorithm, run demo. The printstats script compares the landmarks derived by the algorithm to manually localized eye and brain centers.

Included data

The included test data comprise 41 EPI stacks from fetuses at 26-37 weeks' gestation. Except for ep2d_34.nii.gz and ep2d_41.nii.gz, the pipeline should accurately detect the head pose.

IO scripts

The IO scripts in the freesurfer directory are subject to the FreeSurfer Software License Agreement. For more information about FreeSurfer see

Further reading

A detailed description of the pipeline is freely available online. If you find the code or data useful, please consider citing:

Rapid head-pose detection for automated slice prescription of fetal-brain MRI. Hoffmann M, Abaci Turk E, Gagoski B, Morgan L, Wighton P, Tisdall MD, Reuter M, Adalsteinsson E, Grant PE, Wald LL, van der Kouwe AJW. International Journal of Imaging Systems and Technology (IMA), 31 (3), pp 1136-1154, 2021.

    title={Rapid head-pose detection for automated slice prescription of fetal-brain MRI},
    author={Hoffmann, Malte and Abaci Turk, Esra and Gagoski, Borjan and Morgan, Leah and Wighton, Paul and Tisdall, M Dylan and Reuter, Martin and Adalsteinsson, Elfar and Grant, P Ellen and Wald, Lawrence L and van der Kouwe, André JW},
    journal={International Journal of Imaging Systems and Technology},
    publisher={Wiley Online Library}