I have used a table to insert images using the suggestion at this SO question. The problem is that I have several images to be placed and hence the images start getting hide behind the bottom of the page as shown here (one of my previous question).
PROBLEM: Though I can use \ContinuedFloat as suggested in the comments of that question but then the next part of the image comes in the middle of the next page (if there is only 1-2 rows in the continued part of the table) which looks weird. So, how can I bring the continued part of the table to the top of the next page so that they really look in continuation.
\documentclass{article}
\usepackage[caption=false]{subfig}
\usepackage{graphicx}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
\begin{figure}
\subfloat[First layer]{%
\begin{minipage}{\linewidth}
\centering
\begin{tabularx}{\linewidth}{YYY}
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
& \includegraphics[width=\linewidth,height=1cm]{example-image-b}
& \includegraphics[width=\linewidth,height=1cm]{example-image-c} \\
First image & Second image & Third image \\
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
& \includegraphics[width=\linewidth,height=1cm]{example-image-b} \\
Fourth image & Fifth image &
\end{tabularx}
\end{minipage}}\par\medskip
\subfloat[Second layer]{%
\begin{minipage}{\linewidth}
\centering
\begin{tabularx}{\linewidth}{YYY}
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
& \includegraphics[width=\linewidth,height=1cm]{example-image-b}
& \includegraphics[width=\linewidth,height=1cm]{example-image-c} \\
First image & Second image & Third image \\
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
& \includegraphics[width=\linewidth,height=1cm]{example-image-b} \\
Fourth image & Fifth image &
\end{tabularx}
\end{minipage}}\par\medskip
\subfloat[Third layer]{%
\begin{minipage}{\linewidth}
\centering
\begin{tabularx}{\linewidth}{YYY}
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
& \includegraphics[width=\linewidth,height=1cm]{example-image-b}
& \includegraphics[width=\linewidth,height=1cm]{example-image-c} \\
First image & Second image & Third image \\
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
& \includegraphics[width=\linewidth,height=1cm]{example-image-b} \\
Fourth image & Fifth image &
\end{tabularx}
\end{minipage}}\par\medskip
\subfloat[Forth layer]{%
\begin{minipage}{\linewidth}
\centering
\begin{tabularx}{\linewidth}{YYY}
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
& \includegraphics[width=\linewidth,height=1cm]{example-image-b}
& \includegraphics[width=\linewidth,height=1cm]{example-image-c} \\
First image & Second image & Third image \\
\end{tabularx}
\end{minipage}}
\caption{a figure with some layers of subfigures each with its own name and each layer with a subcaption}
\end{figure}
\end{document}