Skip to content

Commit

Permalink
Updated docs -Linux install instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyzhd committed Aug 8, 2023
1 parent beb7f1f commit abfe473
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 37 deletions.
34 changes: 0 additions & 34 deletions BTK_install_linux.md

This file was deleted.

2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ provides higher-level interface, with abstractions such as 'trial' and
'gait cycle'. Data can be read from Vicon Nexus or directly from c3d
files.

gaitutils is primarily developed for Windows, but there is also some support for Linux.

Example: to read the current trial from Vicon Nexus and plot the Plug-in Gait
lower body kinematics:

Expand Down
4 changes: 3 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
.. include:: readme.rst

.. include:: install.rst
.. include:: install_win.rst

.. include:: install_lin.rst

.. include:: gui.rst

Expand Down
109 changes: 109 additions & 0 deletions docs/install_lin.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Installation (Linux)
====================
Linux support is somewhat experimental, however you should be able to get it
running on Linux (sans Vicon Nexus integration, naturally).

The installation instructions are in general similar to those for Windows
(see :doc:`install_win`) with a few differences.

Conda environment file
----------------------

You should use ``environment_linux.yml`` file (instead of ``environment.yml``)
for creating the conda environment for Linux:

::

curl -O https://raw.githubusercontent.com/NCH-Motion-Laboratory/gaitutils/master/environment_linux.yml
conda env create -f environment_linux.yml

No viconnexusapi
----------------

There is no viconnexusapi for Linux, so you just skip the viconnexusapi installation step.

Setting up BTK
--------------

If you want support for reading C3D files (and gaitutils on Linux is pretty
useless without it), you'll have to build BTK yourself. Here are the main
steps:

Building and installing BTK
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Activate the gaitutils environment

#. Clone BTKCore (unless it has already been cloned as a submodule)

::

git clone [email protected]:Biomechanical-ToolKit/BTKCore.git
#. Run cmake

::

cd BTKCore
cmake . -DBTK_WRAP_PYTHON=True -DNUMPY_INCLUDE_DIR=/home/andrey/opt/anaconda3/envs/gaitutils/lib/python3.11/site-packages/numpy/core/include/ -DNUMPY_VERSION=1.23.4 -DCMAKE_CXX_STANDARD=11 -DCMAKE_POSITION_INDEPENDENT_CODE=True -DCMAKE_INSTALL_PREFIX=/home/andrey/opt/anaconda3/envs/gaitutils/

You will likely need to change the values of ``-DNUMPY_INCLUDE_DIR``,
``-DNUMPY_VERSION``, and ``-DCMAKE_INSTALL_PREFIX`` to correctly
reflect your installation.

#. Build:

::

make

**NOTE!** This uses the system's gcc compiler (and probably other tools).
It doesn't work with the gcc installed through conda, co there should
be no gcc in your conda environment.

#. Install:

::

make install

#. In the site-packages folder of the anaconda environment create a new subfolder
called ``btk``. Assuming that you installed anaconda in
``/home/andrey/opt/anaconda3`` and you are using Python 3.11:

::

mkdir /home/andrey/opt/anaconda3/envs/gaitutils/lib/python3.11/site-packages/btk

#. Copy the package files there:

::

cp bin/btk.py bin/_btk.so /home/andrey/opt/anaconda3/envs/gaitutils/lib/python3.11/site-packages/btk

#. Rename ``btk.py`` to ``__init__.py``:

::

cd /home/andrey/opt/anaconda3/envs/gaitutils/lib/python3.11/site-packages/btk
mv btk.py __init__.py


Testing BTK installation
^^^^^^^^^^^^^^^^^^^^^^^^

#. Open a new terminal and activate the environment

#. Run python

#. In Python run:

::

import btk
reader = btk.btkAcquisitionFileReader()
reader.SetFilename("dynamic.c3d") # replace dynamic.c3d with your own file
reader.Update()
acq = reader.GetOutput()
acq.GetPointFrequency()
4 changes: 2 additions & 2 deletions docs/install.rst → docs/install_win.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Installation
============
Installation (Windows)
======================

Python
------
Expand Down
2 changes: 2 additions & 0 deletions docs/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ plotting of 3D gait analysis data. Compared to packages such as btk, it
provides higher-level interface, with abstractions such as 'trial' and
'gait cycle'. Data can be read from Vicon Nexus or directly from c3d
files.

gaitutils is primarily developed for Windows, but there is also some support for Linux.

0 comments on commit abfe473

Please sign in to comment.