% Defines fontsize and documentclass
\documentclass[11pt, table]{article}

% Package for making tables
\PassOptionsToPackage{dvipsnames}{xcolor} % In order to define my own RGB colors
\usepackage[table,xcdraw]{xcolor}
\usepackage{multirow}
\usepackage{booktabs}

% Need this package for coloring the vertical line in titlepage
\usepackage{color}  % to change color of line

% Package needed for german Ä, Ü, Ö
\usepackage[utf8]{inputenc}     

%Packages used for inncluding images
\usepackage{graphicx}
\usepackage{subfig}
\graphicspath{ {Images/} }
 
% Package used for footnotes in Table 1
\usepackage{tablefootnote}

%Package used for changing border widths of page layout
\usepackage[margin=2cm,nohead]{geometry} % http://ctan.org/pkg/geometry

% Package used for defining spacing (Zeilenabstand 1,3fach)
\usepackage{setspace}
\spacing{1.3}

% Use german package so headlines like "Table of contents" or "Literature" are in english
\usepackage [english]{babel}

% Package used for todo notes
\usepackage{todonotes}

% Package used to change all section and subsection headlines to sans serif
\usepackage{sectsty}

% Define Bibliographystyle
\bibliographystyle{unsrt}

%Math formula stuff
\usepackage{amsmath}

% Package used for block comments
\usepackage{verbatim}

%Defining my own units as "Leitfaden zum Verfassen wissenschaftlicher Arbeiten, Fakultät EFI, TH Nürnberg Auflage Octobre 2019": [SI-Prefixes, Constants, Skalars not cursive] - [Units cursive]
% SI Prefixes
\newcommand{\nano}{\textit{n}}
\newcommand{\mikro}{\textit{\mu}}
\newcommand{\centi}{\textit{c}}
\newcommand{\milli}{\textit{m}}

\newcommand{\kilo}{\textit{k}}
\newcommand{\Mega}{\textit{M}}
\newcommand{\Giga}{\textit{G}}

% Units
\newcommand{\volt}{V}
\newcommand{\ampere}{A}
\newcommand{\samples}{S}
\newcommand{\henry}{H}
\newcommand{\metre}{m}
\newcommand{\hertz}{Hz}
\newcommand{\squaremetre}{m$^2$}
\newcommand{\cubicmetre}{m$^3$}



\begin{document}
\allsectionsfont{\sffamily} % changes section headlines to sans serif see(\usepackage{sectsty})
\pagenumbering{roman} % Page numbering of titlepage, abstract and table of contents should be roman

\begin{titlepage}\sffamily
    \vspace{-7cm}
    \hspace{9.5cm}
    \includegraphics[scale=1]{TH-Nuernberg-Logo}
    \vspace{-1.2cm}
   \begin{center}
        \definecolor{OHMblue}{RGB}{6, 71, 153}
        \textcolor{OHMblue}{\rule{18,2cm}{0.16cm}}
       
       \Large
       \vspace{1.5cm}
       Nuremberg Institute of Technology Georg Simon Ohm
       \linebreak
       Faculty efi
       
       \vspace{1cm}
       Degree program: Medicine technology
       \linebreak
       Area of specialization: Electrical engineering/Information technology (EI) 

        \vspace{2cm}
        Bachelor thesis of
        \linebreak
        Julian Seyffer
        
       \vspace{1.2cm}
       \huge
       Investigating the precision of an induction-based localization system for medical applications
       \Large

       \vspace{1.2cm}
       Wintersemester 2020/2021
       
       \vspace{0.1cm}
       Abgabedatum: HIER NOCH EINTRAGEN!
   \end{center}
   \large
   
    \begin{flushleft}
		\vspace{1.5cm} 
		 \begin{tabular}{lll}
		First examiner: & Prof. Dr. rer. nat. Michael Zwanger\\
    	Second examiner: & Prof. Dr. Klaus Schmidt\\
    	Company: & Fraunhofer Institute for Integrated Circuits IIS\\
    	Supervisor: & Dipl. Ing. I. Ibrahim\\    	
    \end{tabular}   
    	
    	
    	\vspace{2cm}
    	Key words: Inductive localization,  
   \end{flushleft}
\end{titlepage}
\thispagestyle{plain}\sffamily


Erklärung Abschlussarbeit gemäß APO/RaPO
Mit der Erklärung Abschlussarbeit gemäß APO/RaPO versichern Sie,
die Arbeit selbstendig verfasst, noch nicht anderweitig für Prüfungszwecke
vorgelegt, keine anderen als die angegebenen Quellen oder Hilfsmittel
benutzt, sowie wörtliche und sinngemäße Zitate als solche gekennzeichnet
zu haben. Die Erklärung Abschlussarbeit gemäß APO/RaPO wird mit
dem aktuellen Datum gekennzeichnet und unterschrieben. Sie ist bei Abschlussarbeiten
prüfungsrechtlich vorgeschrieben und wird von manchen
Lehrenden auch bei Studienarbeiten verlangt.
\\
\\
\begin{center}
    \vspace{0.4cm}
    \textbf{Abstract}
\end{center}
Write abstract at the end.
\newgeometry{right=2cm, top=2cm, left=3cm, bottom=3cm} % after Title page change the page border layout


\newpage
\rmfamily % From here on downwards the main text is in Times new roman like serife writing
\tableofcontents



\newpage
\pagenumbering{arabic} % from here onwards the page numbering is in arabic
\section{Introduction}
In surgery rooms every inch of technology is used to decrease the mortality rate of patients. One that has proven to be very efficient at doing that is computer assisted surgery. A surgeon has a screen next to the patient, on which he can see where his instruments are inside the patient. In order to use this technology the instruments have to be tracked in 3D and real-time. So far infrared camera systems are most often used for this. The Fraunhofer Institute for Integrated Circuits developed an inductive localization system called IndLoc. It is mostly used for industry 4.0 applications in logistics, whereas this thesis is going to test whether or not the system could be used for medical applications. The main deciding factor hereby will be whether or not the system can be accurate enough, as this can decide on life or death during surgery.
\\
With progressing technology in medicine, automatic localization systems become more prevalent. Whether it is localizing a tumor in an X-Ray scan via machine learning, tracking surgical instruments inside a patient with infrared cameras, tracking a contrast agent inside the human body or localizing a pill in the intestines. Localization is required in many medical fields nowadays and inductive localization is still a much overlooked technology in this context. Inductive localization has the benefit of having almost no negative health effects, much unlike X-Ray and being much cheaper than MRI imaging. Additionally low frequency magnetic field waves penetrate biological tissue very well. Object tracking is necessary in order to use computer-assisted surgery systems \cite{Franz.2014}. Biggest problem of inductive localization systems in medicine are: problems with workflow integration, robustness problems of EM tracking, cost issues with embedding sensors into clinical tools  \cite{Franz.2014}.
\\
\todo[inline]{The above shit is probably gonna be deleted}
The Fraunhofer Institute for Integrated Circuits developed an inductive localization system called IndLoc. It is used to localize passive objects in real-time in 3D space. Its current main application is to monitor the picking process in logistics to prevent wrong picks. The motivation of this thesis is to find out whether the IndLoc system could be used in any medical application. Medical applications require very precise localization systems. Usually within the millimetre range (Table \ref{Tab: localization system comparison}). The IndLoc system is accurate in the centimetre range ($\pm$5 \centi\metre) \cite{.2019}.
During this research work some of the IndLoc system components will be modified and optimized in order to improve its localization accuracy.\\
In this chapter, the advantages and disadvantages of three medical localization systems and the IndLoc system will be discussed. Namely, Image-guided neurosurgery, wireless endoscopic capsule localization and infrared image-patient registration. Afterwards the presented systems will be compared.

