<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[12pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{color}

\definecolor{Code}{rgb}{0,0,0}
\definecolor{Decorators}{rgb}{0.5,0.5,0.5}
\definecolor{Numbers}{rgb}{0.5,0,0}
\definecolor{MatchingBrackets}{rgb}{0.25,0.5,0.5}
\definecolor{Keywords}{rgb}{0,0,1}
\definecolor{self}{rgb}{0,0,0}
\definecolor{Strings}{rgb}{0,0.63,0}
\definecolor{Comments}{rgb}{0,0.63,1}
\definecolor{Backquotes}{rgb}{0,0,0}
\definecolor{Classname}{rgb}{0,0,0}
\definecolor{FunctionName}{rgb}{0,0,0}
\definecolor{Operators}{rgb}{0,0,0}
\definecolor{Background}{rgb}{0.98,0.98,0.98}

\lstset{
  language=Python,
  showstringspaces=false,
  formfeed=\newpage,
  tabsize=4,
  %commentstyle=\itshape,
  basicstyle=\ttfamily,
  %morekeywords={models, lambda, forms},
  % Comments
  commentstyle=\color{Comments}\slshape,
  % Strings
  stringstyle=\color{Strings},
  morecomment=[s][\color{Strings}]{"""}{"""},
  morecomment=[s][\color{Strings}]{'''}{'''},
  % keywords
  morekeywords={import,from,class,def,for,while,if,is,in,elif,else,not,and,or,print,break,continue,return,True,False,None,access,as,,del,except,exec,finally,global,import,lambda,pass,print,raise,try,assert},
  keywordstyle={\color{Keywords}\bfseries},
  % additional keywords
  morekeywords={[2]@invariant},
  keywordstyle={[2]\color{Decorators}\slshape},
  emph={self},
  emphstyle={\color{self}\slshape},
  breaklines=true
}

\newcommand{\code}[2]{
  \hrulefill
  \subsection*{#1}
  \lstinputlisting{#2}
  \vspace{2em}
}

\title{Finite Element Model Generation from Confocal Microscopy Data}
\author{Scott Sibole}
\date{May 7, 2013}

\begin{document}
\maketitle
\section*{Necessary Software Packages and Libraries}
\subsection*{\textit{Visual Toolkit (VTK) version 5.0.4}}
This is an older version of VTK.  It must be built from source by checking out the appropriate version from github.  A 64 bit linux version has been built already and can be obtained by contacting:
\begin{center}
Scott Sibole

KNB-2220

ssibole@kin.ucalgary.ca
\end{center}

\subsection*{\textit{Python 2.7}}
\begin{itemize}
\item Linux: This will be included with most Linux distributions.

\item Windows: Download and install \href{http://code.google.com/p/pythonxy/}{\textit{pythonxy}}.
\end{itemize}

\subsection*{\textit{Numpy and Scipy}}
\begin{itemize}
\item Linux: \textit{sudo apt-get install python-scipy} and \textit{sudo apt-get install python-numpy} 

\item Windows: These are included with \textit{pythonxy}
\end{itemize}
\subsection*{\textit{Python bindings for VTK}}
\begin{itemize}
\item Linux: \textit{sudo apt-get install python-vtk}

\item Windows: Search for solution.
\end{itemize}
\subsection*{\textit{GNU Triangulated Surfaces and Python API}}
This is used by some scripts to manipulate surface files converted from STL to GTS format.

\begin{itemize}
\item Linux: \textit{sudo apt-get install libgts-0.7-5} and download and build \href{http://sourceforge.net/projects/pygts/files/}{\textit{pygts}}.

\item Windows: Search for solution.
\end{itemize}

\subsection*{Python Module pyTDMS}
This will allow reading of files in National Instruments .tdms format.

\begin{itemize}
\item Download and build \href{http://sourceforge.net/projects/pytdms/files/}{\textit{pyTDMS}}
\end{itemize}

\subsection*{\textit{Meshlab}}
This is a nice graphical interface for manipulating STL and other polygon surfaces.

\begin{itemize}
\item Linux \textit{sudo apt-get install meshlab}
\item Windows: Binaries are available for download \href{http://sourceforge.net/projects/meshlab/files/meshlab/MeshLab\%20v1.3.2/}{here}.
\end{itemize}

\subsection*{\textit{Netgen}}
This will be used to improve surface mesh quality prior to 3D meshing with Tetgen.

\begin{itemize}
\item Linux: \textit{sudo apt-get install netgen}
\item Windows: Binary is available for download \href{http://www.hpfem.jku.at/netgen/}{here}.
\end{itemize}

\subsection*{\textit{Tetgen}}
This will generate tetrahedral meshes.

\begin{itemize}
\item Linux: \textit{sudo apt-get install tetgen}
\item Windows: Download from \href{http://tetgen.berlios.de/}{here} and build. 
\end{itemize}

\section*{Workflow}

\begin{itemize}
\item Convert LSM to a stack of TIFFs if necessary: \textit{python convert\_lsm.py configuration\_file}.
\item Generate an STL from the stack of TIFFS: \textit{python image\_proc.py configuration\_file}.
\item Import this STL into Meshlab, select cells in region to be modelled using select connected, and move this selection to a new layer.
\item Fix all the normals to be facing outward, \textit{Filters $\rightarrow$ Normals, Curvatures, and Orientation $\rightarrow$ Re-orient all faces coherently}.  If the surfaces appear black invert all the normals, \textit{Filters $\rightarrow$ Normals, Curvatures, and Orientation $\rightarrow$ Invert Faces Orientation}.
\item Export the new layer as a new STL file.
\item Create a new Meshlab project and import the STL file that was just exported.
\item Select each cell individually and move them to their own layers.  
\item Increase the mesh density of each cell using \textit{Filters $\rightarrow$ Remeshing, Simplification, and Reconstruction $\rightarrow$ Refine User-Defined}.  Apply twice using default settings.
\item Smooth each cell using \textit{Filters $\rightarrow$ Smoothing, Fairing, and Deformation $\rightarrow$ ScaleDependent Laplacian Smooth} with 50 smoothing steps.  Preview this before applying and adjust the delta \% such that volume loss is negligible. 
\item Export each cell as its own STL file (do not use binary encoding).
\item Create a configuration file to make an offset mesh of each cell that will represent the PCM.  This file will contain the path to each cell STL on each line.  The offset meshes will be written to the same directory as the cell surfaces with \_offset appended to the name.
\item Create a new Meshlab project and import all the cell and PCM STLs.
\item Merge these into one layer using \textit{Filters $\rightarrow$ Layer and Attribute Management $\rightarrow$ Flatten Visible Layers}.  Export this new layer as a new STL file.

\end{itemize} 

\end{document}</pre></body></html>