• No results found

Brainsight Software

as well as for controlling sleeping patterns for subject’s who are being treated whilst asleep [152]. TMS has therefore an established treatment for patients suffering from the above problems. Any improvements that can be made to the treatment environment can only be beneficial.

Other conditions which have been reported to respond to TMS include: Tinni- tus, Parkinson’s Disease, Dystonia, Epilepsy, Migraine, Dysphasia and Hemispatial neglect [153].

4.2

Brainsight Software

The Brainsight, frame-less image-guided, TMS system (Magstim, UK) used during this project, incorporates a Polaris optical tracking system for tracking the electro- magnetic coil and its relative position to the subject’s head.

(a) (b)

Figure 4.2: (a)The tracker used to identify the position of the subjects head, and (b) The Brainsight software displaying targetting information on a computer display.

4.3. Optical Tracking 94

4.3

Optical Tracking

In order to accurately render the patients brain from the view point of the operator, the system needs to know the orientation of both the subject’s head and the view point of the operator. The Polaris Optical tracking system (described in Chapter 3) is supplied with several tools, which include a head position tracker and a digitizing probe that is used for the accurate pinpointing of positions in the trackers view. The head position marker is used to represent the position of the subject’s head and the probe to identify the position of the operator’s viewpoint - see Figure 4.3.

(a) (b)

Figure 4.3: The tools being tracked: (a) The subjects head, The electromagnetic coil and (b) the viewpoint of the operator captured using a webcam aligned with the digitizing probe

4.3.1

Polaris Interface

Communication between the operator’s laptop and the Polaris System is achieved by sending serial ASCII text messages using the RS232 standard as shown in Figure 4.4. All communications are initiated by the laptop, which sends a message and will in response receive a reply either containing the requested information or a flag

4.3. Optical Tracking 95

Figure 4.4: System Diagram showing the flow of data and the tools that are being tracked.

indicating whether or not the last command was successful. Messages sent to the Polaris system always take one of the following two formats:

Command | <SPACE> | Parameter 1 | Parameter 2 ... | Parameter n | <CR> Command | <:> | Parameter 1 | Parameter 2 ... | Parameter n | CRC16 | <CR>

The Polaris system always responds with the following format:

4.4. Video Capture 96

The description of the marker configuration for each tool is specified in a ROM file, which is provided by the manufacturer, and each tool isplugged into the tracker by passing the contents of these ROM files in messages. It is then possible to simply query the tracker as to the position of each tool, which it returns as a quaternion and translation pair.

4.3.2

Error Checking

A 16-bit Cyclic Redundancy Check (CRC) based upon the IBM standard is used to validate the integrity of each command sent to the Polaris system and each reply received from the Polaris system, using the polynomial:

x

16

+x

15

+x

2

+ 1

Therefore should an error occur our software can detect it and either retry the previous command, or return an error to the operator saying that an error has occurred. The Polaris system also provides the ability to search the surrounding area for environmental IR sources which can cause interference to the marker reflected IR and therefore cause inaccurate results. The operator can then either identify and remove these IR sources or the software can compensate for the possible loss of precision [154].

4.4

Video Capture

The software that has been developed is named Bangor AR for TMS (BART). In BART the operator’s viewpoint is captured by a USB web-cam, using video4linux (V4L)which provides the video capture/overlay framework API for the linux kernel.

4.5. Coordinate system 97

The V4L API provides a generic interface to USB and Firewire based imaging devices [155]. BART allows the user the flexibility to use any general purpose webcam and allows our software to capture an image from the camera at each time-step of our applications execution. V4L also follows the same conventions of thevideo4windows (V4W) API allowing that the software could be ported to the Microsoft Windows platform with ease.

4.5

Coordinate system

BART uses a 3D Cartesian coordinate system which follows the right hand rule for the viewing transformations, specifying the directions of positive and negative as shown in Figure 4.5(a). This is the same convention as used by both OpenGL and VTK, allowing our transformation information to be moved easily between the graphics API’s being used.

To allow us to realistically match the virtual world to the real world a Perspective Projection is used. This allows the objects in our virtual environment to beprojected

onto a viewing plane. This plane can then be matched to the view captured by the camera view point. Although sometimes in computer graphics, it would not be suitable to use Orthographic Projection as an alternative. Orthographic Projection is used mainly for design applications where the z-axis coordinate is ignored. This would mean that each virtual object would be the same size regardless of their distance from the camera [156].