\subsection{Wireless capsule endoscopy}
The human gastrointestinal (GI) tract can reach a length of up to 9 \metre \ and is difficult for physicians to inspect. In order to look inside the GI tract ingestible pills with internal cameras have been developed (Figure \ref{fig:endoscopic_capsule_with_scale}). This technology is often referred to as wireless capsule endoscopes (WCE), capsule endoscopes (CE) or video capsule endoscopy (VCE). WCE's are an important tool for the diagnosis of small-intestine disorders. Most commonly induction based localization systems are being used to track the capsule inside the patient (Figure \ref{fig:WEC_localization_system}). The physician can thereby connect the recorded images with a position in the GI tract (Figure \ref{fig:WEC_localization_system_GUI}).  However these systems are often not precise (3.77 \centi\metre) \cite{Rey.2006}. Other localization systems have been investigated, but they either use radiation, are sensible to outer magnetic fields or take up extra space in the capsule \cite{Than.2012}.\\
\begin{figure}[h]
  %\centering
  \subfloat[The size and components of an ingestible endoscopy capsule]{\includegraphics[width=0.35\textwidth]{endoscopic_capsule}\label{fig:endoscopic_capsule_with_scale}}
  \hfill
    \subfloat[The portable capsule tracking system, including an localization antenna belt and a video receiving memory unit]{\includegraphics[width=0.2\textwidth]{WEC_localization_system}\label{fig:WEC_localization_system}}
    \hfill
  \subfloat[The tracked position of the capsule inside the human body with a progress bar]{\includegraphics[width=0.35\textwidth]{WEC_localization_system_GUI}\label{fig:WEC_localization_system_GUI}}

  \caption{Wireless capsule endoscopy}
\end{figure}
\newpage
\subsection{Image-patient registration}
Image-guided surgery requires precise registration of preoperative medical images and the patients position in the operating room. A widely used registration method is called surface matching. During surface matching the surgeon points a laser at the patients face and moves it around (Figure \ref{fig:My_Z-Touch}). The infrared camera system detects the skin reflections and produces a virtual representation of the patients face. 
After completing the scan, the surface is then matched onto the facial surface of the preoperative MRI or CT scans using surface-matching algorithms. These systems show a high precision (mean 2.4\milli\metre \ $\pm$ 1.7 \milli\metre) \cite{Raabe.2002}.\\
\begin{figure}[h]
	\includegraphics[scale=0.4]{My_Z-Touch}
	\centering
	\caption{A surgeon performing patient-image registration by infrared scanning a patients facial surface. The scanned surface is then superimposed onto preoperative MRI images, as seen on the monitor.}
	\label{fig:My_Z-Touch}
\end{figure} \\
Other systems use fiducal markers attached to the patients skin or bone structures. The markers radiopaque material can be easily seen during pre- or intraoperative CT or MRI images. During surgery they are detected using an infrared based camera system. These systems show a high precision (mean localization error 0.68 \milli\metre) \cite[p.124]{Yin.2013}.\\
Both methods need a direct line of sight. The surface scanning may take up to 8 \textit{min}, thus increasing mean operating time \cite{Raabe.2002}. \todo[]{find a good disadv of fiducial marker} The IndLoc System may be able to locate fiducial markers faster. It could maybe locate tooth fillings or implanted metal screws as markers that are built into the patient.



\subsection{Localization in neurosurgery}
In neurosurgery minimal damage of the patients brain tissue is desired. Thus several systems are commercially available to help surgeons navigate safely inside the patients brain. The minimal invasive procedures where these systems are used, are often referred to as image-guided neurosurgery or neuronavigation. The development of image-guided neurosurgery represents an improvement in several minimal invasive neurosurgery procedures  \cite{Schulz.2012}. Most neuronavigation systems use two infrared cameras, to track infrared markers fixated on the surgical instruments (Figure \ref{fig:how-image-guided-surgery-works}) \cite{Orringer.2012}. By a registration process the position of the instrument is overlapped with pre- or intraoperative medical (MRI/CT) scans and displayed on a monitor. This way the surgeon has a sense of where his instruments are inside the patients brain in 3D and real-time (Figure \ref{fig:Neuronavigation_reallife}). The advantage of infrared based neuronavigation systems are their high precision (1.8\milli\metre \ - 5.0\milli\metre \ mean) \cite[p.796]{Stieglitz.2013}. The disadvantages of infrared based systems are that they need a direct line of sight \cite{Cleary.2010} and their long setup time before surgery. Since they can only track the visible outer parts of the instruments, bending of flexible needles is not registered.\todo[]{This paper: \cite{Orringer.2012} cites this paper: \cite{Cleary.2010}, but I can not access the second paper)} Alternative systems use ultrasound or inductive localization to track the surgical instruments. Their advantages and disadvantages are shown in Table \ref{Tab: localization system comparison}.\\
\begin{figure}[h]
  \centering
  \subfloat[A surgeon using neuronavigation during spinal surgery to see where his instruments are inside the patient]{\includegraphics[width=0.4\textwidth]{Neuronavigation_reallife}\label{fig:Neuronavigation_reallife}}
  %\hfill
  \hspace{2cm}
  \subfloat[The infrared based dual-camera system used to track surgical instruments]{\includegraphics[width=0.4\textwidth]{how-image-guided-surgery-works}\label{fig:how-image-guided-surgery-works}}
  \caption{Neuronavigation/image-guided surgery}
\end{figure}

\newpage
\subsection{Introduction to the IndLoc system}
IndLoc stands for inductive localization. The system is able to track objects in 3D space in real-time. It was derived from the FIFA certified Goal line technology GoalRef, developed by the Fraunhofer Institute for integrated circuits IIS. The GoalRef system, which was built into the football goal frame, used to detect three coils inside a specially designed football. Nowadays the IndLoc system is used for industry 4.0 applications in logistics. 

\begin{figure}[h]
  \centering
  \subfloat[The IndLoc system consisting of an exciter, sixteen receiving coils integrated into fiberglass tubes forming a picking shelf.]{\includegraphics[width=0.40\textwidth]{IndLoc_Setup_Explanation}\label{fig:IndLoc_Setup_Explanation}}
  \hfill
  \subfloat[The wearable is attached to the wrist and can be localized in real-time in 3D space]{\includegraphics[width=0.45\textwidth]{Wearable}\label{fig:Localization_object_wearable}}
  \caption{IndLoc system}
\end{figure}

The frame of the IndLoc shelf is made out of fibreglass tubes\ref{fig:IndLoc_Setup_Explanation}. Inside of the outer tubes runs a closed wired loop, called the exciter(Figure \ref{fig:IndLoc_Setup_Explanation}). An AC current flows through the exciter generating a magnetic field inside and around the shelf. The wearable localization object contains three coils (Figure \ref{fig:Localization_object_wearable}). Once these coils enter the magnetic field a current is induced in them. This current then generates a second smaller magnetic field, which induces a voltage in the receiving coils placed around the shelf. From these voltages the position of the hand is then calculated. A more technically detailed explanation will be given in chapter \ref{sec:The IndLoc system}. \\ \\
Whether or not the IndLoc system may be applied in medical applications, depends on how precise it can localize. During this paper several changes will be made on the system in attempt to increase its precision.
\newpage


\newpage


\section{Theoretical background}\label{Theoretical background}
\subsection{Induction Law \cite[p.278f]{HARRIEHAUSEN.2020b}}
The voltage of a resting conduction loop in a time variant magnetic field can be described as 

\begin{eqnarray}
    u = -d(\vec{B} \cdot \vec{A})/dt)
\end{eqnarray}

The induced voltage is equal to the change of magnetic flux $\Phi = \vec{B} \cdot \vec{A}$ in this loop       $(u = -d\Phi/dt)$.
\\
\begin{figure}[h]
	
  \centering
  \subfloat[Voltage induction in resting conductor loop in time-variant magnetic field. Conductor loop in plane 1, 2 and 3, that are the orthogonal, in degree ($\pi /2) - \alpha$ and lie parallel to magnetic flux change]{\includegraphics[scale=0.35]{Induction_in_time-variant_magnetic_field_a}\label{fig:Induction_in_time-variant_magnetic_field_a}}
	\hfill
   \subfloat[timeline of magnetic flux and the induced voltage resulting from (a)]{\includegraphics[scale=0.4]{Induction_in_time-variant_magnetic_field_b}\label{fig:Induction_in_time-variant_magnetic_field_b}}
  \hfill
  \subfloat[Induction in time-invariant magnetic field by movement of the conductor L]{\includegraphics[scale=0.4]{Induktion_im_bewegten_Leiter}\label{fig:Induction in time-invariant magnetic field}}  
  \caption{Possible causes for an inductive voltage are either a movement of the conductor or a time-variant magnetic field.}
