\begin{figure}[H]
\centering
\begin{tikzpicture} 

\draw node[align=center] at (3.25,1.5){\texttt{X}};

\foreach \x in {1,...,4}{

\begin{scope}[shift={(\x*2.5,0)}]

\draw[thick, ->]( 0.5, 1.25 ) -- ( 1.0, 1.25);

\draw( 1, 1 ) rectangle( 1.5, 1.5 );
\draw node[align=center] at (1.25,1.25){h};

\draw[thick, ->]( 1.5, 1.25 ) -- ( 2.0, 1.25);

\draw( 2, 1 ) rectangle( 2.5, 1.5 );
\draw node[align=center] at (2.25,1.25){$\downarrow^2$};

\draw[thick, -]( 2.5, 1.25 ) -- ( 3.0, 1.25);

\draw[thick, ->]( 2.75, 1.25 ) -- ( 2.75, 0.75);

\draw( 2.5, 0.75 ) rectangle( 3.0, 0.25 );
\draw node[align=center] at (2.75,0.5){$\uparrow_2$};

\draw[thick, ->]( 2.75, 0.25 ) -- ( 2.75, 0.0 );

\draw( 2.5, 0.0 ) rectangle( 3.0, -0.5 );
\draw node[align=center] at (2.75,-0.25){2h};

\draw[thick, ->]( 2.75, -0.5 ) -- ( 2.75, -0.75);

\draw( 2.75, -1.0 ) circle( 0.25 );
\draw node[align=center] at (2.75,-1.0){+};

\draw node[align=center] at (2.6,-0.6){\tiny{$-$}};
\draw node[align=center] at (2.35,-0.85){\tiny{+}};

\draw[thick, -]( 0.75, 1.25 ) -- ( 0.75, -1.0);
\draw[thick, ->]( 0.75, -1.0 ) -- ( 2.5, -1.0);
\draw[thick, ->]( 2.75, -1.25 ) -- ( 2.75, -2.25);

\draw node[align=right] at (2.5,-1.75){\texttt{Y\pgfmathparse{int(\x-1)}\pgfmathresult}};


\ifnum \x<4
\draw node[align=center] at (3.0,1.5){\texttt{X\x}};
\fi

\end{scope}

}

\draw node[align=center] at (13.125,1.5){\texttt{X4}};

\draw[thick, ->]( 13.0, 1.25 ) -- ( 13.75, 1.25);

\draw[thick, ->]( 13.5, 1.25 ) -- ( 13.5, 0.75);

\draw( 13.25, 0.75 ) rectangle( 13.75, 0.25 );
\draw node[align=center] at (13.5,0.5){$\uparrow_2$};

\draw[thick, ->]( 13.5, 0.25 ) -- ( 13.5, 0.0 );

\draw( 13.25, 0.0 ) rectangle( 13.75, -0.5 );
\draw node[align=center] at (13.5,-0.25){2h};

\draw[thick, -]( 13.5, -0.5 ) -- ( 13.5, -2.5);
\draw[thick, ->]( 13.5, -2.5 ) -- ( 13.0, -2.5);

\foreach \x in {2,...,4}{

\begin{scope}[shift={(\x*2.5,0)}]

\draw( 2.75, -2.5 ) circle( 0.25 );
\draw node[align=center] at (2.75,-2.5){+};

\draw node[align=center] at (3.15,-2.35){\tiny{+}};
\draw node[align=center] at (2.90,-2.1){\tiny{+}};

\draw( 1.5, -2.25 ) rectangle( 2.0, -2.75 );
\draw node[align=center] at (1.75,-2.5){$\uparrow_2$};

\draw[thick, ->]( 1.5, -2.5 ) -- ( 1.25, -2.5);

\draw( 0.75, -2.25 ) rectangle( 1.25, -2.75 );
\draw node[align=center] at (1.0,-2.5){2h};

\draw[thick, ->]( 0.75, -2.5 ) -- ( 0.5, -2.5);

\draw[thick, ->]( 2.5, -2.5 ) -- ( 2.0, -2.5);
\draw node[align=right] at (2.3,-2.75){\texttt{Z\pgfmathparse{int(\x-1)}\pgfmathresult}};

\end{scope}

}

\draw( 5.25, -2.5 ) circle( 0.25 );
\draw node[align=center] at (5.25,-2.5){+};

\draw node[align=center] at (5.65,-2.35){\tiny{+}};
\draw node[align=center] at (5.40,-2.1){\tiny{+}};

\draw[thick, ->]( 5.0, -2.5 ) -- ( 3.0, -2.5);
\draw node[align=right] at (4.0,-2.75){\texttt{Z}};

\end{tikzpicture}
\caption{A Four Level Laplacian Pyramid}
\label{fig:viewheirarchy}
\end{figure}
