\documentclass[fleqn,11pt,openany]{book}

% These two need to be set before including scirun style package
\title{Seg3D Lab Walkthrough}
\author{Jess Tate}

% INCLUDE SCI STYLE DOCUMENT
\usepackage{seg3d}
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}

% This makes displaying bold greek letters easier
\newcommand{\BM }[1]{\mbox{\boldmath $#1$}}

\begin{document}

%% starting from SCIRun Doc wiki


% CREATE TITLE PAGE --------------------------------------------------
\maketitle

% CHAPTERS ---------------------------------------------------------------

\chapter{Overview}

\begin{introduction}

This walkthrough was written for use in CIBC workshop as a guide for the allotted lab time.
This document is meant to provide the information needed for the first time users to begin using Seg3D.
It provides step by step instructions to install, setup, and run Seg3D with basic functionality.
There are some example datasets and tutorials that will provide specific direction and training for using Seg3D to solve specific problems; this walkthrough will provide the information needed setup your system, and to acquaint inexperienced users to Seg3D so that my begin exploring the provided tutorials or experimenting on their own.

\end{introduction}


\section{Seg3D Description}

Often for computer modeling and visualization, it is necessary to have geometry that represents different regions of homogeneous properties.
An example of this is modeling white and gray matter in the brain together.
Segmentations allow this type of demarcation of different regions using labels.
Of course these segmentations must be based on real geometries to be useful, so they are often created from image data.
Image data is taken from some kind of scanner and provides spatially dependent information about properties within a space.
An example would be an MRI scan of the brain showing white and dark matter.
Image data itself is often too varied for direct use into computer models, thus segmentations are used to generalize the regions in the space for easier computation.  

Seg3D is a application that allows users to interactively visualize and segment image data.
Using a slice and volume viewer, spacial visualization of the image data is very easy to manipulate and focus on important details.
Many image processing tools are included in Seg3D that can modify the image volume and automatically and manually generate segmentations from the image data.
Seg3D essentially puts many image processing and segmentation techniques into a very easy to use interface.
The ease of use and power of the software makes Seg3D a critical tool in the generation of image based models.  

%---------------------------------------------

\chapter{System requirements}
\label{sec:sys_req}

\section*{Hardware}

\subsection*{CPU}

Core Duo or higher, recommended i5 or i7.

\subsection*{Memory}

At least 4GB, 8GB or more is recommended.
 
\subsection*{Graphics Card}

OpenGL 2.0 or higher (Not available on older Intel embedded graphics cards), with at least 128 MB of memory, 256MB or more is recommended.

\section*{Operating System}

\subsection*{Windows} 

Windows XP or later is supported, 64bit operating system is strongly recommended.

\subsection*{Mac OS X} 

OS X 10.5 - 10.8 are supported; \textbf{64bit mode must be supported}.
The Seg3D2 installer is not currently signed. The unsigned installer can be run on OS X 10.8 by control-clicking (or right-clicking if 2 button mouse support is enabled) on the installer package and selecting \textbf{Open}.

\subsection*{Linux} 

Only for advanced users; need to build from source (build can take up to an hour), but should work on any Linux flavor.


%---------------------------------------------

\chapter{Getting Started}


\section{Installation}

Seg3D is available from our website at \url{http://www.seg3d.org} for Windows, Mac OS X, and Linux.
Please consider the system requirements (Ch.~\ref{sec:sys_req}) before installing
 
\subsection{Example Data}

Example datasets are available from the Seg3D \href{http://www.seg3d.org}{download site} and from the flash drive provided under \textbf{software/Seg3D/data}, and under \textbf{software/SCIRun\_BioMesh3D/data}.
More examples are available in the SCIRunData archive, which is available from the SCIRun \href{http://www.scirun.org}{download site} and also from the flash drive provided under \textbf{software/SCIRun\_BioMesh3D/data}.
The example data from the SCIRunData archive are used in the Seg3D tutorial.
\textbf{\large These files should be downloaded, unpacked, and placed in a convenient location for the purposes of this lab}.


\subsection{Windows}

Download the Seg3D installer executable and the from the \href{http://www.seg3d.org}{website} mentioned above or from the flash drive provided.
Chose the version (32 or 64 bit) that corresponds to your operating system.
Run the installer and follow the prompts to install the software.
You can open Seg3D from the Start menu.

%%%needs to be checked%%%    

\subsection{Mac OS X}

Download the Seg3D disk image installer (.dmg) from the \href{http://www.seg3d.org}{website} mentioned above or from the flash drive provided.
Unpack the disk image, then run the installer.
Follow the prompts of the installer to completion.
Open Seg3D by double clicking on the application icon located within the Applications folder. 

\subsection{Linux}

Installing Seg3D on Linux systems requires compiling from source code.
The source code is available from the \href{http://www.seg3d.org}{website} mentioned above or from the flash drive provided.
For instructions on building from source code, please ask one of the workshop officiators for assistance.
%see the \href{http://scirundocwiki.sci.utah.edu/SCIRunDocs/index.php/CIBC:Seg3D:Documentation:Building}{cibc wiki} or 

\subsection{Compiling From Source}

Qt 4 is required to build Seg3D from source, version 4.7.4 is recommended.
On Windows and Linux, build from \href{http://download.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.zip}{source} if needed.
An \href{http://get.qt.nokia.com/qt/source/qt-mac-opensource-4.7.4.dmg}{OS X installer} is available.

On Mac OS X, Linux and other Unix-like platforms, use the \emph{build.sh} script to compile Seg3D.

On Windows, follow the instructions on the \href{http://scirundocwiki.sci.utah.edu/SCIRunDocs/index.php/CIBC:Seg3D2:Building_Releases#Seg3D_building_distribution_instructions}{Seg3D wiki}, up until \textbf{step 5} of the \href{http://scirundocwiki.sci.utah.edu/SCIRunDocs/index.php/CIBC:Seg3D2:Building_Releases#Building_Seg3D_for_32-bit_and_64-bit}{Building Seg3D for 32-bit and 64-bit} section.
For that step, build the \textbf{Seg3D} target in Release mode.


\section{Starting a Segmentation}

When you start Seg3D, you will be greeted by the welcome screen (Figure~\ref{fig:welcome}).
As you will see, you have some options:  you may load a recent project from the list (likely to be empty), open a project that you have saved on your machine, start a new project, take a quick look at a single segmentation or image file, or you may quite Seg3D if you have changed your mind.  

\begin{figure}[H]
\begin{centering}
\scalebox{0.35}{\includegraphics{figures/welcome_screen.png}}
\caption{Welcome screen for Seg3D}
\label{fig:welcome}
\end{centering}
\end{figure}

Seg3D handles your data mainly in the form of projects which are similar to those used in other applications.
A project consists of a group of files and with this set up, Seg3D is able to track and save your data that you are working on, the settings that you are using, and the tools and filters that you are using.
This is very useful, especially as your segmentation become larger and more complicated.  

For now, we will begin by starting a new project.
Once you choose that, you will be asked to choose a name and location for the project. 
Test\_1 will do for a name, and so will the default location of \textbf{Seg3D-Projects} created by Seg3D during installation.
Once you have finished creating the project you will see the blank Seg3D workspace (Figure~\ref{fig:blank_workspace}).
You will not be able to do anything useful until you load some data, so click on \texttt{File} and \texttt{Import Layer From Image Series...} or \texttt{Import Layer From Single File...}, depending on the data you have.
Image series refers to a data type that consists of several individual files that can be stacked in order to create a volume, file formats such as dicoms or tiff stacks.
Single file refers to data stored in one data file, such types as .nrrd or ITK files.
The data shown in the demo is a dicom data series, located at \textbf{software/Seg3D/data}, and is a good data set to try first.
Once you click \texttt{Import Layer From Image Series...}, find the \textbf{example\_image\_data} folder and choose one of the many .dcm files there.  You will be asked how to load the data, and you will choose the only option, which is as a \textbf{Data Volume}.  

\begin{figure}[H]
\begin{centering}
\scalebox{0.3}{\includegraphics{figures/blank_workspace.png}}
\caption{Blank workspace of Seg3D}
\label{fig:blank_workspace}
\end{centering}
\end{figure}

Now the angiogram of the pig that you saw in the demo will appear (Figure~\ref{fig:workspace}) and we suggest that you take this time to familiarize yourself with the controls of the software.
Make sure you figure out how to navigate through the slices and adjust the view on the 3D viewer.
Try to figure out some of the simple tools first, such as the threshold tool, or paint brush.
If you decide you would like some more guidance,  look at some of the other datasets provided, or try one of the tutorials.
Once you learn your way around Seg3D, the skill of segmenting will rely on your knowledge of the data you are segmenting and your familiarity with each of the tools available.  

\begin{figure}[H]
\begin{centering}
\scalebox{0.3}{\includegraphics{figures/workspace_with_data.png}}
\caption{Workspace of Seg3D}
\label{fig:workspace}
\end{centering}
\end{figure}




%---------------------------------------------

\chapter{Example Data \& Tutorials}


\section{Example Data} 

There are a few example datasets, of image data and of finished segmentations, that can be used in Seg3D to gain familiarity to the software.
Some of these datasets, such as those found in the SCIRunData archive in the \textbf{software/SCIRun\_BioMesh3D/data} folder, are used and described in the tutorials.
There are others: including the angiogram  and the resulting segmentations used in the demo and mentioned above and are included with the lab materials on the flash drive; and there are several scans available in the SCIRun Data \textbf{volume} folder (the .nhdr files), including scans of an engine, tooth, brain aneurysm, and a CT of a head.
The user is invited to try to segment any these volumes, and/or use any of the tutorials below.

The torso dataset shown in the Seg3D demo is available under\\
\textbf{software/Seg3D/data/example\_image\_data} and the segmentation of the four heart chambers from the dataset is available under \textbf{software/Seg3D/data} in the \textbf{endo\_seg.nrrd} file.

An additional head dataset, \textbf{CT.nrrd}, is also available under \textbf{software/Seg3D/data}, along with a segmentation in \textbf{segmentation.nrrd}.
We recommend attempting to segment the skull in the head dataset, which can be accomplished fairly quickly using thresholding filters. 

\section{Tutorials}

There are two tutorial options described here.
The first is a segmentation of a tooth, which is quite simple and insightful.
It is found in the \href{http://www.sci.utah.edu/devbuilds/scirun_docs/BioMesh3DGuide.pdf}{BioMesh3D guide}.

The other is the official \href{http://www.sci.utah.edu/devbuilds/seg3d_docs/Seg3DTutorial.pdf}{Seg3D tutorial}, which is much more detailed in its decription of the capabilities of Seg3D.
This tutorial uses cardiac scans to describe many tools of Seg3D then uses those tools and guides the reader through the segmentation of a brain.

Both are very useful, however for a quick and simply walkthrough of the segmentation process, we suggest the reader to try the tooth segmentation first.

\subsection{Tooth Segmentation}

As mentioned, the tooth segmentation is quick tutorial in the segmentation strategy for the tooth data.
The tutorial is found in the \href{http://www.sci.utah.edu/devbuilds/scirun_docs/BioMesh3DGuide.pdf}{BioMesh3D guide} which is available on our website and distributed with the SCIRun software.
The volume data that will be used in the tutorial is found in \textbf{SCIRunData/FEMesher/tooth/volume-tooth/tooth-unorient.nhdr} and \textbf{SCIRunData/volume/tooth.nhdr}.
This tutorial with help the user to understand some of the basic tools and filters of Seg3D, and with help to establish a generalized segmentation strategy which can be important in developing high quality segmentations.

\subsection{Seg3D Tutorial}

The \href{http://www.sci.utah.edu/devbuilds/seg3d_docs/Seg3DTutorial.pdf}{Seg3D tutorial} is a great tool to help the users learn Seg3D on a deeper level.
Since the new version of Seg3D (2.1) has only recently been released, this document is in the process of being updated.
The functionality each of the tools has not changed between the versions, even if the interface has changed drastically.
This tutorial can be very useful to the careful reader because the steps describe with be effectively the same, though the images may be different.
Not only does the tutorial describe how to use several tools, but it provides a more basic understanding of Seg3D and how it can be used for full effectiveness.
There are also great walkthroughs on segmentations of the aorta and atria, and of a brain with implanted electrodes, providing great examples that are likely to be directly useful.  

\end{document}