\end{figure}
%The occurring voltage between the leads 1 and 2 (Fig. \ref{fig:Induction in time-invariant magnetic field}) were explained by the induction effect in the moving conductor L, described with the equation

%\begin{eqnarray}
 %   u_{12} = u_{q12} = \int_{1}^{2} -(\vec{v} \times \vec{B}) \cdot d \vec{l}
%\end{eqnarray}
[...]. \todo[]{leaving out a few sentences where he explains moving conductor and time invariant field}
The relation above explained can be generalised. The in a closed loop (e.g. a conduction loop) induced voltage can be calculated with
\begin{eqnarray} \label{eq:induction_law}
    u = - \frac{d\Phi}{dt}
\end{eqnarray}

the magnetic flux $\Phi$ enclosed by the loop is called induction law. 
\\
The temporal change of the flux $\Phi$ can be caused by a temporal change of the magnetic flux density $\vec{B}$, by a movement of the conductor or conductor-parts in the regarded loop or a combination of both (Fig. \ref{fig:Induction_in_time-variant_magnetic_field_a} \ref{fig:Induction_in_time-variant_magnetic_field_b} \ref{fig:Induction in time-invariant magnetic field}). The in (\ref{eq:induction_law}) described, affective voltage \textit{u} over a circulation is expressed as a circulation voltage
$ \dot{u} = \oint \vec{E} \cdot d \vec{l} $. To express this, with the equation $I = J \: A \: cos(\alpha) $ \todo[]{I dont know why he references this equation here. But he referenced Gl (3.36)},  it can be written as path integral $ \oint \vec{E} \cdot d \vec{l} $.  This gives the law of induction in the form
\begin{eqnarray}
    \dot{u} = \oint \vec{E} \cdot d \vec{l} = - \frac{d \Phi}{dt} .
\end{eqnarray}

\subsection{Induction of two infinite conductor loops \cite[p.261f]{Albach.2014}}
The two conductor loops run parallel to each other into the drawing plane. The magnetic flux in loop 2 ($\Phi_{21}$) resulting from the currents in loop 1 can be calculated as follows. 

