\begin{tikzpicture}[square/.style={regular polygon,regular polygon sides=4},scale=1.1]
    \definecolor{color_latent}{RGB}{194,0,255};
    \definecolor{color_xyz}{RGB}{0,118,230};
    \definecolor{color_nn}{RGB}{227,200,11};
    \definecolor{color_sdf}{RGB}{250,80,1};
    \definecolor{color_nn_b}{RGB}{230,230,230};
    \definecolor{color_sdfs_b}{RGB}{250,250,250};


    \pgfmathsetmacro{\squaresize}{0.32};

    \node at (0,0*\squaresize) [square, draw, fill=color_latent, opacity=0.7, line width=0.01mm] (l1) {};
    \node at (0,1*\squaresize) [square, draw, fill=color_latent, opacity=0.7, line width=0.01mm] (l2) {};
    \node at (0,2*\squaresize) [square, draw, fill=color_latent, opacity=0.7, line width=0.01mm] (l3) {};
    \node at (0,3*\squaresize) [square, draw, fill=color_latent, opacity=0.7, line width=0.01mm] (l4) {};
    \node at (0,4*\squaresize) [square, draw, fill=color_latent, opacity=0.7, line width=0.01mm] (l5) {};
    \node at (0,5*\squaresize) [square, draw, fill=color_latent, opacity=0.7, line width=0.01mm] (l6) {};
    \node at (-0.4,0.8) [rotate=90] (l7) {code $\latentcode$};

    \node at (-1*\squaresize,-0.5) [square, draw, fill=color_xyz, opacity=0.7, line width=0.01mm] (x1) {};
    \node at (0*\squaresize,-0.5) [square, draw, fill=color_xyz, opacity=0.7, line width=0.01mm] (x2) {};
    \node at (1*\squaresize,-0.5) [square, draw, fill=color_xyz, opacity=0.7, line width=0.01mm] (x3) {};
    \node at (0.0,-0.9) [] (x4) {$\vx$}; %$(x_1,x_2,x_3)$};


    \coordinate (line0) at (0.6,0.5);
    \coordinate (line1) at (4.55,0.5);
    \coordinate (line2) at (0.6,-0.5);
    \coordinate (line3) at (1.5*\squaresize,-0.5);
    \coordinate (line4) at (0.6,2.5*\squaresize);
    \coordinate (line5) at (0.5*\squaresize,2.5*\squaresize);

    \fill [color_nn_b] (0.8,1.9) -- (4.1,1.9) -- (4.1,-0.7) -- (0.8,-0.7) -- (0.8,1.9);
    \draw [line width=0.05mm] (0.8,1.9) -- (4.1,1.9) -- (4.1,-0.7) -- (0.8,-0.7) -- (0.8,1.9);

    \draw [line width=0.05mm] (line0) -- (line1);
    \draw [line width=0.05mm] (line0) -- (line2);
    \draw [line width=0.05mm] (line3) -- (line2);
    \draw [line width=0.05mm] (line0) -- (line4);
    \draw [line width=0.05mm] (line5) -- (line4);


    \draw [line width=0.05mm] (1,0.5) -- (1.,1.7);
    \draw [line width=0.05mm] (1.,1.7) -- (2.6,1.7);
    \draw [line width=0.05mm] (2.6,1.7) -- (2.6,1.5);

    \foreach \i in {0,...,4}{
        \coordinate (n1_\i) at (1.2+\i*0.6,-0.5);
        \coordinate (n2_\i) at (1.2+\i*0.6,1.5);
        \coordinate (n3_\i) at (1.5+\i*0.6,-0.5);
        \coordinate (n4_\i) at (1.5+\i*0.6,1.5);
        \fill [white] (n1_\i) -- (n2_\i) -- (n4_\i) -- (n3_\i) -- (n1_\i);
        \fill [color_nn, opacity=0.7] (n1_\i) -- (n2_\i) -- (n4_\i) -- (n3_\i) -- (n1_\i);
        \draw [line width=0.05mm] (n1_\i) -- (n2_\i) -- (n4_\i) -- (n3_\i) -- (n1_\i);
        }

    \node at (2.5,-0.9) [] (n5) {network};
    \node [anchor=north] (n5_label) at (n5.south) {$\nnweights$};


    \node at (4.7,0.5-1.5*\squaresize) [square, draw, fill=color_sdf, opacity=0.7, line width=0.01mm] (s1) {};
    \node at (4.7,0.5-0.5*\squaresize) [square, draw, fill=color_sdf, opacity=0.7, line width=0.01mm] (s2) {};
    \node at (4.7,0.5+0.5*\squaresize) [square, draw, fill=color_sdf, opacity=0.7, line width=0.01mm] (s3) {};
    \node at (4.7,0.5+1.5*\squaresize) [square, draw, fill=color_sdf, opacity=0.7, line width=0.01mm] (s4) {};
    \node at (4.7,-0.6) [] (s5) {SDFs};
    \node [anchor=north] (s5_label) at (s5.south) {\sdfvec};


    \pgfmathsetmacro{\shift}{6.4};


    \fill [color_sdfs_b] (\shift-1.0,2.04) -- (\shift+2.7,2.04) -- (\shift+2.7,-1.04) -- (\shift-1.0,-1.04) -- (\shift-1.0,2.04);
    \draw [line width=0.05mm] (\shift-1.0,2.04) -- (\shift+2.7,2.04) -- (\shift+2.7,-1.04) -- (\shift-1.0,-1.04) -- (\shift-1.0,2.04);

    \node[inner sep=0pt] (im1) at (\shift+0,1.24) {\fbox{\includegraphics[width=1.6cm]{source/architecture/out1.png}}}; 
    \node[anchor=north, yshift=7mm](im1_label) at (im1.north)
    {\Large LV endo};
    \node[inner sep=0pt] (im2) at (\shift+1.73,1.24) {\fbox{\includegraphics[width=1.6cm]{source/architecture/out2.png}}}; 
    \node[anchor=north, yshift=7mm](im2_label) at (im2.north)
    {\Large LV epi};
    \node[inner sep=0pt] (im3) at (\shift+0,-0.24) {\fbox{\includegraphics[width=1.6cm]{source/architecture/out3.png}}}; 
    \node[anchor=north, yshift=-1mm](im3_label) at (im3.south)
    {\Large RV endo};
    \node[inner sep=0pt] (im4) at (\shift+1.73,-0.24) {\fbox{\includegraphics[width=1.6cm]{source/architecture/out4.png}}}; 
    \node[anchor=north, yshift=-1mm](im4_label) at (im4.south)
    {\Large RV epi};


    \draw [line width=0.05mm] (4.7+0.5*\squaresize,0.5+2*\squaresize) -- (\shift-1.0,2.0);
    \draw [line width=0.05mm] (4.7+0.5*\squaresize,0.5-2*\squaresize) -- (\shift-1.0,-1.0);




    \draw [line width=0.2mm] (9.5,2.7) -- (9.5,-1.7);


    \draw [line width=0.05mm] (9.8,2.0) -- (15.4,2.0) -- (15.4,-1.0) -- (9.8,-1.0) -- (9.8,2.0);
    \draw [line width=0.05mm] (15.4,2.0) -- (21.6,2.0) -- (21.6,-1.0) -- (15.4,-1.0) -- (15.4,2.0);

    \node[inner sep=0pt] (im4) at (11.2,0.5) {\includegraphics[width=0.2\textwidth]{source/architecture/train_endo_gt_colored.png}}; 
    \node[inner sep=0pt] (im4) at (14,0.5) {\includegraphics[width=0.2\textwidth]{source/architecture/train_endo_rec.png}};
    \node[inner sep=0pt] (endo) at (12.5,2.4) {\Large Endocardium};
    \node[inner sep=0pt] (im4) at (17,0.5) {\includegraphics[width=0.2\textwidth]{source/architecture/train_epi_gt_colored.png}};
    \node[inner sep=0pt] (im4) at (20,0.5) {\includegraphics[width=0.2\textwidth]{source/architecture/train_epi_rec.png}};
    \node[inner sep=0pt] (epi) at (18.5,2.4) {\Large Epicardium};
    \node[inner sep=0pt] (im4) at (15.4,-1.55) {\includegraphics[width=0.55\textwidth]{source/architecture/colorbarmm_hor.png}};

    
\end{tikzpicture}
