Two-point Pinch Test (TPT)

Initialize NeuroAnalyzer
using NeuroAnalyzer
import CairoMakie
# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of
# NeuroAnalyzer figures: remove it
delete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)

The Two-point Pinch Test (TPT) is a variant of the Finger Tapping Test: instead of tapping, the subject pinches the thumb and the index finger together as quickly as possible. The movements are recorded with an accelerometer attached to the index finger.

Hardware

The Arduino runs a program that reads the accelerometer 50 times per second and sends the data via the serial port (19200 baud), one line per sample:

tpt: <x> <y> <z> <ax> <ay> <az>

where x, y, z are the raw orientation values of the sensor and ax, ay, az are the accelerations [m/s²].

Recording

There are two versions of the test:

  • itpt(): GUI mode, the test runs in a window,
  • tpt(): CLI mode, the test runs in the terminal.

Parameters:

  • duration: recording length in seconds (default: 20),
  • port_name: serial port of the Arduino (default: "/dev/ttyUSB0").

GUI Mode

e = itpt(; duration = 60, port_name = "/dev/ttyUSB0")

Press RECORD to start: after 2 seconds (data buffered in the serial port are discarded) and a beep, the recording starts, the finger image changes and the acceleration is plotted as it is recorded. The window closes 2 seconds after the end of the recording. If the window is closed earlier, the samples recorded so far are returned.

CLI Mode

e = tpt(; duration = 60, port_name = "/dev/ttyUSB0")
NeuroTester: TPT
================
   Duration: 60 [seconds]
Serial port: /dev/ttyUSB0

Ready to start — press SPACEBAR to begin the test

The test will start after a beep

   Pinch the thumb and the index finger as quickly as possible

Testing completed

Recorded Signal

Both functions return a NEURO object of the tpt data type, with 6 channels sampled at 50 Hz:

Label Type Unit Description
pos_x orient orientation, X
pos_y orient orientation, Y
pos_z orient orientation, Z
acc_x accel m/s² acceleration, X
acc_y accel m/s² acceleration, Y
acc_z accel m/s² acceleration, Z

The object can be saved, plotted and processed as any other NEURO object, e.g. the acceleration:

NeuroAnalyzer.plot(e; ch = ["acc_x", "acc_y", "acc_z"])

Example (simulated recording, 10 s): each pinch is a short deflection in all three acceleration channels, on top of the gravity and the slowly changing position of the hand:

Analysis

tpt_detect() returns the sample indices of the detected pinches, and tpt_analyze() summarizes the intervals between them.

In a real recording, one pinch (closing the fingers, contact, opening) is not a single deflection but a burst of several short acceleration peaks lasting 0.3-0.6 s; in addition, the accelerometer produces occasional single-sample glitches. A pinch is therefore detected as a peak of the movement envelope:

  1. glitches are removed from each acceleration channel (running median over 5 samples),
  2. the position of the hand (running median over ± 2 s) is subtracted from each channel,
  3. the three channels are combined into the length of the 3-D acceleration vector, which is smoothed (moving mean over ± 0.04 s) so that the peaks of one pinch merge into one,
  4. peaks of the envelope are pinches if they are large enough and at least 0.25 s apart.

The detection threshold adapts to the noise and the size of the pinches in the recording, so the acceleration units do not matter.

r = tpt_analyze(e)
  • n: number of pinches,
  • t_mean, t_median: mean and median interval between pinches [ms],
  • t_rmssd: root mean square of successive differences between the intervals [ms],
  • t_sdsd: standard deviation of successive differences between the intervals [ms].

tpt_analyze() returns nothing if fewer than 2 pinches are detected.

The detection was validated on 22 recordings with 0 to 10 pinches: the number of pinches was exact in 17 recordings (mean error 0.7 pinch), and no pinches were detected in recordings without pinching. Errors are more frequent with very fast, continuous pinching (some pinches merge and are missed), so check the detected pinches against the plotted signal.