\begin{figure}[h]
  \centering
  \subfloat[Magnetic flux in 2 due to the left wire of 1]{\includegraphics[scale=0.45]{Gegeninduktion_zweier_Doppelleitungen_a}\label{fig:Gegeninduktion_zweier_Doppelleitungen_a}}
  \hfill
  \subfloat[Magnetic flux in 2 due to the right wire of 1]{\includegraphics[scale=0.45]{Gegeninduktion_zweier_Doppelleitungen_b}\label{fig:Gegeninduktion_zweier_Doppelleitungen_b}}
  \caption{The magnetic flux in the infinite wire loop 2($\Phi_{21}$) and it's dependency on the distances to wire loop 1.}
\end{figure}

The magnetic flux in loop 2, that results from the current of wire loop 1 that runs into the drawing plane  ($\Phi_{21_{r}}$), can be calculated with the following formula. The formula is then simplified in multiple steps.


\begin{eqnarray}
    \Phi_{21_{r}} = \underset{A_{2}}{\iint}\vec{B}\cdot d\vec{A} = \int_{z=0}^{l} \int_{\rho=a}^{b} \vec{e_{\varphi}} \frac{-i_{1}}{2\pi\rho}\cdot (-\vec{e_{\varphi}})d\rho dz = \frac{\mu_0 l}{2\pi}i_{1} \int_{\rho=a}^{b}\frac{1}{\rho}d\rho = \frac{\mu_0 l}{2\pi}i_{1}ln\frac{b}{a}
\end{eqnarray}

The magnetic flux in loop 2, that results from the current of wire loop 1 that runs out of the drawing plane ($\Phi_{21_{l}}$), can be with the same formula.

\begin{eqnarray}
\Phi_{21_{l}} = -\frac{\mu_0 l}{2\pi}i_{1}ln\frac{d}{c}
\end{eqnarray}

The total magnetic flux in wire loop 2 resulting from the currents in wire loop 1, can be described with the following formula.

\begin{eqnarray}\label{eq:localization_function}
\Phi_{21} = \Phi_{21_{r}} + \Phi_{21_{l}} =  \frac{\mu_0 l}{2\pi}i_{1}(ln\frac{b}{a}-ln\frac{d}{c}) = \frac{\mu_0 l}{2\pi}i_{1}ln\frac{bc}{ad}
\end{eqnarray}

\clearpage
\section{The IndLoc system}\label{sec:The IndLoc system}
\begin{figure}[h]
	\includegraphics[scale=0.5]{IndLoc_System_connection_illustration}
	\centering
	\caption{An overview of the main components of the IndLoc system and how they are connected to each other.}
	\label{fig:IndLoc_System_connection_illustration}
\end{figure}

In this chapter the technical details of the IndLoc system will be explained. Hereby the order of explanation follows the chronological order in which the systems components interact with each other. This order is also displayed by the structure of the whole chapter.
\begin{itemize}
	\item The localization area (section \ref{sec:The_localization_area}) consists of:
	\begin{itemize}
		\item The exciter (subsection \ref{sec:The_exciter}): \\ 
		A wire loop surrounding the localization area. An AC current flows through it, which generates the primary 			magnetic field.
		\item The localization object (subsection \ref{sec:The_localization_object}):\\
		Three orthogonal closed wire loops that are excited by the primary magnetic field. The primary magnetic 				field induces a 	current in the coils. This current then generates the secondary magnetic field.
		\item The receiving coils (subsection \ref{sec:The_receiving_coils}):\\
		Consist of two coils with open ends. They act as magnetic field sensors. The secondary magnetic field 					induces a voltage in the receiving coils depending on the position of the localization object. (Note: Figure 				\ref{fig:IndLoc_System_connection_illustration} only shows one pair of receiving coils for simplicities sake. 		Usually six to eight pairs are placed symmetrically around the exciter.)
	\end{itemize}
		\item The signal processing (section \ref{sec:The_signal_processing}) is done by:
	\begin{itemize}
		\item The reader (subsection \ref{sec:The_reader}):\\
		Generates the AC voltage for the exciter. It simultaneously receives all receiving coil(s) voltages and 					processes them.
		%ASK JOHANNES
		\item The host system (subsection \ref{sec:The_host system}):\\
		A PC running software which does some final signal processing. It determines the final position and shows 		in in a Graphical User Interface. The user can also configure the system via this GUI.
	\end{itemize}
\end{itemize}

\subsection{The localization area}\label{sec:The_localization_area}
\begin{figure}[h]
	\includegraphics[scale=0.7]{IndLoc_coordinate_system_illiustraton}
	\centering
	\caption{IndLoc a schematic sketch of the localization area and its components}
	\label{fig:IndLoc_localization_area}
\end{figure}

The localization area is what the user interacts with. Figure \ref{fig:IndLoc_localization_area} shows a schematic sketch of the shelf shown in Figure \ref{fig:IndLoc_Setup_Explanation}. Here a sequence of inductive excitations occur. The sequence starts at the exciter, producing the magnetic field. This magnetic field then induces a current in the localization object, thus generating a second smaller magnetic field. This secondary magnetic field then induces a voltage in the receiving coils. In summary the inductive excitations sequence occurs in this order: \\
Exciter $\,\to\,$ Localization object $\,\to\,$ Receiving coils.


\subsubsection{The exciter}\label{sec:The_exciter}
The exciter is a rectangular closed circuit (Figure \ref{fig:IndLoc_localization_area}. 
Fibreglass tubes surround the exciter protecting it and forming the shelf (Figure \ref{fig:IndLoc_Setup_Explanation}. The exciter is attached to an AC current source, placed inside the reader (Figure \ref{fig:IndLoc_System_connection_illustration}). Thus it conducts an AC current with an amplitude of 0.5 - 2 \ampere \ and a frequency of 50 - 150 \kilo\hertz. Both amplitude and frequency are configurable and are mostly adjusted to the localization object in use. Note that the AC current is only necessary to produce an alternating magnetic field, which can induce a current without movement of the object. According to Farraday's Law the current produces an alternating magnetic field. This magnetic field is called the primary magnetic field, as it is the primary source of magnetic field strength of the system. All following magnetic fields, voltages and currents in this chapter are a direct or indirect result of the exciters magnetic field. The coordinate system (Figure \ref{fig:IndLoc_localization_area}) is defined such as reaching into the shelf would be a movement on the z-axis. Switching between shelf compartments would be a movement on the x-y-plane. The primary magnetic field also emits outwards around the exciter as far as 50 \centi\metre, thus making it possible to track the localization object in a small area around of the shelf as well. 
 
\subsubsection{The localization object}\label{sec:The_localization_object}
The localization object is what the system tracks in 3D space, in real-time. 
Before usage the logistic worker puts on a wearable, that contains the localization object (Figure \ref{fig:Localization_object_wearable}). The localization object consists of three orthogonal coils (Figure \ref{fig:IndLoc_localization_area}). The names of the three coils originate from their surface normal vector. By using three orthogonal coils it is ensured that, regardless of the rotation of the hand, at least one coils is excited by the primary magnetic field. Each coil has N-windings. By including a resistor and a capacitor into the coils, each coil forms a series resonant circuit. The resonance frequency is set to the frequency of the primary magnetic field, thus improving the signal-to-noise-ratio. The alternating primary magnetic field induces an AC current in the coils. This AC current then generates another magnetic field, called secondary magnetic field.
 
\subsubsection{The receiving coils}\label{sec:The_receiving_coils}
The receiving coils are rectangular coils with N windings and. They act as magnetic field sensors. Each sensor consists of two orthogonal coils, namely the main- and frame- coil (Figure \ref{fig:IndLoc_localization_area}). The antennas contain an instrument amplifier. Eight pairs of receiving coils are placed inside the fibreglass tubes (Figure \ref{fig:IndLoc_Setup_Explanation}) that form the shelf. The primary and secondary magnetic field induce a voltage in the receiving coils. The reader will later subtract the signal created by the primary magnetic field (a more detailed explanation is given in chapter \ref{sec:The_reader}). Since the exciter and the receiving coils are both connected to the reader (Figure \ref{fig:IndLoc_System_connection_illustration}), the reader has the necessary information to filter out the primary magnetic field signal. So effectively the receiving coils only measure the secondary magnetic field, emitted by the localization object. If the localization object is moved closer towards a receiving coil, its measured voltage will rise. Hereby the signal of the main-receiving coils are used for the localization in the x-y-plane. The signal of the frame-receiving coils are used for the localization in the z-axis. All receiving coils have an electrically conductive connection to the reader. 

\subsection{The signal processing}\label{sec:The_signal_processing}

\subsubsection{The reader}\label{sec:The_reader}
The reader consists of an AC current source, a filter module, an FPGA, an amplification module,  a power input, 16 input cables for the receiving antenna signals and a data output. Its two main functions are, processing all of the 16 receiving coil voltages while also operating the AC current connected to the exciter. These two functions are combined in one hardware components, because they are interlinked, but more on that later in this section.\\
The AC current source can be set to a frequency of 50 \kilo\hertz  to 150 \kilo\hertz. The frequency is controlled by an internal clock of the FPGA. The signal coming from the FPGA is then amplified by a specially designed amplification module and then flows into the exciter.\\
In total the reader receives the analogous voltages of 16 receiving coils. This means the following signal processing is done on 16 identical parallel paths. The signals first have to pass an anti-aliasing filter. They then get quantized by a 16Bit analog-to-digital converter at a rate of 
$1\:MS/s$. By far the highest frequency component of this signal has the frequency of the exciter ($50\:kHz - 150\:kHz$ depending on the settings). In most cases there is also high frequency noise originating from surrounding electronic devices or the earth's magnetic field and maybe a DC offset from metallic objects nearby. Now the signal proportion coming directly from the primary magnetic field (thus skipping the localization object) is subtracted from the signal. The positional information of the localization object is amplitude modulated onto the current signal. As a quick reminder, the voltage of a receiving coil will rise once the object gets closer to it. Now the amplitude modulated signal will get demodulated by the FPGA to a frequency of 0Hz. This is the reason the AC current source is also controlled by the FPGA. It requires to know the frequency of the AC current source for the demodulation. Now the 16 parallel channels get down sampled and filtered to a frequency of $250S/s$. The reader then finally sends all 16 voltages via an Ethernet cable to a  host system.

\subsubsection{The host system}\label{sec:The_host system}
The host system receives the 16 receiving voltages from the reader via an Ethernet cable. The UDP communication protocol used to be able communicate between reader and host system. UDP provides fast data transmission, which is necessary for real-time tracking. It is also possible to send messages from the host system back to reader in order to configure exciter frequency, exciter current and other parameters. The user can do via a Graphical User interface, written in Python. In the background this GUI also performs multiple additional signal processing steps on the receiving coil signals.\\
Namely a moving average filter is used to smooth out remaining noise. Then the DC offset is measures and removed. Then a discrete Fourier transformation is performed in order to only focus on the localization objects resonance frequency. \\
Now the position of the object determined, using a fingerprinting table. The table contains all realistic possible values of the 16 receiving coils and connects each variation to a specific X-,Y-,Z-position. \todo[]{Add algorithm reference here} In order to improve 3D-real-time tracking a Kalman-filter is used to estimate future positions, based on the latest positions. A Kalman filter is then used to estimate future positions based on the movement pattern of the localization object. \\
The position is then shown in the GUI and superimposed with a digital representation of the picking shelf.

\newpage
\subsection{Comparison of medical localization systems and the IndLoc system}
\begin{table}[hb]
\centering
%\tiny
\small
\caption{Localization system comparison}\label{Tab: localization system comparison}
\resizebox{\columnwidth}{!}{\begin{tabular}{|c|c|c|l|l|}
\hline
\rowcolor[HTML]{FFFFFF} 
\textbf{Medical field}                                                                                                                & \textbf{Localization system}                                                                                                                                                           & \textbf{Precision \tablefootnote{Precision is given in mean error $\pm$ standard deviation if information was available. Else only mean error is given.}}                                                                                    & \textbf{Advantages}                                                                                                                                                                                                                                 & \multicolumn{1}{c|}{\cellcolor[HTML]{FFFFFF}\textbf{Disadvantages}}                                                                                \\ \hline
\rowcolor[HTML]{EFEFEF} 
\cellcolor[HTML]{FFFFFF}                                                                                                              & \begin{tabular}[c]{@{}c@{}}Infrared camera system\\with markers on \\instruments \cite{Stieglitz.2013}\end{tabular}                                                          & \begin{tabular}[c]{@{}c@{}}$1.8 - 5.0\:mm$ \end{tabular}                                      & \begin{tabular}[c]{@{}l@{}}High precision,\\ furthest developed\end{tabular}                                                                                                                                                                                & \begin{tabular}[c]{@{}l@{}}Line of \\ sight necessary,\\ mean operating\\  time longer,\\ bending of\\  instruments\\  not registered\end{tabular} \\
\rowcolor[HTML]{FFFFFF} 
\multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}\begin{tabular}[c]{@{}c@{}}Image-guided\\ surgery\end{tabular}}                              & \begin{tabular}[c]{@{}c@{}}Inductive \\ localization\\ \cite{Putzer.2016} \cite{McMillen.2010} \cite{Hermann.2012} \cite{Weiner.2015} \cite{Hayhurst.2009}\end{tabular}                               & 3.16 $\pm$ 1.7 \milli\metre                                                                                     & \begin{tabular}[c]{@{}l@{}}No line of \\ sight necessary,\\ tip of flexible \\ instruments\\  trackable,\\ no frame \\ necessary,\\ mean operation \\ time decreased\end{tabular} & \begin{tabular}[c]{@{}l@{}}Affected by\\ other magnetic\\ fields,\\ affected by \\metal objects,\\ maybe lower\\  precision?\end{tabular}           \\ \hline
\rowcolor[HTML]{EFEFEF} 
\cellcolor[HTML]{FFFFFF}{\color[HTML]{333333} }                                                                                       & \begin{tabular}[c]{@{}c@{}}Inductive \\ localization \cite{Rey.2006}\end{tabular}                                                                         & \begin{tabular}[c]{@{}c@{}}$3.77\:cm$\end{tabular}                                           & \begin{tabular}[c]{@{}l@{}}Portable,\\ no negative\\ health effects\end{tabular}                                                                                                                                                                    & \begin{tabular}[c]{@{}l@{}}Low precision, \\ requires extra\\ space in capsule\end{tabular}                                                        \\
\rowcolor[HTML]{FFFFFF} 
\cellcolor[HTML]{FFFFFF}{\color[HTML]{333333} }                                                                                       & \begin{tabular}[c]{@{}c@{}}X-Ray \cite{Kuth.772006}, \\ Gamma ray \cite{Wilding.2000} \end{tabular}                                                                                                                            &                                           -                                                             &                                                                                                                                                                                                                                                    High precision & \begin{tabular}[c]{@{}l@{}}Radiation \\ exposure,\\ not portable\end{tabular}                                                                      \\
\rowcolor[HTML]{EFEFEF} 
\cellcolor[HTML]{FFFFFF}{\color[HTML]{333333} }                                                                                       & MRI \cite{Dumoulin.1993} \cite{Krieger.2005}                                                                                                                                                                                     & \begin{tabular}[c]{@{}c@{}}- \end{tabular} &                                                                                                                                                                                                                                                    High precision & \begin{tabular}[c]{@{}l@{}}Expensive,\\ long scan times,\\ not portable\end{tabular}                                                               \\
\rowcolor[HTML]{FFFFFF} 
\multirow{-4}{*}{\cellcolor[HTML]{FFFFFF}{\color[HTML]{333333} \begin{tabular}[c]{@{}c@{}}Wireless capsule\\ endoscopy\end{tabular}}} & Ultrasound \cite{Fluckiger.2007} \cite{Nagy.12.05.200917.05.2009}                                                                                                                                                                              & -                                                                                                     & \begin{tabular}[c]{@{}l@{}}No negative\\ health effects, \\ cheap\end{tabular}                                                                                                                                                                                & \begin{tabular}[c]{@{}l@{}}Gases in intestinal \\ disturb imaging,\\ bad precision \\ in deeper regions\end{tabular}                                      \\ \hline
\rowcolor[HTML]{EFEFEF} 
\cellcolor[HTML]{FFFFFF}{\color[HTML]{333333} }                                                                                       & \begin{tabular}[c]{@{}c@{}}Infrared camera system\\ with surface scan \cite{Raabe.2002}\end{tabular}                                                                             & \begin{tabular}[c]{@{}c@{}}$2.4\:mm \pm 1.7\:mm$\end{tabular}                & Easy to use                                                                                                                                                                                                                                         & \begin{tabular}[c]{@{}l@{}} Long setup times,\\Long scan\\times ($3 - 8\:min$)\end{tabular}                                  \\
\rowcolor[HTML]{FFFFFF} 
\multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}{\color[HTML]{333333} \begin{tabular}[c]{@{}c@{}}Image-Patient\\ registration\end{tabular}}} & \begin{tabular}[c]{@{}c@{}} Infrared camera system \\with feudical skin markers \\ \cite[p.124]{Yin.2013}\end{tabular} & \begin{tabular}[c]{@{}c@{}}$0.68\:mm$\end{tabular}                                           &                                                                                                                                                                                                                                                    High precision & \begin{tabular}[c]{@{}l@{}}Line of \\ sight necessary,\\ laborious affixation \end{tabular}                                                                                 \\ \hline
\rowcolor[HTML]{EFEFEF} 
\cellcolor[HTML]{FFFFFF}To be determined                                                                                              & IndLoc system                                                                                                                                                                          & To be determined                                                                                                     & \begin{tabular}[c]{@{}l@{}}Maybe faster\\ setup time,\\ no line of \\ sight necessary \\ mb tooth filling \\ marker trackable\end{tabular}                                                                                                                                       & \begin{tabular}[c]{@{}l@{}}Low precision,\\ affected by other\\ magnetic fields\end{tabular}                                                       \\ \hline
\end{tabular}}
\end{table}


