Scripting API

btkWriteAcquisition

Module BTKIO

Description#

Writes acquisition's data into file (C3D, ...) (C3D is the only format currently supported).

Parameters#

hHandle pointing to a C++ btk::Acquisition object.
filenameString with the path of the acquisition to export.

Returned Values#

Detailed Description#

btkWriteAcquisition(h, filename) exports acquisition's data represented as the handle h into the file filename. The choice of the file format is based on the file extension in filename (for example, '.trc' or '.c3d'), the only currently supported format is .c3d. A C3D File is written using the machine byte order and the float as storage format. The writing of an empty acquisition (no point and no analog channel) in a C3D file will create a template C3D file. Only the metadata will be saved.

Notes#

See also#

btkReadAcquisition

Syntax#

btkWriteAcquisition(h, filename)

Examples#

path= ('/Static_Example.c3d')
acqstatic = btkReadAcquisition(path)
(markersStatic) = btkGetMarkers(acqstatic)

x1=markersStatic[0]['epi_med_right'][:,0]
x2=markersStatic[0]['epi_lat_right'][:,0]
y1=markersStatic[0]['epi_med_right'][:,1]
y2=markersStatic[0]['epi_lat_right'][:,1]
z1=markersStatic[0]['epi_med_right'][:,2]
z2=markersStatic[0]['epi_lat_right'][:,2]

M_p = np.array([(x1+x2)/2, (y1+y2)/2, (z1+z2)/2]).transpose()
btkAppendPoint(acqstatic, 'marker', 'V_Knee_Joint_Center_right',M_p)
btkWriteAcquisition(acqstatic, 'Static_Example_with_Knee_Joint_Center_right.c3d')