Python Forum

Full Version: BTK tool in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I'm working on a project in biomechanics and i need to use BTK tools in order to play with some C3D files. But i have a problem :
i followed the steps listed in the tutorial here :
http://biomechanical-toolkit.github.io/d...arted.html

and i wrote these lines :
import sys
import btk
import numpy
reader = btk.btkAcquisitionFileReader()
reader.SetFilename('ScapulaLocatorCalib_1_v1.c3d')
reader.Update()
acq = reader.GetOutput()
acq.GetPointFrequency()
acq.GetPointFrameNumber()
But i don't know where i have to put my C3D file so i have this error :

Error:
Traceback (most recent call last): File "D:/badrou/Desktop/test.py", line 6, in <module> reader.Update() File "C:\Python27\lib\site-packages\btk\__init__.py", line 4942, in Update return _btk.btkAcquisitionFileReader_Update(self) RuntimeError: File doesn't exist Filename: ScapulaLocatorCalib_1_v1.c3d
Thank you so much for your help,
Best regards,

Arif
Unless you use an absolute path, all file paths are relative to wherever you're running the script, which is normally wherever the script itself is.