\clearpage



Tab. \ref{Tab: localization system comparison} gives a quick overview of the advantages and disadvantages of the different localization systems.
Is is to be mentioned that the precision of the inductive localization system for image-guided surgery is for a 3mm thick preoperative CT image scan.

\clearpage
\section{Materials}

In order to improve the IndLoc systems localization accuracy a modified version of the localization area was built. This chapter will focus on explaining these modifications and their purposes.
  
\subsection{The localization area}

\begin{figure}[h]
	\includegraphics[scale=0.4, angle=90]{loc_area_reallife_image}
	\centering
	\caption{The modified localization area of the IndLoc system, which was built during this project. The cube placed in the middle, is tracked by the IndLoc system. It is mounted on a frame with infrared markers, which are tracked by an infrared camera system.}
	\label{fig:loc_area_reallife_image}
\end{figure}

Figure \ref{fig:loc_area_reallife_image} shows the modified version of the IndLoc systems localization area, which was built during this project. Its purpose was to improve and test the localization accuracy of the IndLoc system. It consists of a wooden plane, which lies in the x,y plane and serves as a structural frame. On the wooden plate is millimetre paper fixated for quickly assessing distances. 
\\
The exciter is mounted on the back of the wooden plate. It is a rectangular copper wire. The four corners of the exciter are indicated by the four black screw heads sunken into the wooden plate.
\\
The localization object is the two by two \centi\metre $\:$ cube placed in the middle of the localization area. It is mounted onto a frame which is used for infrared reference tracking. Hence the four grey infrared reflecting spheres.
\\
The receiving coils are realised by the eight wooden cubes sunken into the wooden plate. Each wooden cube withholds two coils, main and frame receiving coil. Only the main receiving coils can be seen in Figure \ref{fig:loc_area_reallife_image}. The frame receiving coils lie in the x,y plane (Figure \ref{fig:IndLoc_localization_area}).
\subsubsection{The exciter}
The exciter is a copper wire loop fixated on the back of the wooden plate. The corners of the exciter are underneath the black screws (Figure \ref{fig:loc_area_reallife_image}). It spans the 

In order to withhold the current explained in section \ref{sec:The_exciter} the exciter has been attached using a neutric power plug (NL2FC). The copper wired used had a diameter of 0.6\milli\metre .  



\subsubsection{The localization object}
The passive localization object was made out of an 3D cube antenna by the company Neosid. The goal of producing the passive localization system was to transform the coils into series resonance circuits tuned to a resonance frequency of $119 \kilo\hertz$. This was achieved by measuring the real component inductivities with an Agilent 42885A Precision LCR Meter. Then according to formula \cite[p.474]{HARRIEHAUSEN.2020b}: 

\begin{eqnarray} \label{eq:resonance_frequency}
    f_{res} = \frac{1}{2\pi\cdot \sqrt{LC}}
\end{eqnarray}

capacitors were soldered onto a circuit board, connected to the coils. Afterwards the resonance frequency was measured with an Agilent E5071C Network Analyzer and the capacities were adjusted accordingly to reach exactly $119 \kilo\hertz$.

\begin{figure}[h]
	\includegraphics[scale=0.3]{loc_object_on_art_frame}
	\centering
	\caption{The localization object on ART frame with infrared markers}
	\label{fig:loc_object_on_art_frame}
\end{figure}

\subsubsection{The receiving coils}
The receiving coils were switched during the runtime of this project. At one point they were estimated to be the main source of error. Due to this, this section will be more elaborate than the previous ones.
\\
\\
The first decision fell on the antennas with ferrit core, because it was estimated that the ferrite would just amplify the signal of the receiving coils, thus improving the localization. Receiving coils with ferrite core have not been tested with the IndLoc system, so this was new territory. During the testing phase the localization did not function. At this point it was suspected that the ferrite core had something to do with it, but more on this later \todo[]{Link to testing with ferrite core}. In order to fix the problem the ferrite core receiving coils were switched out for regular receiving coils without antennas.

