% Generated by Sphinx.
\def\sphinxdocclass{report}
\documentclass[letterpaper,10pt,english]{sphinxmanual}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00A0}{\nobreakspace}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{times}
\usepackage[Bjarne]{fncychap}
\usepackage{longtable}
\usepackage{sphinx}


\title{3d Brain Atlas Reconstructor Documentation}
\date{October 05, 2011}
\release{0.1}
\author{Piotr Majka, Jakub M. Kowalski}
\newcommand{\sphinxlogo}{}
\renewcommand{\releasename}{Release}
\makeindex

\makeatletter
\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
    \let\PYG@ul=\relax \let\PYG@tc=\relax%
    \let\PYG@bc=\relax \let\PYG@ff=\relax}
\def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
\def\PYG@toks#1+{\ifx\relax#1\empty\else%
    \PYG@tok{#1}\expandafter\PYG@toks\fi}
\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
    \PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}

\def\PYG@tok@gd{\def\PYG@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\def\PYG@tok@gu{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\def\PYG@tok@gt{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.25,0.82}{##1}}}
\def\PYG@tok@gs{\let\PYG@bf=\textbf}
\def\PYG@tok@gr{\def\PYG@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
\def\PYG@tok@cm{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}}
\def\PYG@tok@vg{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@m{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@mh{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@cs{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}\def\PYG@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PYG@tok@ge{\let\PYG@it=\textit}
\def\PYG@tok@vc{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@il{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@go{\def\PYG@tc##1{\textcolor[rgb]{0.19,0.19,0.19}{##1}}}
\def\PYG@tok@cp{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@gi{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
\def\PYG@tok@gh{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\def\PYG@tok@ni{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.84,0.33,0.22}{##1}}}
\def\PYG@tok@nl{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.13,0.44}{##1}}}
\def\PYG@tok@nn{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.05,0.52,0.71}{##1}}}
\def\PYG@tok@no{\def\PYG@tc##1{\textcolor[rgb]{0.38,0.68,0.84}{##1}}}
\def\PYG@tok@na{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@nb{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@nc{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.05,0.52,0.71}{##1}}}
\def\PYG@tok@nd{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.33,0.33,0.33}{##1}}}
\def\PYG@tok@ne{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@nf{\def\PYG@tc##1{\textcolor[rgb]{0.02,0.16,0.49}{##1}}}
\def\PYG@tok@si{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.44,0.63,0.82}{##1}}}
\def\PYG@tok@s2{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@vi{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@nt{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.02,0.16,0.45}{##1}}}
\def\PYG@tok@nv{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@s1{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@gp{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.78,0.36,0.04}{##1}}}
\def\PYG@tok@sh{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@ow{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@sx{\def\PYG@tc##1{\textcolor[rgb]{0.78,0.36,0.04}{##1}}}
\def\PYG@tok@bp{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@c1{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}}
\def\PYG@tok@kc{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@c{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}}
\def\PYG@tok@mf{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@err{\def\PYG@bc##1{\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{##1}}}
\def\PYG@tok@kd{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@ss{\def\PYG@tc##1{\textcolor[rgb]{0.32,0.47,0.09}{##1}}}
\def\PYG@tok@sr{\def\PYG@tc##1{\textcolor[rgb]{0.14,0.33,0.53}{##1}}}
\def\PYG@tok@mo{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@mi{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@kn{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@o{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\def\PYG@tok@kr{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@s{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@kp{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@w{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\def\PYG@tok@kt{\def\PYG@tc##1{\textcolor[rgb]{0.56,0.13,0.00}{##1}}}
\def\PYG@tok@sc{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@sb{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@k{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@se{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@sd{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}

\def\PYGZbs{\char`\\}
\def\PYGZus{\char`\_}
\def\PYGZob{\char`\{}
\def\PYGZcb{\char`\}}
\def\PYGZca{\char`\^}
% for compatibility with earlier versions
\def\PYGZat{@}
\def\PYGZlb{[}
\def\PYGZrb{]}
\makeatother

\begin{document}

\maketitle
\tableofcontents
\phantomsection\label{index::doc}


\begin{notice}{warning}{Warning:}
This is only a draft of documentation!
\end{notice}

Contents:


\chapter{3d Brain Atlas Reconstructor readme file}
\label{README:welcome-to-3d-brain-atlas-reconstructor-s-documentation}\label{README::doc}\label{README:d-brain-atlas-reconstructor-readme-file}
In this file you can find a brief description of the 3D Brain Atlas
Reconstructor software instalation and usage. Please visit
the \href{http://www.3dbar.org}{http://www.3dbar.org} website for more detailed description.

If you haven't done this already, please let us know that you are using
3D Brain Atlas Reconstructor by filling out short form available on
\href{http://service.3dbar.org/downloadForm}{http://service.3dbar.org/downloadForm} . Thanks a lot.


\section{Installing required packages (Ubuntu)}
\label{README:installing-required-packages-ubuntu}\begin{itemize}
\item {} 
Installation in Ubuntu 9.10
\begin{enumerate}
\item {} 
Install the Visualization Toolkit and other graphics libraries:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install libvtk5.2 libvtk5-dev libvtk5.2-qt4 \
libvtk5-qt4-dev tk8.5 tk8.5-dev python-vtk libgtkgl2.0-1 \
libgtkgl2.0-dev libgtkglext1 librsvg2-2 python-nifti
\end{Verbatim}

\item {} 
Install python related packages:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install python-gtkglext1 python-rsvg python-opengl \
python-numpy python-scipy python-wxgtk2.6
\end{Verbatim}

\item {} 
Other packages:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install potrace pstoedit python-setuptools python-epydoc
\end{Verbatim}

\item {} 
Install Sphinx:

\begin{Verbatim}[commandchars=@\[\]]
sudo easy@_install -U Sphinx
\end{Verbatim}

\end{enumerate}

\item {} 
Installation in Ubuntu 10.04
\begin{enumerate}
\item {} 
Install the Visualization Toolkit and other graphics libraries:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install libvtk5.2 libvtk5-dev libvtk5.2-qt4 \
libvtk5-qt4-dev tk8.5 tk8.5-dev python-vtk libgtkgl2.0-1 \
libgtkgl2.0-dev libgtkglext1 librsvg2-2 python-nifti
\end{Verbatim}

\item {} 
Install python related packages:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install python-gtkglext1 python-rsvg python-opengl \
python-numpy python-scipy python-wxgtk2.6
\end{Verbatim}

\item {} 
Other packages:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install potrace pstoedit python-setuptools python-epydoc
\end{Verbatim}

\item {} 
Install Sphinx:

\begin{Verbatim}[commandchars=@\[\]]
sudo easy@_install -U Sphinx
\end{Verbatim}

\end{enumerate}

\item {} 
Installation in Ubuntu 10.10 and Ubuntu 11.04
\begin{enumerate}
\item {} 
Install the Visualization Toolkit and other graphics libraries:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install libvtk5.4 libvtk5-dev libvtk5.4-qt4 \
libvtk5-qt4-dev tk8.5 tk8.5-dev python-vtk libgtkgl2.0-1 \
libgtkgl2.0-dev libgtkglext1 librsvg2-2 python-nifti
\end{Verbatim}

\item {} 
Install python related packages:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install python-gtkglext1 python-rsvg python-opengl \
python-numpy python-scipy python-wxgtk2.8
\end{Verbatim}

\item {} 
Other packages:

\begin{Verbatim}[commandchars=@\[\]]
sudo apt-get install potrace pstoedit python-setuptools python-epydoc
\end{Verbatim}

\item {} 
Install Sphinx:

\begin{Verbatim}[commandchars=@\[\]]
sudo easy@_install -U Sphinx
\end{Verbatim}

\end{enumerate}

\end{itemize}


\section{Generating CAF datasets}
\label{README:generating-caf-datasets}
Once the software is installed, you need to generate CAF representations
of data of interest. For this you need to use parsers. We provide here
the following parsers:
\begin{enumerate}
\item {} 
ScalableBrainAtlas DB08 template
(\href{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=DB08}{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=DB08})

\item {} 
ScalableBrainAtlas PHT00 template
(\href{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=PHT00}{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=PHT00})

\item {} 
ScalableBrainAtlas WHS09 template
(\href{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=WHS09}{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=WHS09})

\item {} 
ScalableBrainAtlas WHS10 template
(\href{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=WHS10}{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=WHS10})

\item {} 
ScalableBrainAtlas LPBA40\_on\_SRI24 template
(\href{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=LPBA40\_on\_SRI24}{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=LPBA40\_on\_SRI24})

\item {} 
ScalableBrainAtlas RM\_on\_F99 template
(\href{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=RM\_on\_F99}{http://scalablebrainatlas.incf.org/main/coronal3d.php?template=RM\_on\_F99})

\item {} 
the Waxholm Space Atlas (the source mouse brain volumetric dataset)

\item {} 
the Waxholm Space Atlas (the source mouse brain volumetric dataset), another
delineation
(\href{http://software.incf.org/software/waxholm-space/waxholm-space/LabeledAtlas0.5.1/file\_download?file\_field=file}{http://software.incf.org/software/waxholm-space/waxholm-space/LabeledAtlas0.5.1/file\_download?file\_field=file})

\item {} 
Paxinos and Watson ``The Rat Brain in Stereotaxic Coordinates'' atlas.

\item {} 
Franklin and Paxinos ``The Mouse Brain in Stereotaxic Coordinates'' atlas.

\item {} 
The Allen Mouse Brain Atlas
(\href{http://mouse.brain-map.org/atlas/index.html}{http://mouse.brain-map.org/atlas/index.html})

\end{enumerate}

To generate CAF dataset for data from ScalableBrainAtlas DB08 template execute
the following commands in the root directory of the software:

\begin{Verbatim}[commandchars=@\[\]]
@$ source setbarenv.sh
@$ make sba@_DB08
\end{Verbatim}

The first line sets the path to the API and uses appropriate parser to download
the data from SBA and do the transformation into the CAF dataset.

You can also generate that way CAF dataset for any of following SBA templates:
\code{PHT00}, \code{WHS09}, \code{WHS10}, \code{LPBA40\_on\_SRI24} and \code{RM\_on\_F99} just by replacing
\code{DB08} with the name of the source template.

In order to generate that way CAF dataset for the Waxholm Space Atlas replace
\code{sba\_DB08} with \code{whs\_0.5} or \code{whs\_0.51} (for another WHS delineation).

To generate CAF dataset from Paxinos and Watson atlas (Paxinos, G. and Watson, C. (2007).
The Rat Brain In Stereotaxic Coordinates. Elsevier, 6th edition.) you have to supply
the parser with PDF file delivered with printed copy of the atlas.
Execute the following command in the root directory of the software:

\begin{Verbatim}[commandchars=@\[\]]
@$ bash bin/parsers/paxinos@_watson@_rbisc/make@_svg@_from@_pdf@_rat.sh @textless[]PDF path@textgreater[]
\end{Verbatim}

You have to replace \emph{\textless{}PDF path\textgreater{}} with a valid path to the file mantioned above.
The CAF dataset will be stored in the \code{atlases/paxinos\_watson\_rbisc/caf-src}
directory.

If the result of parsing does not satisfy you, you can edit slides derived
from the PDF atlass manually with your favourite SVG editor.

The slides are located in \code{atlases/paxinos\_watson\_rbisc/caf-src} directory
and named \code{N\_pretrace\_v1.svg} where N is the slide number.
Once you have your slides edited execute in the root directory of the software:

\begin{Verbatim}[commandchars=@\[\]]
@$ make -f make@_pw@_rbisc.mk
\end{Verbatim}

to reparse the edited slides.

Similarly for Paxinos and Frnklin atlas (Paxinos, G. and Franklin, K. B. J. (2008).
The Mouse Brain In Stereotaxic Coordinates. Elsevier, 3rd edition.) you have to execute:

\begin{Verbatim}[commandchars=@\[\]]
@$ bash bin/parsers/paxinos@_franklin@_mbisc/make@_svg@_from@_pdf@_mouse.sh @textless[]PDF path@textgreater[]
\end{Verbatim}

in the root directory of the software. The CAF dataset will be stored in
the \code{atlases/paxinos\_franklin\_mbisc/caf-src} directory.

To reparse the edited slides execute:

\begin{Verbatim}[commandchars=@\[\]]
@$ make -f make@_pf@_mbisc.mk
\end{Verbatim}

in the root directory of the software.

Generation of CAF dataset for The Allen Mouse Brain Atlas requires the Advanced Normalization Tools
(ANTS; \href{http://picsl.upenn.edu/ANTS/}{http://picsl.upenn.edu/ANTS/}) installed. ANTS have to be availiable as shell
commands (for an example by adding ANTS \code{bin} directory to environment value
\code{PATH}).

To generate CAF dataset from The Allen Mouse Brain Atlas execute:

\begin{Verbatim}[commandchars=@\[\]]
@$ source setbarenv.sh
@$ make aba
\end{Verbatim}

in the root directory of the software.


\section{Generating 3-D models}
\label{README:generating-3-d-models}
Once you have a CAF
of any dataset you can test the GUI for structure creation. To do it, in
the main directory run:

\begin{Verbatim}[commandchars=@\[\]]
@$ ./3dbar.sh
\end{Verbatim}

and choose in the menu Atlas/Open and select \emph{index.xml} file of chosen CAF
dataset.

To test, click the topmost label on the tree in the left panel and press
\emph{Perform reconstruction} button in the right panel. The reconstruction process
will start. When it is finished, chose in the menu \emph{Edit/Save Model}. It allows
you to put it later in context by right click on the ontology tree.


\section{Generating documentation}
\label{README:generating-documentation}
In order to generate documentation execute:

\begin{Verbatim}[commandchars=@\[\]]
@$ make doc
\end{Verbatim}

The documentation for API can be viewed by opening \emph{doc/api/html/index.html}
and the documentation for 3dBAR graphic interface can be viewed by opening
\emph{doc/gui/html/index.html}.


\chapter{Basics of CAF datasets}
\label{caf_basics:basics-of-caf-datasets}\label{caf_basics::doc}

\section{Basics of CAF slide}
\label{caf_basics:basics-of-caf-slide}
How to create \emph{CAF slide}?

In order to use CAF API you need to import \code{bar} module:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{bar}
\end{Verbatim}


\subsection{Creating empty CAF slide}
\label{caf_basics:creating-empty-caf-slide}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{=}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCafSlide}\PYG{p}{(}\PYG{n}{slideNumber}\PYG{o}{=}\PYG{l+m+mi}{0}\PYG{p}{)}
\end{Verbatim}


\subsection{Creating delineations of brain regions}
\label{caf_basics:creating-delineations-of-brain-regions}
Note that, by definition, SVG paths representing brain regions are closed paths
in sense of \emph{SVG closepath} command and they should be expressed using SVG
absolute coordinates. By default API believes that provided paths
are valid and does not check their syntax thus following invalid path definition will be accepted:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{=}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{barPath}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{structure\PYGZus{}s1\PYGZus{}AA}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{M 100,100 l 100 200 L 200 200}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{\#ff0000}\PYG{l+s}{"}\PYG{p}{)}
\end{Verbatim}

In order to force path validation of
path definition set \code{clearPathDef} to \code{True}. If invalid path is provided an exception is raised.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{=}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{barPath}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{structure\PYGZus{}s1\PYGZus{}AA}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{M 100,100 L 100 200 L 200 200}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{\#ff0000}\PYG{l+s}{"}\PYG{p}{,} \PYG{n}{clearPathDef}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{)}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{ValueError}: \PYG{n+nIdentifier}{Invalid path definition provided}
\end{Verbatim}

\begin{notice}{important}{Important:}
Providing invalid path definitions will surely lead to errors in
further steps. If you are not sure about path definition - validate it.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{=}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{barPath}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{structure\PYGZus{}s1\PYGZus{}AA}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{M 100,100 L 100 200 L 200 200 Z}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{\#ff0000}\PYG{l+s}{"}\PYG{p}{,} \PYG{n}{clearPathDef}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{path}
\PYG{g+go}{\textless{}path bar:growlevel="0" d="M100.0,100.0 L100.0,200.0 L200.0,200.0 Z " fill="\#ff0000" id="structure\PYGZus{}s1\PYGZus{}AA" stroke="none"/\textgreater{}}
\end{Verbatim}
\end{notice}


\subsubsection{Path id convention}
\label{caf_basics:path-id-convention}

\subsubsection{Additional properties}
\label{caf_basics:additional-properties}

\subsubsection{Cusomizing paths}
\label{caf_basics:cusomizing-paths}

\subsection{Adding labels}
\label{caf_basics:adding-labels}

\subsubsection{Automatic label generation}
\label{caf_basics:automatic-label-generation}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{generateLabels}\PYG{p}{(}\PYG{p}{)}  
\PYG{g+go}{\textless{}bar.base.barTracedSlideRenderer object at 0x...\textgreater{}}
\end{Verbatim}


\subsection{Adding information about spatial coordinate system}
\label{caf_basics:adding-information-about-spatial-coordinate-system}

\subsection{Putting pieces togeater}
\label{caf_basics:putting-pieces-togeater}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{bar}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{datetime}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{random} \PYG{k+kn}{import} \PYG{n}{gauss}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slideRange}    \PYG{o}{=} \PYG{n+nb}{range}\PYG{p}{(}\PYG{l+m+mi}{50}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{coronalCoords} \PYG{o}{=} \PYG{n+nb}{map}\PYG{p}{(}\PYG{k}{lambda} \PYG{n}{x}\PYG{p}{:} \PYG{l+m+mi}{50} \PYG{o}{-} \PYG{n}{x} \PYG{o}{-} \PYG{n}{gauss}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mf}{0.25}\PYG{p}{)}\PYG{p}{,} \PYG{n}{slideRange}\PYG{p}{)}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slides} \PYG{o}{=} \PYG{p}{[}\PYG{p}{]}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{indexer} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barIndexer}\PYG{p}{(}\PYG{p}{)}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{slideRange}\PYG{p}{:}
\PYG{g+gp}{... }   \PYG{n}{pathId}  \PYG{o}{=} \PYG{l+s}{"}\PYG{l+s}{structure\PYGZus{}s}\PYG{l+s+si}{\%02d}\PYG{l+s}{\PYGZus{}AA}\PYG{l+s}{"} \PYG{o}{\%} \PYG{n}{i}
\PYG{g+gp}{... }   \PYG{n}{pathDef} \PYG{o}{=} \PYG{l+s}{"}\PYG{l+s}{M }\PYG{l+s+si}{\%d}\PYG{l+s}{,100 L }\PYG{l+s+si}{\%d}\PYG{l+s}{,500 L 500,500 Z}\PYG{l+s}{"} \PYG{o}{\%} \PYG{p}{(}\PYG{l+m+mi}{100}\PYG{o}{+}\PYG{l+m+mi}{2}\PYG{o}{*}\PYG{n}{i}\PYG{p}{,} \PYG{l+m+mi}{100}\PYG{o}{+}\PYG{l+m+mi}{2}\PYG{o}{*}\PYG{n}{i}\PYG{p}{)}
\PYG{g+gp}{... }   \PYG{n}{path}\PYG{o}{=}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{barPath}\PYG{p}{(}\PYG{n}{pathId}\PYG{p}{,} \PYG{n}{pathDef} \PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{\#ff0000}\PYG{l+s}{"}\PYG{p}{,} \PYG{n}{clearPathDef}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{)}
\PYG{g+gp}{... }   \PYG{n}{structure} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barGenericStructure}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{AA}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{\#ff0000}\PYG{l+s}{"}\PYG{p}{,} \PYG{p}{[}\PYG{n}{path}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{... }   \PYG{n}{slide}\PYG{o}{=}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCafSlide}\PYG{p}{(}\PYG{n}{slideNumber}\PYG{o}{=}\PYG{n}{i}\PYG{p}{)}
\PYG{g+gp}{... }   \PYG{n}{slide}\PYG{o}{.}\PYG{n}{addStructures}\PYG{p}{(}\PYG{n}{structure}\PYG{p}{)}
\PYG{g+gp}{... }   \PYG{n}{slide}\PYG{o}{.}\PYG{n}{updateMetadata}\PYG{p}{(}\PYGZbs{}
\PYG{g+gp}{... }           \PYG{p}{[}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{barTransfMatrixMetadataElement}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mf}{1.0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mf}{1.0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{p}{)}\PYG{p}{,}
\PYG{g+gp}{... }            \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barBregmaMetadataElement}\PYG{p}{(}\PYG{n}{coronalCoords}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]}\PYG{p}{)}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{... }   \PYG{n}{slide}\PYG{o}{.}\PYG{n}{writeXMLtoFile}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s+si}{\%02d}\PYG{l+s}{\PYGZus{}traced\PYGZus{}v0.svg}\PYG{l+s}{"} \PYG{o}{\%} \PYG{n}{i}\PYG{p}{)}
\PYG{g+gp}{... }   \PYG{n}{indexer}\PYG{o}{.}\PYG{n}{indexSingleSlide}\PYG{p}{(}\PYG{n}{slide}\PYG{p}{,} \PYG{n}{i}\PYG{p}{)}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{indexerProperties} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{ReferenceWidth}\PYG{l+s}{'}   \PYG{p}{:} \PYG{n+nb}{str}\PYG{p}{(}\PYG{n}{slide}\PYG{o}{.}\PYG{n}{\PYGZus{}rendererConf}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{imageSize}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{)}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{ReferenceHeight}\PYG{l+s}{'}  \PYG{p}{:} \PYG{n+nb}{str}\PYG{p}{(}\PYG{n}{slide}\PYG{o}{.}\PYG{n}{\PYGZus{}rendererConf}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{imageSize}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{p}{)}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{FilenameTemplate}\PYG{l+s}{'} \PYG{p}{:} \PYG{l+s}{'}\PYG{l+s+si}{\%02d}\PYG{l+s}{\PYGZus{}traced\PYGZus{}v}\PYG{l+s+si}{\%d}\PYG{l+s}{.svg}\PYG{l+s}{'}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{RefCords}\PYG{l+s}{'}  \PYG{p}{:} \PYG{l+s}{"}\PYG{l+s}{0,0,1.0,1.0}\PYG{l+s}{"}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{CAFName}\PYG{l+s}{'}   \PYG{p}{:} \PYG{l+s}{"}\PYG{l+s}{caf\PYGZus{}test}\PYG{l+s}{"}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{CAFComment}\PYG{l+s}{'}\PYG{p}{:} \PYG{l+s}{'}\PYG{l+s}{Exemplary CAF dataset}\PYG{l+s}{'}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{CAFCreator}\PYG{l+s}{'}\PYG{p}{:} \PYG{l+s}{'}\PYG{l+s}{Put your fullname here}\PYG{l+s}{'}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{CAFCreatorEmail}\PYG{l+s}{'}\PYG{p}{:} \PYG{l+s}{'}\PYG{l+s}{your.email@here.org}\PYG{l+s}{'}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{CAFCompilationTime}\PYG{l+s}{'}\PYG{p}{:} \PYG{n}{datetime}\PYG{o}{.}\PYG{n}{datetime}\PYG{o}{.}\PYG{n}{utcnow}\PYG{p}{(}\PYG{p}{)}\PYG{o}{.}\PYG{n}{strftime}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s+si}{\%F}\PYG{l+s}{ }\PYG{l+s}{\%}\PYG{l+s}{T}\PYG{l+s}{"}\PYG{p}{)}\PYG{p}{,}\PYGZbs{}
\PYG{g+gp}{... }    \PYG{l+s}{'}\PYG{l+s}{CAFSlideUnits}\PYG{l+s}{'}\PYG{p}{:}\PYG{l+s}{'}\PYG{l+s}{mm}\PYG{l+s}{'}\PYG{p}{\PYGZcb{}}

\PYG{g+go}{\# Set indexer properties}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{indexer}\PYG{o}{.}\PYG{n}{updateProperties}\PYG{p}{(}\PYG{n}{indexerProperties}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{indexer}\PYG{o}{.}\PYG{n}{createFlatHierarchy}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{indexer}\PYG{o}{.}\PYG{n}{fullNameMapping} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{indexer}\PYG{o}{.}\PYG{n}{colorMapping} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{p}{\PYGZcb{}}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{indexer}\PYG{o}{.}\PYG{n}{writeXMLtoFile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{index.xml}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}

Just remove the temporary file containing test slide.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{os}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{os}\PYG{o}{.}\PYG{n}{system}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{rm -f *.svg  *.xml}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+go}{0}
\end{Verbatim}


\chapter{CAF tests: \texttt{crisp-edges} property}
\label{test_crisp-edges:caf-tests-crisp-edges-property}\label{test_crisp-edges::doc}
Crisp edges property determines the rendering settings of the SVG drawing.
Note: By now (and probably also by the future) the `shape-rendering' property
is run-time property only and is not stored or loaded from SVG files.


\section{Tests}
\label{test_crisp-edges:tests}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{bar}
\end{Verbatim}

Create empty slide and check its `crispEdges' property

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCafSlide}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{crispEdges}
\PYG{g+go}{True}
\end{Verbatim}

Let's set \code{crispEdges} to \code{False}

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{crispEdges} \PYG{o}{=} \PYG{n+nb+bp}{False}
\end{Verbatim}

Now, lets validate `crispEdges' property on the \code{path} object.
Path element has assigned corresponding attribute defined

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testPath} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barPath}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{structure\PYGZus{}test\PYGZus{}test}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{M 100 100 L 100 200 L 200 200 Z}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{\#ff0000}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testPath}\PYG{o}{.}\PYG{n}{crispEdges} \PYG{o}{=} \PYG{n+nb+bp}{True}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{testPath}
\PYG{g+go}{\textless{}path bar:growlevel="0" d="M 100 100 L 100 200 L 200 200 Z" fill="\#ff0000" id="structure\PYGZus{}test\PYGZus{}test" shape-rendering="crisp-edges" stroke="none"/\textgreater{}}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testPath}\PYG{o}{.}\PYG{n}{crispEdges} \PYG{o}{=} \PYG{n+nb+bp}{False}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{testPath}
\PYG{g+go}{\textless{}path bar:growlevel="0" d="M 100 100 L 100 200 L 200 200 Z" fill="\#ff0000" id="structure\PYGZus{}test\PYGZus{}test" shape-rendering="geometric-precision" stroke="none"/\textgreater{}}
\end{Verbatim}

Note that \code{crispEdges} property accepts only boolean values. Providing type
other than boolean will cause exception.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testPath}\PYG{o}{.}\PYG{n}{crispEdges} \PYG{o}{=} \PYG{l+s}{'}\PYG{l+s}{string is invalid}\PYG{l+s}{'}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError}: \PYG{n+nIdentifier}{Boolean value expected}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{crispEdges} \PYG{o}{=} \PYG{l+s}{'}\PYG{l+s}{string is invalid}\PYG{l+s}{'}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError}: \PYG{n+nIdentifier}{Boolean value expected}
\end{Verbatim}

\code{crispEdgest} should also always return boolean value:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n+nb}{type}\PYG{p}{(}\PYG{n}{testPath}\PYG{o}{.}\PYG{n}{crispEdges}\PYG{p}{)} \PYG{o}{==} \PYG{n+nb}{type}\PYG{p}{(}\PYG{n+nb+bp}{True}\PYG{p}{)}
\PYG{g+go}{True}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n+nb}{type}\PYG{p}{(}\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{crispEdges}\PYG{p}{)} \PYG{o}{==} \PYG{n+nb}{type}\PYG{p}{(}\PYG{n+nb+bp}{True}\PYG{p}{)}
\PYG{g+go}{True}
\end{Verbatim}


\chapter{CAF tests: \texttt{type} property (barGenericStructure, barPath)}
\label{test_feature-type:caf-tests-type-property-bargenericstructure-barpath}\label{test_feature-type::doc}
Attribute holding type of the feature delineated by given path. For example
it can be like \emph{gray matter}, \emph{white matter}, \emph{single cell}, \emph{ventricle}, and
other... This property tries to mimic INCF DAI \emph{feature} attribute would be extended
after establishing the INCF DAI common metadata set.


\section{Tests}
\label{test_feature-type:tests}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{bar}
\end{Verbatim}

Let's create simple path:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barPath}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{structure\PYGZus{}test00\PYGZus{}test}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{M 100 100 L 100 200 L 200 200 Z}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{\#00ff00}\PYG{l+s}{"}\PYG{p}{)}
\end{Verbatim}

By default, path has no \emph{type} assigned:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{path}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{None}
\end{Verbatim}

We can assingn any consistent string as feature type:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type}\PYG{o}{=}\PYG{l+s}{"}\PYG{l+s}{white-matter}\PYG{l+s}{"}
\end{Verbatim}

But inconsistent string will not work:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type}\PYG{o}{=}\PYG{l+s}{"}\PYG{l+s}{invalid:  hite-mat ter}\PYG{l+s}{"}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError: Invalid feature type name provided: invalid}: \PYG{n+nIdentifier}{ hite-mat ter}
\end{Verbatim}

Also, any non-string value (except None) will raise an exception:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type}\PYG{o}{=} \PYG{p}{[}\PYG{p}{]}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError}: \PYG{n+nIdentifier}{String or 'None' value expected}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type} \PYG{o}{=} \PYG{n+nb+bp}{None}
\end{Verbatim}

Similarly as for single path, you can define the type attribute for the whole structure
Let's create exemplary structure and assign a type:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{structure} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barGenericStructure}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{test}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+s}{"}\PYG{l+s}{\#00ff00}\PYG{l+s}{"}\PYG{p}{)}
\end{Verbatim}

By default, structure \emph{type} property is also \emph{None}:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{None}
\end{Verbatim}

You can assign any reasonable string or \emph{None} value:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{structure}\PYG{o}{.}\PYG{n}{type} \PYG{o}{=} \PYG{l+s}{"}\PYG{l+s}{test-type}\PYG{l+s}{"}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{structure}\PYG{o}{.}\PYG{n}{type} \PYG{o}{=} \PYG{n+nb+bp}{None}
\end{Verbatim}

But you cannot assign any other type than string or \emph{None}:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{structure}\PYG{o}{.}\PYG{n}{type} \PYG{o}{=} \PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{dsf}\PYG{l+s}{'}\PYG{p}{]}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError}: \PYG{n+nIdentifier}{String or 'None' value expected}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{structure}\PYG{o}{.}\PYG{n}{type} \PYG{o}{=} \PYG{n+nb+bp}{True}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError}: \PYG{n+nIdentifier}{String or 'None' value expected}
\end{Verbatim}

You can assign a path to a structure:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{structure}\PYG{o}{.}\PYG{n}{addPaths}\PYG{p}{(}\PYG{n}{path}\PYG{p}{)}
\end{Verbatim}

After that, their types match. Type from structure is copied to the all paths belonging to this structure.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type}\PYG{p}{,} \PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{(None, None)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type} \PYG{o}{==} \PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{True}
\end{Verbatim}

After altering type of the structure, the type of its path is also altered:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}\PYG{o}{=}\PYG{l+s}{"}\PYG{l+s}{test-type}\PYG{l+s}{"}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type}\PYG{p}{,} \PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{('test-type', 'test-type')}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type} \PYG{o}{==} \PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{True}
\end{Verbatim}

But it doesn't work at the opposite direction:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type} \PYG{o}{=} \PYG{l+s}{"}\PYG{l+s}{other-type}\PYG{l+s}{"}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type}\PYG{p}{,} \PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{('other-type', 'test-type')}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{path}\PYG{o}{.}\PYG{n}{type} \PYG{o}{==} \PYG{n}{structure}\PYG{o}{.}\PYG{n}{type}
\PYG{g+go}{False}
\end{Verbatim}

Thus after adding given path to the structure it is recommended to define type
of the path indirectly - thought the structure. \emph{Type} property is stored with CAF slide and can be loaded from XML.


\chapter{CAF API  tests: \texttt{size} and  \texttt{bitmapSize} property}
\label{test_slide-size:caf-api-tests-size-and-bitmapsize-property}\label{test_slide-size::doc}
Obviously, we need to import bar module

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{bar}
\end{Verbatim}

Let's create an exemplary CAF slide with default settings

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCafSlide}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}

We can read the dimensions of the SVG drawing representing CAF slide

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{size}  
\PYG{g+go}{(1200, 900)}
\end{Verbatim}

Size is provided as tuple of two Intergers

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n+nb}{map}\PYG{p}{(}\PYG{n+nb}{type}\PYG{p}{,} \PYG{n}{slide}\PYG{o}{.}\PYG{n}{size}\PYG{p}{)} \PYG{o}{==} \PYG{n+nb}{map}\PYG{p}{(}\PYG{n+nb}{type}\PYG{p}{,} \PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{True}
\end{Verbatim}

Also the rendering size of the slide (which is not the same property as
dimensions of the CAF slide) can be set

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{bitmapSize} 
\PYG{g+go}{(1200, 900)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n+nb}{map}\PYG{p}{(}\PYG{n+nb}{type}\PYG{p}{,} \PYG{n}{slide}\PYG{o}{.}\PYG{n}{bitmapSize}\PYG{p}{)} \PYG{o}{==} \PYG{n+nb}{map}\PYG{p}{(}\PYG{n+nb}{type}\PYG{p}{,} \PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{True}
\end{Verbatim}

Size, as well as bitmapsize can be altered. Only tuple of two integers is
accepted as new value Altering slide dimensions:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{size} \PYG{o}{=} \PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,} \PYG{l+m+mi}{500}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{size}
\PYG{g+go}{(1000, 500)}
\end{Verbatim}

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{size} \PYG{o}{=} \PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{1000}\PYG{l+s}{"}\PYG{p}{,} \PYG{l+m+mi}{500}\PYG{p}{)}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError}: \PYG{n+nIdentifier}{(int,int) Tuple of two integers required}

\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{bitmapSize} \PYG{o}{=} \PYG{l+s}{'}\PYG{l+s}{invalid slide dimensions}\PYG{l+s}{'}
\PYG{g+gt}{Traceback (most recent call last):}
\PYG{n+nc}{AssertionError}: \PYG{n+nIdentifier}{(int,int) Tuple of two integers required}
\end{Verbatim}

\emph{Size} and \emph{bitmap size} are related with some internal properies that can be
edited by advanded user to better customize the slides.  Changing the slide size
alters the slide template as well as tracing and rendering properties

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{\PYGZus{}rendererConf}
\PYG{g+go}{\PYGZob{}'ReferenceHeight': 500, 'ReferenceWidth': 1000, 'imageSize': (1200, 900)\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{\PYGZus{}tracingConf}
\end{Verbatim}

Changing the slide size alters the slide template as well as tracing and
rendering properties

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{size} \PYG{o}{=} \PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,}\PYG{l+m+mi}{500}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{bitmapSize} \PYG{o}{=} \PYG{p}{(}\PYG{l+m+mi}{2000}\PYG{p}{,} \PYG{l+m+mi}{1000}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{\PYGZus{}rendererConf}
\PYG{g+go}{\PYGZob{}'ReferenceHeight': 500, 'ReferenceWidth': 1000, 'imageSize': (2000, 1000)\PYGZcb{}}
\end{Verbatim}

Slide with customized size can be obviously saved to and loaded from XML file:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{xml.dom} \PYG{k+kn}{import} \PYG{n}{minidom} \PYG{k}{as} \PYG{n}{dom}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{writeXMLtoFile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{testSlide.svg}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCafSlide}\PYG{o}{.}\PYG{n}{fromXML}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{testSlide.svg}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{\PYGZus{}rendererConf}
\PYG{g+go}{\PYGZob{}'ReferenceHeight': 500, 'ReferenceWidth': 1000, 'imageSize': (2000, 1000)\PYGZcb{}}
\end{Verbatim}

All slide size settings are preserved:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{size}
\PYG{g+go}{(1000, 500)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{bitmapSize}
\PYG{g+go}{(2000, 1000)}
\end{Verbatim}

Just remove the temporary file containing test slide.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{os}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{os}\PYG{o}{.}\PYG{n}{remove}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{testSlide.svg}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}


\chapter{CAF API  tests: \texttt{barMarker} class and its subclasses}
\label{test_markers:caf-api-tests-barmarker-class-and-its-subclasses}\label{test_markers::doc}
Locating slide in spatial reference system (SRS)

The last thing to make the CAF slide complete is to locate it in a spatial
coordinate system. CAF supports orthogonal, 3-D coordinate systems which seem to
cover the majority of SRS used in brain atlases (e.g. Stereotactic coordinate
system, the Waxholm Space, Talairach Space). In a CAF dataset infotmation about
used SRS and its units of measurements is stored in the CAF index file. Wherever
it is possible, link to the INCF DAI SRS is provided offering more precise
description of the given SRS.

Each slide contains information about its own location in th SRS. This
information is stored within the CAF slide. This information if expressed using
two sets of numbers:
\begin{itemize}
\item {} 
Intra-plane transofrmation allpowith the software to express location of
exery point of the slide using SRS coordinates

\item {} 
stack coordinate (coordinate perpendicular to the slide plane).

\end{itemize}

E.g. the first set consists of 4 numbers $(a,b,c,d)$ while the second contains
only one number ($z$).  The formula to convert SVG coordinates into SRS
coordinates is following:
\begin{gather}
\begin{split}\left\{\begin{matrix}
x' & =  & ax + b \\
y' & =  & cy + d \\
z' & =  & z \\
\end{matrix}\right.\end{split}\notag
\end{gather}
Where (x,y,z) are SVG coordinates while $(x',y',z')$ are related SRS coordinates.

In the opposite direction:
\begin{gather}
\begin{split}\left\{\begin{matrix}
x & = & (x' - b)/a \\
y & = & (y' - d)/c \\
z & = & z'
\end{matrix}\right.\end{split}\notag
\end{gather}
Each CAF slide can carry different SVG to SRS coordinates transformation.
However, if the purpose of the given dataset is to serve as as source to 3-D
model generation this variability is limited and all slides has to carry the
same parameters.

Embedding SRS information into CAF slide:

Mentioned coefficients can be embedded into CAF slide in two ways:
\begin{enumerate}
\item {} 
By explicitly defining transformation,

\item {} 
By calculating transformation from provided data with the help of \code{markers}

\end{enumerate}

In order to calculate SRS \textless{}=\textgreater{} SVG transformation one have to establish three
markers. Two in-plane markers and single intra-plane marker.

Obviously, we need to import bar module

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{bar}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{m1} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCoordinateMarker}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{p}{,}\PYG{p}{(}\PYG{l+m+mi}{10}\PYG{p}{,}\PYG{l+m+mi}{10}\PYG{p}{)}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{m2} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCoordinateMarker}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{5}\PYG{p}{,}\PYG{l+m+mi}{5}\PYG{p}{)}\PYG{p}{,}\PYG{p}{(}\PYG{l+m+mi}{500}\PYG{p}{,}\PYG{l+m+mi}{500}\PYG{p}{)}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{bm} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCoronalMarker}\PYG{p}{(}\PYG{l+m+mf}{6.0}\PYG{p}{,} \PYG{p}{(}\PYG{l+m+mi}{800}\PYG{p}{,} \PYG{l+m+mi}{800}\PYG{p}{)}\PYG{p}{)}
\end{Verbatim}

Let's display the XML/SVG representation of the markers:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{m1}
\PYG{g+go}{\textless{}text fill="\#000000" font-family="Helvetica,sans-serif" font-size="18px" stroke="none" x="10" y="10"\textgreater{}(0.000000,0.000000)\textless{}/text\textgreater{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{m2}
\PYG{g+go}{\textless{}text fill="\#000000" font-family="Helvetica,sans-serif" font-size="18px" stroke="none" x="500" y="500"\textgreater{}(5.000000,5.000000)\textless{}/text\textgreater{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{print} \PYG{n}{bm}
\PYG{g+go}{\textless{}text fill="\#000000" font-family="Helvetica,sans-serif" font-size="18px" stroke="none" x="800" y="800"\textgreater{}Bregma:6.000000\textless{}/text\textgreater{}}
\end{Verbatim}

Create empty CAF slide and locate it in SRS using created markers. By default,
the slide does not contain any infotmation abou its location is spatial
coordinate system.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCafSlide}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{metadata}
\PYG{g+go}{\PYGZob{}\PYGZcb{}}
\end{Verbatim}

SVG to SRS transformation can be calucated and put into the slide using methods
available in CAF API:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{bar}\PYG{o}{.}\PYG{n}{base}\PYG{o}{.}\PYG{n}{processMarkers}\PYG{p}{(}\PYG{n}{m1}\PYG{p}{,}\PYG{n}{m2}\PYG{p}{,}\PYG{n}{bm}\PYG{p}{)} 
\PYG{g+go}{(\textless{}bar.base.barTransfMatrixMetadataElement object at 0x...\textgreater{}, \textless{}bar.base.barBregmaMetadataElement object at 0x...\textgreater{})}
\end{Verbatim}

Add indormation about SRS to the slide:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{updateMetadata}\PYG{p}{(}\PYG{n}{bar}\PYG{o}{.}\PYG{n}{base}\PYG{o}{.}\PYG{n}{processMarkers}\PYG{p}{(}\PYG{n}{m1}\PYG{p}{,}\PYG{n}{m2}\PYG{p}{,}\PYG{n}{bm}\PYG{p}{)}\PYG{p}{)}
\end{Verbatim}

From this moment one can express location on the slide using both, SVG and SRS
coordinates. To convert between these coordinates use \code{svg2srs((svgx,svgy),
ndims = 2)} method. Where (svgx,svgy) are SVG coordinate system to be converted
into spatial coordinates. While  \code{ndims} is number of dimensions of returned
value (determines if output value will be 2 or 3 dimensional; when \code{ndims ==
3} inter-plane coordinate is also included):

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{svg2srs}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{(-0.1020408163265306, -0.1020408163265306)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{svg2srs}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{30}\PYG{p}{,}\PYG{l+m+mi}{20}\PYG{p}{)}\PYG{p}{,} \PYG{n}{ndims}\PYG{o}{=}\PYG{l+m+mi}{3}\PYG{p}{)}
\PYG{g+go}{(0.20408163265306117, 0.1020408163265306, 6.0)}
\end{Verbatim}

Composition of \code{svg2srs} and \code{srs2svg} should result in initial coordinate.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{srs2svg}\PYG{p}{(}\PYG{n}{slide}\PYG{o}{.}\PYG{n}{svg2srs}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{30}\PYG{p}{,}\PYG{l+m+mi}{20}\PYG{p}{)}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{(29.999999999999996, 20.0)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{svg2srs}\PYG{p}{(}\PYG{n}{slide}\PYG{o}{.}\PYG{n}{srs2svg}\PYG{p}{(}\PYG{p}{(}\PYG{o}{-}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{)}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{(-0.99999999999999989, 2.0)}
\end{Verbatim}

Full functionality is preserved after loading and saving the slide:

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{slide}\PYG{o}{.}\PYG{n}{writeXMLtoFile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{test\PYGZus{}markers.svg}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide} \PYG{o}{=} \PYG{n}{bar}\PYG{o}{.}\PYG{n}{barCafSlide}\PYG{o}{.}\PYG{n}{fromXML}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{test\PYGZus{}markers.svg}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{srs2svg}\PYG{p}{(}\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{svg2srs}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{30}\PYG{p}{,}\PYG{l+m+mi}{20}\PYG{p}{)}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{(30.0, 20.0)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{svg2srs}\PYG{p}{(}\PYG{n}{testSlide}\PYG{o}{.}\PYG{n}{srs2svg}\PYG{p}{(}\PYG{p}{(}\PYG{o}{-}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{)}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{(-0.99999999999999989, 2.0)}
\end{Verbatim}

Just remove all the temporary files.

\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{os}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{os}\PYG{o}{.}\PYG{n}{remove}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{test\PYGZus{}markers.svg}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}


\chapter{Indices and tables}
\label{index:indices-and-tables}\begin{itemize}
\item {} 
\emph{genindex}

\item {} 
\emph{modindex}

\item {} 
\emph{search}

\end{itemize}



\renewcommand{\indexname}{Index}
\printindex
\end{document}
