Install GazeParser (Windows)
==================================

Dependencies
-------------------------

**Python 3.6** or later is necessary to use GazePaser.
GazeParser depends on following Python modules.

- **numpy**
- **scipy**
- **matplotlib**
- **PIL (Python Imaging Library)**
- **wxPython** (for data viewer)
- **PsychoPy** (experimental control library)

.. note::
     * VisionEgg backend is no longer supported by 0.11.0 or later.

Following libraries are necessary to build SimpleGazeTracker.

- libsdl2.0
- libsdl2.0-net
- libsdl2.0-ttf
- opencv
- SDKs for your camera

Download
---------------------------

GazeParser installer can be downloaded from following page. 

`<http://sourceforge.net/projects/gazeparser/files/>`_

Install GazeParser to computers which you plan to use stimulus presentation and data analysis.

- `GazeParser-0.12.0.zip <https://sourceforge.net/projects/gazeparser/files/GazeParser/0.12.0/GazeParser-0.12.0.zip>`_ : source distribution (expand this and run 'python setup.py install')

If you plan to record gaze data, install one of following files to a computer which you plan to use recording gaze data.

- `SimpleGazeTracker-0.12.0-OptiTrack-2.2.0.msi <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/SimpleGazeTracker-0.12.0-OptiTrack-2.2.0.msi>`_ : SimpleGazeTracker installer for OptiTrack V120 or V100R2 cameras
    Probably OptiTrack Camera SDK will be necessary to use SimpleGazeTracker.
    The SDK can be downloaded from OptiTrack Downloads page.

    `<https://optitrack.com/support/downloads/developer-tools.html>`_

    Version number following 'OptiTrack-' in the SimpleGazeTracker installer indicates which version of SDK is necessary.
    For example, if name of the SimpleGazeTracker installer is SimpleGazeTracker-0.12.0-OptiTrack-**2.2.0**.msi, OptiTrack CameraSDK 2.2.0 is necessary.

- `SimpleGazeTracker-0.12.0-OpenCV-4.5.1.msi <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/SimpleGazeTracker-0.12.0-OpenCV-4.5.1.msi>`_ : SimpleGazeTracker installer for cameras supported by OpenCV.
    Necessary interfaces, drivers and other applications depend on camera unit.  Confirm user manual of the camera.

- `SimpleGazeTracker-0.12.0-FlyCapture2-2.13.61.msi <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/SimpleGazeTracker-0.12.0-FlyCapture2-2.13.61.msi>`_ : SimpleGazeTracker installer for `Point Grey Flea3 USB3.0 camera (FL3-U3-13Y3M-C) <http://ww2.ptgrey.com/USB3/Flea3>`_.
    FlyCapture2 software must be installed to the recording PC.

- `SimpleGazeTracker-0.12.0-Spinnaker-2.0.3.77.msi <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/SimpleGazeTracker-0.12.0-Spinnaker-2.0.3.77.msi>`_ : SimpleGazeTracker installer for `Point Grey Flea3 USB3.0 camera (FL3-U3-13Y3M-C) <http://ww2.ptgrey.com/USB3/Flea3>`_.
    Spinnaker software must be installed to the recording PC.  **Note Spinnaker 2.2 or older is not compatible.**

If you need source files of SimpleGazeTracker, download following file.

- `SimpleGazeTracker-0.12.0-src-vs2019.zip <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/SimpleGazeTracker-0.12.0-vs2019.zip>`_ : Zipped archive of source files.
    Source files of SimpleGazeParser for Microsoft Windows is provided as a project of Microsoft VisualStudio.
    vsXXXX indicates the version of VisualStudio (e.g. 'vs2019' indicates VisualStudio2019).


.. _build_simplegazetracker_windows:

Setting up VisualStudio2019 to build SimpleGazeTracker (SimpleGazeTracker 0.12.0)
----------------------------------------------------------------------------------

Download zipped source files of SimpleGazeTracker and expand it under VisualStudio2019 project directory.
Get **development library** of libsdl, libsdl-net, libsdl-ttf.

- http://www.libsdl.org/release/ (libsdl2)
- http://www.libsdl.org/projects/SDL_ttf/release/ (libsdl2-ttf)
- http://www.libsdl.org/projects/SDL_net/release/ (libsdl2-net)

Expand zipped files under C:/SDL2.  Create C:/SDL2/include/SDL and C:/SDL2/bin. Copy all SDL include files (\*.h) to C:/SDL/include/SDL.


In a similar way, copy all SDL DLL files (\*.dll) to C:/SDL/bin.  Add C:/SDL/bin to %PATH% environment variable.

Next, get Measurement Computing's **Universal Library** and install it.

- http://www.mccdaq.com/software.aspx (Universal Library)


Get OpenCV self-extract file from following URL. Extracted files to C:/opencv. Same as above, update "include" and "library" directories of project's property. Add C:/opencv/build/x86/vc10/bin to %PATH% environment variable.

- https://opencv.org/releases/

Install SDK for your camera. The SimpleGazeTracker's source file assumes that SDKs are installed under following directories.

============ =================================================
Edition      Directory
============ =================================================
FlyCapture2  C:/Program Files/Point Grey Research/FlyCapture2
OpenCV       *(No camera-specific SDK)*
OptiTrack    C:/Program Files (x86)/NaturalPoint/Optitrack
Spinnaker    C:/Program Files/FLIR Systems/Spinnaker/
============ =================================================

If you want to install these files in other directory, you'll have to edit "Include Directory" and "Library directory" of project's property so that VisualStuido can find necessary files.
Start VisualStudio and open SimpleGazeTracker solution. Right-click on project (for example, SimpleGazeTracker_FlyCapture2) in the Solution Explorer to show pop-up menu. Then, select "Properties" (Figure 2).

.. figure:: build_windows_002.png

    Figure 2

Select "VC++ Directories" and left-click an edit box right to "Include Directories". Then, select "<Edit...>" (Figure 3).

.. figure:: build_windows_003.png

    Figure 3

Comfirm that *Include directries* are correct.   In a similar way, check *Library directories* and update them if necessary.