The receiving coils with ferrit core were the 3DCC28-A-0150J made by the company Premo. \todo[]{Datenblatt verlinken}. Eight of these 3D antennas were used as receiving coils. Each of the receiving coil consists of three perpendicular coils. Two of the three coils were used as main and frame receiving coils (Figure \ref{fig:IndLoc_localization_area}). The Premo antennas were a new implementation into the system in order to achieve a more precise localization. The receiving coils normally used for the IndLoc System are around 50\centi\metre  by 25\centi\metre, thus too large for this setup. The decision fell on the Premo receiving coils, because of their small geometry, high inductance and precise construction quality. The receiving coils have an inductance of 1.4 \milli\henry. They are cubic in shape with an edge length of 3.3 \centi\metre $\:$ and an outside plastic housing of 3.7\centi\metre.

\todo[]{In discussion add somewhere that ferrite core increases magnetic field, but is also not taken into account in the fingeprinting creation, may interfere with magnetic field or whatever it may damage the localization more than benefit. Dunno}

The receiving coils without ferrit core were self-made wooden cubes with an edge length of 3.3 \centi\metre $\:$. In each cube a groove has been cut in order to hold the wiring in place. Around each cube 15 windings of copper wire were wrapped tightly. The copper wire has a diameter of 0.315 \milli\metre $\:$. The copper wire is also isolated. The isolation was only removed from the endings of the wire. Any exceeding wire was twisted in order to prevent parasitic capacitance. On each end a plug was soldered which was then connected to the wires leading to the reader. 


\subsection{ART system}

\begin{figure}[h]
	\includegraphics[scale=0.4]{infrared_camera_1}
	\centering
	\caption{One of six infrared cameras, of the ART system, positioned in the room in order to track the localization object.}
	\label{fig:infrared_camera_1}
\end{figure}

In order to verify the objects position, a reference measurement was performed. For this an infrared based localization system of the company ART (Advanced Realtime Tracking GmbH, Am Oeferl 6, 82362, Weilheim i.OB, Germany) was used. This system was chosen because of its sub millimetre precise localization and its adequate localization area of around $20\metre^2$. An alternative available system would have been the Qualisys system located in the LINK testing hall of the Fraunhofer IIS. During this project the Qualisys system was not adequate as its localization area of around $1400\metre^2$ is too large for this project. Also its availability is lower, since the LINK testing hall gets closed on several occasions for other Fraunhofer projects. The ART system was always available during this project. Because of these reasons the decision fell on the ART system. \\
The following components of the ART system were used. Six infrared cameras of the series ARTTRACK5  (Figure \ref{fig:infrared_camera_1}) were used. These cameras act as both infrared light emitter and receiver. The ARTTRACK5 have a tracking range of up to 7.5\metre, a field of view of around 80 degrees and offer up to 1.3 \Mega pix at up to 300\hertz frame rate. The cameras were connected to the ART Controller (ATC), which then again was connected to the host PC. The host PC ran the software (DTrack2). The object was mounted onto the target CT11 (Figure \ref{fig:loc_object_on_art_frame}) with four infrared marker spheres. The spheres reflect the infrared light back to the cameras enabling them to track the object. After calibration (Chapter \ref{sec:Setting up the localization systems}) the system had an accuracy of 0.33\milli\metre , according to the DTrack2 software.



\newpage
\section{Methods}
The following chapter is structured as follows. The first section (Chapter \ref{sec:Setting up the localization systems}) describes the necessary steps to set up the testing systems (Inductive localization system and infrared reference localization system).
\\
The second section (Chapter \ref{sec:precision_measurements}) describes how the accuracy measurement data was created. The following subsections (Chapter \ref{sec:scaling_factor_test}, \ref{sec:K-nearest interpolation test}, \ref{sec:remove_highest_frame_receiving_coil_from_the_localization_test}) explain how the data was then interpreted using different software paramters. These parameters were then altered in an attempt to optimize the systems localization accuracy.


\subsection{Setting up the localization systems}\label{sec:Setting up the localization systems}
In order to determine the precision of the IndLoc setup a series of tests were performed. The localization object was placed in different positions and the position was then measured by the IndLoc system. These measured positions are then compared to an infrared based camera system.

\begin{figure}[h]
	\includegraphics[scale=0.6]{Testing_setup}
	\centering
	\caption{Testing setup}
	\label{fig:Testing_setup}
\end{figure}

In order to prepare the measurements the IndLoc system was brought to a room in which the ART system was already pre-installed. As it requires several holdings for the infrared cameras, wiring connections to a host PC and an empty room with good line of sight. First the window curtains were shut, in order to prevent the infrared cameras getting disturbed by light reflections.
\\
The IndLoc system was then connected via an ethernet cable to the host PC. Then the IndLoc system was turned on and set to an Exciter current of  1\ampere $\:$ and 119 \kilo \hertz. An oscilloscope was connected to the exciter wire and a current clamp is used to measure the frequency and current of the exciter. This is done to reassure that the system is correctly set to the localization objects resonance frequency of 119 \kilo \hertz $\:$ (Chapter \ref{sec:The_localization_object}). 



As the system heats up the measured antenna voltages will rise. This offset can be calibrated out, but in order to receive consistent results the setup should run for about an hour. Several measurements were performed to make sure that the offset drift is gone. While the system is heating up the next step can be performed.


\begin{figure}[h]
  \centering
  \subfloat[Heating up]{\includegraphics[width=0.45\textwidth]{setup_heating_up}\label{fig:setup_heating_up}}
  %\hfill
  \hspace{1cm}
  \subfloat[setup is warm]{\includegraphics[width=0.45\textwidth]{setup_is_warm}\label{fig:setup_is_warm}}
  \caption{Offset heating up}
\end{figure}

As the system is heating up the ART system can be calibrated. How to place the cameras, connect them to the operating PC can be found in the manual. The room calibration set is placed as precisely as possible on the origin of the IndLoc's systems coordinate system. Then the calibration wand has to be moved in the measurement medium in order to generate a virtual point cloud. The progress of the room calibration is shown on the host PC and on the cameras. When the room calibration is finished the ART system will display its accuracy. In this case it achieved an accuracy of 0.33\milli\metre. After the room calibration is done the body calibration has to be performed. This is done by placing the localization object onto the tracking body and fixating the two together. From now on the localization object and the tracking body will, just be called localization object for simplicities sake. The localization object then has to be placed on the origin of the IndLoc systems coordinate system. Now looking at the ART system host PC the location of the object will most likely not be perfectly match 0\milli\metre $\:$ in x,y and z. The ART systems coordinate system can then be shifted by adding offsets onto it. Thus matching the IndLocs and the ART systems coordinate system as good as possible.
\todo[]{maybe cite the quickguide manual here?} 
\\
\\
Now that both localization systems are calibrated correctly a few test measurements should be performed. In order to do this place the localization object on the localization plane and compare the position which both systems display. If they are reasonably close to each other (around 1-2\centi\metre) the systems are working correctly. Confirm this by repeating this process for two or three positions which are at least 10\centi\metre $\:$ apart.

\subsection{Precision measurements}\label{sec:precision_measurements}
All of the following precision measurements were performed by placing the localization object on specific positions in the localization area and measuring the resulting receiving coil voltages. It was positioned by eye using the millimetre sheet as a first rough positioning assistance. The exact position was then determined by recording three seconds with the ART system. As the frame rate of the ART system can differentiate, at least three seconds were recorded to make sure enough samples for further analysis were available. As the ART system is sub millimetre (0.33\milli\metre) precise this position was used as the correct reference position. 
\\
Afterwards the position was measured with the IndLoc system by recording 2000 samples per position. 

