 subject is registered to the computed template, and the resulting transformation combined with the previously stored transformations between the template and the subjects composing the multi-subject atlas.}
\label{fig:RegComparison}
\end{figure}

The probability maps of the different brain tissues are computed using multiple labelled atlases (i.e., ALBERTs atlases in the case of neonates). The atlas labels are transformed and weighted based on their local similarity with respect to the target after registration to merge multiple segmentations into a final weighted structural segmentation, a tissue segmentation and the white and pial boundaries.

\subsection{Surface extraction}

Following segmentation, white-matter and pial surfaces extraction is performed. First, a triangulated surface mesh is fit onto the computed white-matter segmentation boundary. The shape of the mesh is corrected considering possible holes in the segmentation, using the N4 bias-corrected T2-weighted image \cite{schuh2017}. The deformation of the initial surface is driven by a balance of internal and external forces. While the external force seeks to minimise the distance between the mesh vertices and the tissue boundaries, three different internal forces aim to regularise the deformation. They enforce smoothness and avoid self-intersections by introducing a repulsion force and a minimum distance between adjacent vertices and triangles in the mesh. If a movement brings a triangle under the minimum distance from another triangle, the force of its vertices is limited and the movement prevented. Thus, in the first stage, external forces are derived from distances to the tissue segmentation mask, and in the second stage, boundaries are refined using external forces derived from intensity information.
The pial surface is obtained by deforming the white-matter mesh towards the boundary between cortical gray matter (cGM) and CSF, modifying the external force to search for the closest cGM/CSF image edge outside the white-matter mesh. 
White matter and pial surface extraction allow computing features of the cortical surface, in particular surface curvature, cortical thickness, sulcal depth (i.e. the average convexity or concavity of cortical surface points) and local gyrification index (i.e. a measure of the amount of surface buried in the sulci with respect to the one visible on the surface).
More details on the surface extraction process can be found in \cite{makro2018}.

\section{Results}
\label{sec:Results}

\subsection{Temporal template}

The fetal template proposed in \cite{630093} has been segmented according to the neonatal template presented in \cite{SERAG20122255} and originally used in the dHCP pipeline. The neonatal template presented a 7-tissue segmentation, and is used in the dHCP pipeline to have an initial estimation of the tissue segmentation, in particular the grey matter priors, as part of the registration process to obtain the final structural segmentation.

Figure \ref{fig:FetTemplate} shows the resulting fetal template segmentation, in which the background label has been added by dilation of the brain mask computed using the BET algorithm.

\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/Figure5.jpg}
\caption{Temporal fetal template with the equivalent 7-tissue segmentation.}
\label{fig:FetTemplate}
\end{figure}

\subsection{Multi-subject atlas}

A multi-subject fetal atlas has been built selecting 20 subjects and computing on them the same structural segmentation presented in the ALBERTs atlases. In this case, a three-channel registration has been used, including in the registration process the gray matter and ventricle segmentations, alongside the T2-weighted images. Results of the registration are shown in Figure \ref{fig:FetMultiAtlas}:

\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/Figure6.png}
\caption{Structural segmentation for 10 of the total 20 subjects in the multi-subject atlas.}
\label{fig:FetMultiAtlas}
\end{figure}

In order to perform the multi-subject atlas-based segmentation we had to create first a template for each one of the multi-subject atlases (i.e., fetal and neonatal). The templates resulting from this process are shown in Figure \ref{fig:templates}, with the corresponding probability maps.

\begin{figure}[H]
\centering
  \begin{subfigure}[b]{0.8\textwidth}
    \centering
    \includegraphics[width=\textwidth]{images/Figure7a.png}
    \caption{}
    \label{fig:7a}
  \end{subfigure}%
  \vfill
  \begin{subfigure}[b]{0.8\textwidth}
    \centering
    \includegraphics[width=\textwidth]{images/Figure7b.png}
    \caption{}
    \label{fig:7b}
  \end{subfigure}
\caption{(a) Fetal and (b) neonatal templates obtained from the multi-subject atlases with the cortical gray matter and ventricles probability maps.}
\label{fig:templates}
\end{figure}

\subsection{Segmentation}

Using our pipeline, incorporating the new atlases, we are able to accurately segment both early and late-onset subjects, as shown in Figure \ref{fig:Fet}.

\begin{figure}[H]
\centering
  \begin{subfigure}[b]{0.8\textwidth}
    \centering
    \includegraphics[width=\textwidth]{images/Figure8a.png}
    \caption{}
    \label{fig:8a}
  \end{subfigure}%
  \vfill
  \begin{subfigure}[b]{0.8\textwidth}
    \centering
    \includegraphics[width=\textwidth]{images/Figure8b.png}
    \caption{}
    \label{fig:8b}
  \end{subfigure}
\caption{Fetal Segmentation. (a) Early-onset fetal (27 weeks of gestation) T2-weighted image, tissue segmentation and lobular parcellation; (b) Late-onset fetal (32 weeks of gestation) T2-weighted image, tissue segmentation and lobular parcellation.}
\label{fig:Fet}
\end{figure}

We can analyse how the implemented tools work for tissue and structural segmentations, for acquisitions at different ages, and show how they compare to the only comparable automatic, end-to-end segmentation tool, the dHCP neonatal pipeline.

The initial tissue estimation depends on the temporal template used. The implementation of the modified fetal temporal template in the pipeline leads to visible improvements in the estimation of the cortical gray matter boundaries and of the ventricles, as shown in Figure \ref{fig:FetVsNeo} for a late-onset fetal acquisition segmented both using the dHCP neonatal pipeline and the proposed perinatal pipeline. The estimation of tissue priors is of utmost importance: both gray matter and ventricles priors are used in the multi-subject registration (section \ref{section:Segmentation}), and thus their initial segmentation directly affects the final structural segmentation accuracy.

\begin{figure}[H]
\centering
\includegraphics[width=0.8\linewidth]{images/Figure9.png}
\caption{Comparison of estimated tissue priors. The figure shows the impact of the use of the enhanced version of the fetal temporal template presented in \cite{630093} on the quality of the tissue priors estimation for a late-onset fetus, with respect to the neonatal temporal template.}
\label{fig:FetVsNeo}
\end{figure}

By using the newly developed fetal templates and modifying the registration method, we can see that the modified pipeline adapts better to early and late-onset fetal acquisitions.  Figure \ref{fig:Comparison} shows how the use of a fetal structural multi-subject atlas improves the segmentation of the cortical plate, the CSF and the white matter compared to using the nenonatal pipeline. 

\begin{figure}[H]
\centering
  \begin{subfigure}[b]{\textwidth}
    \centering
    \includegraphics[width=\textwidth]{images/Figure10a.png}
    \caption{}
    \label{fig:10a}
  \end{subfigure}%
  \vfill
  \begin{subfigure}[b]{\textwidth}
    \centering
    \includegraphics[width=\textwidth]{images/Figure10b.png}
    \caption{}
    \label{fig:10b}
  \end{subfigure}
  \vfill
  \begin{subfigure}[b]{\textwidth}
    \centering
    \includegraphics[width=\textwidth]{images/Figure10c.png}
    \caption{}
    \label{fig:10b}
  \end{subfigure}
\caption{Segmentation accuracy qualitative comparison. The figure shows a comparison between the segmentations of 3 fetuses at different gestational ages. (a) Tissue and lobular segmentation at 26.3 weeks of gestation, using a neonatal