2000 samples were recorded for each point so later on the possibility of averaging and analyzing the signal to noise ratio was available. At a sampling rate of 1MHz recording 2000 samples took 2\milli s. These recordings contain the receiving coils voltages. Thus saving a 2D array of 2000 by 16. The file names of each measurement were documented. Then the object was placed 1 \centi\metre 
$\:$ to the side on the mm sheet and the process was repeated until a measurement set of points came together. The data of the precision measurements were then evaluated with different hard- or software parameters in order to optimize them.  
\subsubsection{Scaling factor test}\label{sec:scaling_factor_test}
The scaling factor is a factor that is multiplied onto each receiving coil voltage. Its purpose is to diminish the difference between the calculated receiving coil voltages in the fingerprinting table and the real measured voltages. As the fingerprinting table is created certain parameters are required as input, such as for example: Exciter wire resistance, Inductance of the receiving coils, Resistance of the receiving coils, Windings of the localization object, etc. As measuring all of these parameters would take too much effort the scaling factor has been implemented. Usually the scaling factor is tested empirically for each IndLoc setup or prototype that is built.


\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_scaling_factor_1}
	\centering
	\caption{Before being able to localize precisely the correct scaling factor, which multiplies each receiving coil voltages, has to be determined. For this the scaling factors $10^{2}$ to $ 10^{-4}$ were tested in logarithmic steps.}
	\label{fig:estimation_scaling_factor_1}
\end{figure}

A first rough estimation of the scaling factor was done by testing $10^{2}$ to $ 10^{-3}$ in logarithmic steps (Figure \ref{fig:estimation_scaling_factor_1}, \ref{fig:estimation_scaling_factor_2}). Figure \ref{fig:estimation_scaling_factor_1} shows the entire localization area. The blue outside rectangle represents the Exciter, which creates the primary magnetic field (Chapter \ref{sec:The_exciter}). The black rectangles along the exciter represent the receiving coils, measuring the secondary magnetic field of the localization object (Chapter \ref{sec:The_receiving_coils}). The axis span the localization area (Figure \ref{fig:Testing_setup}). The green cross markers in the middle of plot are the positions determined by the ART system. As the precision of the ART system is 0.33\milli\metre $\:$ the green markers are used as the correct reference position of the localization object. The different shaped black markers are the position the IndLoc system calculated with the different scaling factor. The scaling factor for each marker shape can be seen in the legend. It is to be noted that only the first sample of the ART and the IndLoc recordings were used during this test. How the noise affects the localization during the 2000 samples of one recording will be investigated later (Chapter \ref{sec:Noise_investigation}).


\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_scaling_factor_2}
	\centering
	\caption{A zoomed in view of Figure \ref{fig:estimation_scaling_factor_1} shows which scaling factors result in a localization closest to the correct positions.}
	\label{fig:estimation_scaling_factor_2}
\end{figure}

Figure \ref{fig:estimation_scaling_factor_2} shows a magnified view of Figure \ref{fig:estimation_scaling_factor_1}. Afterwards multiple scaling factors around $10^{-3}$ to $ 10^{-4}$ were used, in an attempt to narrow down the optimal scaling factor. The best results seemed to appear in the range of scaling factors of 0.0015 to 0.002. 

As the evaluation of the differences in localization precision by eye became impossible a statistical method was attempted. For this the distance between each pair of points was calculated with the following formula. 

\begin{equation}\label{eq:distances}
d_{Pi} = \sqrt{(x_{ART_{Pi}} - x_{IndLoc_{Pi}})^2 + (y_{ART_{Pi}} - y_{IndLoc_{Pi}})^2 }
\end{equation}
The mean distance for each scaling factor was calculated with:
\begin{equation}\label{eq:mean}
\mu ={\frac {1}{n}}\sum _{i=1}^{n}d_{i}={\frac {d_{1}+d_{2}+\cdots +d_{n}}{n}}
\end{equation}
The standard deviation for each scaling factor was calculated with the formula:
\begin{equation}\label{eq:std_dev}
\sigma = \sqrt{\frac{\sum |P_{i} - \mu|^2}{N}}
\end{equation}


\begin{figure}[h]
	\includegraphics[scale=0.3]{estimation_scaling_factor_3}
	\centering
	\caption{Placing the object in 25 positions near the centre of the localization area with a scaling factor of 0.001755, resulting in mean error $\mu = 3.76\milli\metre$ and standard deviation $\sigma = 3.28\milli\metre$.}
	\label{fig:estimation_scaling_factor_3}
\end{figure}

\begin{comment}
avg distance 3.757373465139104
median distance 2.6566228652376584
mean distance 3.757373465139104
std dev distance 3.2792325092288714
\end{comment}

\clearpage
Each equation was applied to a total of 500 different scaling factors ((0.0015, 0.002, 0.000001 - start, stop, step)). An optimum was found at a scaling factor of 0.001755 with $\mu = 3.76\milli\metre \:$ and $\sigma = 3.28\milli\metre \:$ resulting in the localization which can be seen in Figure \ref{fig:estimation_scaling_factor_3}. In order to verify these results another set of positions was used, which was positioned near the corner of the localization area (Figure \ref{fig:estimation_scaling_factor_4}).



\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_scaling_factor_4}
	\centering
	\caption{Placing the object in 25 positions near the corner of the localization area with a scaling factor of 0.002100, resulting in mean error $\mu = 10.39\milli\metre$ and standard deviation $\sigma = 7.52\milli\metre$.}
	\label{fig:estimation_scaling_factor_4}
\end{figure}

\begin{comment}
 scaling_factor =  0.0021000000000000016 
 mean_error =  10.39 
 standard_deviation =  7.52
Plotting positions for: sf= 0.0021000000000000016 , k= 3
\end{comment}

Statistically optimizing the scaling factor for the off centre set of points resulted in a scaling factor of 0.002105. Resulting in a mean error $\mu = 6.18\milli\metre \:$ and a standard deviation $\sigma = 7.71\milli\metre$.

\begin{comment}
Best scaling factor =    mean =  6.180273611932338 std_dev =  7.715220033729418 ; min_both =  13.895493645661755
\end{comment}
As the localization accuracy declined it suggested that the optimal scaling factor is positional dependant. For this reason the whole localization system had to be taken into account.

\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_scaling_factor_5}
	\centering
	\caption{Placing the object in 42 positions running from the centre to the edges of the localization area with a scaling factor of 0.00204, , resulting in mean error $\mu = 7.42\milli\metre$ and standard deviation $\sigma = 6.48\milli\metre$.}
	\label{fig:estimation_scaling_factor_5}
\end{figure}

In order to look at the entire localization area the object was placed 42 positions running in a horizontal and a diagonal line from the centre to the edge of the localization area (Figure \ref{fig:estimation_scaling_factor_5}). Due to the symmetric setup these lines can be mirrored and as such give a rough estimation of the entire localization area. 

\begin{comment}
best sf = 0.00204  mean =  7.421424662824991 std dev =  6.481103235160666 ; min both =  13.902527897985657
\end{comment}

\clearpage
\subsubsection{K-nearest interpolation test}\label{sec:K-nearest interpolation test}
During localization a k-nearest neighbour interpolation is performed. The 16 measured receiving coil voltages are compared to the fingerprinting table (Chapter \ref{sec:The_host system}). The k best matching entries of the fingerprinting table are selected. The X-,Y-,Z-positions of the selected entries are then used for the k-nearest neighbour interpolation resulting in a final X-,Y-,Z-position.
\\
If the k-nearest neighbour interpolation would not be performed the final position could only have \centi\metre $\:$ values without decimal places. The reason being that the fingerprinting table is created using a 1\centi\metre $\:$ X-,Y-,Z-step width (Chapter \ref{sec:The_host system}). That is why the k-nearest neighbour interpolation is a crucial step to achieve sub \centi\metre$\:$ precision. During all previous tests k=2 was used, as this is the lowest possible value. If k=1 would have been used the previously problem of achieving sub \centi\metre $\:$ precision would have occurred and may have distorted previous results.

During this chapter multiple k values will be tested and the resulting localization precision will be determined. As previously mentioned (Chapter \ref{sec:precision_measurements}) the data, which was analysed during the scaling factor test (Chapter \ref{sec:scaling_factor_test}) will be analysed during this test as well. Namely the set of points in the centre (Figure \ref{fig:estimation_scaling_factor_3}), in the corner (Figure \ref{fig:estimation_scaling_factor_4}) and the set of points which cover the entirety of the localization area(Figure \ref{fig:estimation_scaling_factor_5}). In order to receive comparable results, the individual optimized scaling factor for each set of points were used (Chapter \ref{sec:scaling_factor_test}).

\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_k_nearest_1}
	\centering
	\caption{placing the localization object in 25 positions near the centre of the localization are with a k-nearest value of 19, resulting in mean error $\mu = 3.21\milli\metre$ and standard deviation $\sigma = 1.84\milli\metre$.}
	\label{fig:estimation_k_nearest_1}
\end{figure}

\begin{comment}

[BEST MEAN]: k_nearest: 9  --> mean= 3.17 , std_dev= 2.04
[BEST MEAN+STD]: current k_nearest: 19  --> mean= 3.21 , std_dev= 1.84

current k_nearest: 2  --> mean= 7.44 , std_dev= 4.87
current k_nearest: 100  --> mean= 5.29 , std_dev= 2.19

Trend: mean and std start high, both decrease as k rises. Lowest mean at k=9. Lowest both at k=19 (statistical optimum). Then after that it gets worse until k=100 the mean rises until 5 and std_dev until 2.
\end{comment}

A total of 100 k values were tested (start:1, stop:100, step:1) and were each evaluated using the formulas (\ref{eq:distances}), (\ref{eq:mean}) and (\ref{eq:std_dev}). An optimum was determined at k=19 with $\mu = 3.21\milli\metre$ and $\sigma = 1.84\milli\metre$ (Figure \ref{fig:estimation_k_nearest_1}). 


\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_k_nearest_2}
	\centering
	\caption{placing the localization object in 25 positions near the corner of the localization are with a k-nearest value of 12, resulting in mean error $\mu = 10.39\milli\metre$ and standard deviation $\sigma = 7.52\milli\metre$.}
	\label{fig:estimation_k_nearest_2}
\end{figure}

\begin{comment}
 scaling_factor =  0.0021 
 mean_error =  10.39 
 standard_deviation =  7.52
Plotting positions for: sf= 0.0021 , k= 3
\end{comment}

\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_k_nearest_3}
	\centering
	\caption{Placing the object in 42 positions running from the centre to the edges of the localization area with a k-nearest value of 4, resulting in mean error $\mu = 7.57\milli\metre$ and standard deviation $\sigma = 5.34\milli\metre$.}
	\label{fig:estimation_k_nearest_3}
\end{figure}

\begin{comment}
scaling_factor =  0.00204 
 mean_error =  7.57 
 standard_deviation =  5.34
Plotting positions for: sf= 0.00204 , k= 4
\end{comment}

\clearpage
\subsubsection{Remove highest frame receiving coil from the localization test}\label{sec:remove_highest_frame_receiving_coil_from_the_localization_test}
It is known in the team that the localization near the receiving coils  declines. For this reason the frame receiving coil which shows the highest voltage, is removed from the localization calculations.

\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_removing_highest_frame_1}
	\centering
	\caption{(sf= 0.001755 , k= 19) Placing the localization object in 25 positions near the centre of the localization area with removing the highest frame receiving coil, resulting in mean error $\mu = 5.56\milli\metre$ and standard deviation $\sigma = 3.2\milli\metre$.}
	\label{fig:estimation_removing_highest_frame_1}
\end{figure}

\begin{comment}
 scaling_factor =  0.001755 
 mean_error =  5.56 
 standard_deviation =  3.2
Plotting positions for: sf= 0.001755 , k= 19
\end{comment}


\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_removing_highest_frame_2}
	\centering
	\caption{(sf= 0.0021 , k= 12) Placing the localization object in 25 positions near the corner of the localization area with a k-nearest value of 4, resulting in mean error $\mu = 13.32\milli\metre$ and standard deviation $\sigma = 8.24\milli\metre$.}
	\label{fig:estimation_k_nearest_2}
\end{figure}

\begin{comment}
 scaling_factor =  0.0021 
 mean_error =  13.32 
 standard_deviation =  8.24
Plotting positions for: sf= 0.0021 , k= 12

So far my method was: Determine the best scaling_factor, then for the next tests keep using this sf.
Then after that with this sf determine the best k_nearest value. 

Then in this test I used the best sf from sf_test for this set of data (horiz+diag) and the best k from k-test. Both of these parameters were used in this "take out highest frame" test and the localization was fairly shitty.
I tested a bit around and the best I could get was at totally different sf and k. 
!!!----------!!!------------!!!-------------!!!--------------!!!---
In general I feel like that when changing the sf, the k nearest needs to be readjusted. And vice versa. So the two are dependant.
!---------!!!!-------------!!!--------------!!!--------!!!---------
\end{comment}



\begin{figure}[h]
	\includegraphics[scale=0.4]{estimation_removing_highest_frame_3}
	\centering
	\caption{(sf= 0.00204 , k= 4) Placing the object in 42 positions running from the centre to the edges of the localization area with a k-nearest value of 4, resulting in mean error $\mu = 15.21\milli\metre$ and standard deviation $\sigma = 14.33 \milli\metre$.}
	\label{fig:estimation_k_nearest_3}
\end{figure}

\begin{comment}
 scaling_factor =  0.00204 
 mean_error =  15.21 
 standard_deviation =  14.33
Plotting positions for: sf= 0.00204 , k= 4
\end{comment}

\clearpage
\subsubsection{Noise investigation}\label{sec:Noise_investigation}
\begin{figure}[h]
  \centering
  \subfloat[The localization object was placed in P13 (green). 2000 samples were recorded with the IndLoc system, resulting in 2000 slightly different positions, due to noise (black). The mean error is $\mu = 1.73\milli\metre$.]{\includegraphics[width=0.49\textwidth]{estimation_noise_1}\label{fig:estimation_noise_1}}
  \hfill
  \subfloat[A magnified view of the 2000 IndLoc positions shows how noise affects the localization. The positions lie within a $\Delta x = 0.253\milli\metre$ by $\Delta y = 0.358\milli\metre$ rectangle. The standard deviation is $\sigma = 0.04\milli\metre$.]{\includegraphics[width=0.49\textwidth]{estimation_noise_2}\label{fig:estimation_noise_2}}
  \caption{Investigating the localization error due to noise in the receiving coils for 2000 samples. P13 was attempted to localize which lies almost exactly in the centre of the localization area ($\pm 1 \milli\metre$).}
\end{figure}
In order to investigate to what extend noise in the receiving coil voltages, affects the localization, this test was performed. The localization object was placed in the center of the localization area (P13 of Figure \ref{fig:estimation_scaling_factor_3}). Then 2000 samples of the receiving coil voltages were recorded. Each of the samples were used to localize to the object, resulting in 2000 positions with a mean error of $\mu = 1.73\milli\metre$ (Figure \ref{fig:estimation_noise_1}). The noise level measured beforehand was $\pm 10\mu\volt$ (Figure \ref{fig:setup_is_warm}), resulting the positions to vary in a  
$\Delta x = 0.253\milli\metre$ by $\Delta y = 0.358\milli\metre$ rectangle or a standard deviation of $\sigma = 0.04\milli\metre$ (Figure \ref{fig:estimation_noise_2}). 

The test was repeated with the localization object placed near a corner of the localization area ($x = 400 \milli\metre$, $y = 428\milli\metre$), resulting in $\mu = 27.78 \milli\metre$ and $\sigma=0.01\milli\metre$. 
\begin{figure}[h]
	\includegraphics[scale=0.35]{estimation_noise_3}
	\centering
	\caption{(sf= 0.00204 , k= 4) Placing the object in 42 positions running from the centre to the edges of the localization area with a k-nearest value of 4, resulting in mean error $\mu = 15.21\milli\metre$ and standard deviation $\sigma = 14.33 \milli\metre$.}
	\label{fig:estimation_k_nearest_3}
\end{figure}

\subsection{Movement measurements}\label{sec:movement_measurements}
\clearpage
\section{RESULTS}

\clearpage
\section{DISCUSSION}

\clearpage
\section{SUMMARY, OUTLOOK INTO THE FUTURE}



\clearpage

\bibliography{Literatur_BA_2}
\end{document}

